/* Estilos generales */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: Arial, sans-serif;
}

/* Contenedor principal para la división vertical */
.main-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Contenedor de la parte superior (Bloques + Código) */
.top-panels-container {
  display: flex;
  flex-grow: 1;
  position: relative;
}

/* Contenedor de los paneles y la barra */
#blocklyDiv {
  flex-grow: 3;
  height: 100%;
}

.code-output {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding-top: 60px;
  padding-left: 20px;
  padding-right: 20px;
  padding-bottom: 20px;
  background: url("https://i.postimg.cc/dt2Pps7B/py51.png") no-repeat center center;
  background-size: cover;
  overflow-y: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
}


/* Estilos para el resizer vertical */
.resizer {
  width: 10px;
  height: 100%;
  background: #2b2b2b;
  cursor: ew-resize;
  user-select: none;
  flex-shrink: 0;
  border-left: 1px solid #333;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 0.4s ease-in-out;
}

.resizer:hover {
  background-color: #383838;
}

/* Estilos para las flechas del slider vertical */
.resizer-grip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #777;
  font-size: 1.2rem;
  transition: color 0.4s ease-in-out, transform 0.4s ease-in-out;
  pointer-events: none;
}

.resizer:hover .resizer-grip {
  color: #ccc;
  transform: scale(1.2);
}

/* Animación de parpadeo (keyframes) */
@keyframes pulse-horizontal {
  0% {
    transform: translateX(0);
    opacity: 0.8;
  }

  50% {
    transform: translateX(2px);
    opacity: 1;
  }

  100% {
    transform: translateX(0);
    opacity: 0.8;
  }
}

.resizer:hover .resizer-grip .material-icons {
  animation: pulse-horizontal 1.2s infinite ease-in-out alternate;
}

/* Contenedor del panel inferior */
.bottom-panel-container {
  background-color: #2b2b2b;
  color: #f1f1f1;
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 200px;
  position: relative;
}

/* Nuevo elemento para el resizer horizontal */
.horizontal-resizer-handle {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 10px;
  cursor: ns-resize;
  border-top: 3px solid transparent;
  transition: border-top-color 0.4s ease-in-out, background-color 0.4s ease-in-out;
}

.horizontal-resizer-handle:hover {
  border-top-color: #666;
  background-color: #333;
}

/* Estilos para las flechas del slider horizontal */
.bottom-panel-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  color: #777;
  font-size: 1.2rem;
  transition: color 0.4s ease-in-out, transform 0.4s ease-in-out;
  pointer-events: none;
  z-index: 1;
}

.horizontal-resizer-handle:hover .bottom-panel-grip {
  color: #ccc;
  transform: translateX(-50%) translateY(-50%) scale(1.2);
}

@keyframes pulse-vertical {
  0% {
    transform: translateY(0);
    opacity: 0.8;
  }

  50% {
    transform: translateY(2px);
    opacity: 1;
  }

  100% {
    transform: translateY(0);
    opacity: 0.8;
  }
}

.horizontal-resizer-handle:hover .bottom-panel-grip .material-icons {
  animation: pulse-vertical 1.2s infinite ease-in-out alternate;
}

.output-console {
  flex-grow: 1;
  background-color: #2b2b2b;
  color: #00ff41;
  font-family: 'Courier New', Courier, monospace;
  padding: 10px;
  overflow-y: auto;
  border-radius: 4px;
}

.run-button-container {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.control-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.control-button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px;
  border-radius: 5px;
  border: none;
  background-color: #4CAF50;
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background-color 0.3s;
}

.control-button.stop {
  background-color: #f44336;
}

.control-button.stop:hover {
  background-color: #da190b;
}

.control-button.save {
  background-color: #2196F3;
}

.control-button.save:hover {
  background-color: #0b7dda;
}

.control-button.load {
  background-color: #ff9800;
}

.control-button.load:hover {
  background-color: #e68900;
}

.control-button:hover {
  background-color: #45a049;
}

.blocklyTreeRoot {
  padding: 10px;
  background-color: #212121;
  border-right: 1px solid #444;
}

.blocklyTreeRow {
  padding: 12px 10px;
  margin: 5px 0;
  border-radius: 8px;
  transition: background-color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.blocklyTreeRow:hover {
  background-color: #3e3e3e;
  box-shadow: 4px 0 8px rgba(0, 0, 0, 0.2);
}

.blocklyTreeSelected {
  background-color: #3e3e3e !important;
  box-shadow: 4px 0 8px rgba(0, 0, 0, 0.2);
  font-weight: bold;
}

.blocklyTreeLabel {
  font-size: 1rem;
  color: #000000;
}

.code-output h3 {
  text-align: right;
  margin-bottom: 0;
}

.code-output pre {
  overflow-x: hidden;
  font-size: 13px;
}

.blocklyToolboxDiv {
  width: 235px !important; /* Aumentado para dar espacio a nombres largos como Condicionales */
  background-color: #f8f9fa; 
  border-right: 1px solid #ddd;
}

.blocklyToolboxDiv .blocklyTreeRow {
  font-size: 14px !important; /* Usar px es más seguro en Blockly para evitar herencias raras */
  padding: 8px 12px !important; /* Más aire arriba y abajo */
  height: auto !important; /* Dejá que el contenido defina el alto, no lo forces a 24px */
  margin-bottom: 2px;
  display: flex;
  align-items: center;
}

/* Agregá esto para que los nombres largos no se corten mal */
.blocklyTreeLabel {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nuevos estilos para la salida del código */
.code-output .token.string {
  color: #ce9178;
}

.code-output .token.function {
  color: #dcdcaa;
}

.code-output .token.keyword {
  color: #569cd6;
}

.code-output .token.comment {
  color: #6a9955;
}

.code-output .token.number {
  color: #b5cea8;
}

.code-output pre code .token.variable {
  color: #9CDCFE !important;
}

/* Botones "Código / Salida" */
.tab-button-container {
  display: none;
  justify-content: center;
  padding: 0.5rem;
  background-color: #444;
}

.tab-button {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background-color: #555;
  color: white;
  border-radius: 4px;
  white-space: nowrap;
  margin: 0 5px;
}

.tab-button.active {
  background-color: #007bff;
}

.code-output h3 {
  margin-top: 0;
  margin-bottom: 0;
}

.code-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
}

/* Estilos del modal */
.modal {
  display: none;
  position: fixed;
  z-index: 100;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
  background-color: #2b2b2b;
  color: #f1f1f1;
  margin: 15% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.close-button {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close-button:hover,
.close-button:focus {
  color: #f1f1f1;
  text-decoration: none;
}

/* Botón de Ayuda destacado */
.help-button {
  background-color: #9200cc;
  /* azul vibrante */
  color: #fff;
  border: none;
  border-radius: 50px;
  /* forma de píldora */
  padding: 8px 20px;
  /* más ancho que los demás */
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  /* le da profundidad */
  transition: all 0.3s ease;
}

.help-button:hover {
  background-color: #005fa3;
  /* más oscuro al pasar el mouse */
  transform: scale(1.05);
  /* se agranda un poco */
}

/* Estado normal */
body {
  transition: opacity 0.4s ease;
  opacity: 1;
}

/* Estado cuando se limpia */
body.fade-out {
  opacity: 0;
}

#programOutputRight {
  background-color: #1e1e1e;
  /* fondo oscuro */
  border: 1px solid #333;
  /* borde sutil */
  border-radius: 6px;
  padding: 10px;
  font-family: Consolas, monospace;
  font-size: 14px;
  color: #00ff00;
  /* texto verde */
  white-space: pre-wrap;
  word-break: break-word;

  max-height: 280px;    /* Esto evita que la caja crezca para siempre */
  overflow-y: auto;
}

#output-title {
  position: fixed;         /* flota sobre todo el contenido */
  top: 60px;               
  right: 20px;             
  z-index: 1000;           

  /* 🎨 Estilo de la letra */
  font-family: "Fira Code", monospace; 
  font-size: 25px;          /* más grande para resaltar */
  font-weight: bold;
  color: #ffd43b;           /* amarillo Python */

  /* ✨ Efecto glow (resaltado con brillo) */
  text-shadow: 
    0 0 6px #af5d9d, 
    0 0 12px #306998, 
    0 0 18px #306998;
}


.output-title {
  font-family: "Fira Code", monospace;
  font-size: 25px;
  font-weight: bold;
  color: #ffd43b;
  text-shadow: 
    0 0 6px #af5d9d, 
    0 0 12px #306998, 
    0 0 18px #306998;
}


.btn-floating {
  position: fixed;
  right: 20px;
  z-index: 1000;

  min-width: 30px;
  height: 44px;
  padding: 2px 8px 0 8px;
  border: 2px solid #191a1b;
  border-radius: 8px;

  background: #c4bfbf;   /* 👈 fondo gris muy claro */
  color: #141414;        /* texto oscuro */
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;

  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

.btn-floating:hover {
  background: #e0e0e0;   /* 👈 un poco más oscuro al pasar */
  border-color: #4a90e2; /* resalta con azul */
  color: #4a90e2;
}

.program-output {
  max-height: 35em;   /* altura visible, aprox. 20 líneas */
  overflow-y: auto;   /* scroll vertical si se pasa */
}

/* Forzar que la vista de salida esté alineada con la de código */
#outputView {
  margin-top: -35px !important;
}

#programOutputRight {
  position: relative;
  top: -20px;  /* ajustá el número hasta que quede alineado */
}

/* Estado deshabilitado para TODOS los botones de control */
.control-button:disabled {
  background-color: #cccccc !important; /* Gris claro */
  color: #666666 !important;            /* Texto gris oscuro */
  cursor: not-allowed;                  /* Cursor de prohibido */
  opacity: 0.6;                         /* Un poco transparente */
  transform: none !important;           /* Por si tenés efectos de agrandar */
  box-shadow: none !important;          /* Sin sombras */
}

/* Evitar que el efecto hover funcione cuando está deshabilitado */
.control-button:disabled:hover {
  background-color: #cccccc !important;
}

.contenedor-escenarios-pedagogicos {
    position: fixed !important; /* El !important es para ganarle a cualquier otro estilo */
    bottom: 20px !important;
    left: 20px !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column;
    gap: 10px;
}

.contenedor-escenarios-pedagogicos .control-button {
    width: 170px !important;
    justify-content: flex-start !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.escenarios-footer {
    position: fixed !important; 
    bottom: 20px !important;    
    left: 5px !important;      /* Te sugiero 10px o 20px para que no toque el borde físico de la pantalla */
    z-index: 9999 !important;   
    
    display: flex !important;
    flex-direction: column; 
    /* ESTO ES LA CLAVE: Alinea los botones al inicio (izquierda) y no deja que se estiren */
    align-items: flex-start !important; 
    gap: 8px;
    
    background: transparent !important; 
    width: auto !important; 
    height: auto !important;
    padding: 0 !important;
    border: none !important;
}

/* Para que los botones se vean bien definidos */
.escenarios-footer .control-button {
    width: auto !important;      /* El ancho se adapta al contenido */
    min-width: 160px;            /* Pero como mínimo miden 160px para que sean parejos */
    max-width: fit-content;      /* No permite que crezcan más de lo necesario */
    justify-content: flex-start;
    box-shadow: 2px 4px 12px rgba(0,0,0,0.4); 
    margin: 0 !important;        /* Asegura que no haya márgenes raros */
}