/* =============================================
   RESETEO Y CONFIGURACIÓN BASE
============================================= */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

#main-content {
  min-height: 100%;
  position: relative;
  padding-bottom: 100px;
  box-sizing: border-box;
  overflow: hidden;
}


/* =============================================
   LISTAS Y ENLACES DE ÍCONOS GENERALES
============================================= */
.icon {
  text-decoration: none;
  position: relative;
}

ul.icons {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 7px;
}

ul.icons li {
  display: inline-block;
  margin: 0 10px;
}


/* =============================================
   TOOLTIP: REDES SOCIALES (estilo oscuro)
============================================= */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: var(--tooltip-text);
  white-space: pre-line;
  position: absolute;
  bottom: 145%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 5px;
  white-space: pre-line;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}


/* =============================================
   TOOLTIP: ÍCONOS DEL SIDEBAR
============================================= */
.nav-link[data-tooltip] {
  position: relative;
  cursor: pointer;
}

.nav-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  background: gold;
  color: black;
  padding: 12px 18px;
  font-size: 14px;
  border-radius: 6px;
  white-space: normal;           /* ✅ Permite varias líneas */
  text-align: left;
  line-height: 1.4;
  max-width: 340px !important;              /* ✅ Más largo, pero controlado */
  min-width: 200px;
  width: max-content;            /* ✅ Adapta sin cortar */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  pointer-events: none;
  margin-left: 12px;
  display: flex;
  align-items: center;
}

.nav-link[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}


/* =============================================
   ESTILOS BASE COMPARTIDOS PARA TOOLTIPS
============================================= */
[data-tooltip] {
  position: relative;
  cursor: pointer;
  display: inline-block;
}

[data-tooltip]::after {
  /* Reset y estilos base compartidos */
  all: initial;
  display: block !important;
  position: absolute !important;
  background: gold !important;
  border-radius: 4px !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
  color: black !important;
  content: attr(data-tooltip) !important;
  font: 13px/1.4 Arial, sans-serif !important;
  white-space: normal !important;
  word-break: normal !important;
  hyphens: auto !important;
  max-width: 250px !important;
  min-width: 150px !important;
  width: max-content !important;
  padding: 12px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease !important;
  z-index: 1000 !important;
}

[data-tooltip]:hover::after {
  opacity: 1 !important;
  visibility: visible !important;
}

/* =============================================
   POSICIONAMIENTOS ESPECÍFICOS DE TOOLTIPS
============================================= */

/* Tooltip derecho (para float-left) */
.float-image-left[data-tooltip]::after,
.tooltip-multiline.float-image-left[data-tooltip]::after {
  left: 100% !important;
  top: 50% !important;
  transform: translate(15px, -50%) !important;
  text-align: left !important;
}

/* Tooltip izquierdo (para float-right) */
.float-image-right[data-tooltip]::after,
.tooltip-multiline.float-image-right[data-tooltip]::after {
  left: auto !important;
  right: 100% !important;
  top: 50% !important;
  transform: translate(-15px, -50%) !important;
  text-align: left !important;
}

/* Tooltip centrado debajo (para float-image-center) */
.float-image-center[data-tooltip]::after,
.div-with-tooltip.float-image-center[data-tooltip]::after {
  left: 50% !important;
  top: 100% !important;
  transform: translateX(-50%) !important;
  text-align: center !important;
  margin-top: 15px !important;
}

/* =============================================
   ESTILOS DE FLOTACIÓN
============================================= */
.float-image-left,
.float-image-right {
  clear: both;
  margin-bottom: 15px;
}

.float-image-left {
  float: left;
  margin-right: 30px;
}

.float-image-right {
  float: right;
  margin-left: 30px;
}

.float-image-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  float: none !important;
}

/* =============================================
   ESTILOS ESPECÍFICOS PARA TV
============================================= */
.tv-screen {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: 56.25%; /* Relación 16:9 */
  height: 0;
  overflow: hidden;
}

.tv-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.tv-frame {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}



/* =============================================
   TOOLTIP FOOTER - OPEN SANS 300 (RESPONSIVO)
   Fondo gold, texto negro, flecha limpia
============================================= */

[data-footer-tooltip] {
  position: relative;
  cursor: pointer; /* Feedback visual */
}

[data-footer-tooltip]::after {
  /* Texto y tipografía */
  content: attr(data-footer-tooltip);
  font-family: 'Open Sans', sans-serif;
  font-weight: 300;
  font-size: 13px;
  letter-spacing: 0.3px;

  /* Caja y posición */
  position: absolute;
  bottom: 145%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 200px;

  /* Estilo visual */
  background: gold;
  color: black;
  padding: 12px 15px;
  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);

  /* Transición y ocultamiento inicial */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 1000;

  /* Compatibilidad móvil */
  white-space: normal;
  text-align: center;
}

/* Flecha inferior (desktop) */
[data-footer-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 8px;
  border-style: solid;
  border-color: transparent transparent gold transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1001;
}

/* Mostrar tooltip al pasar el mouse */
[data-footer-tooltip]:hover::after,
[data-footer-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* -------------------------------
   RESPONSIVO: Pantallas pequeñas
------------------------------- */
@media (max-width: 768px) {
  [data-footer-tooltip]::after {
    position: fixed;
    bottom: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vw;
    max-width: none;
    white-space: normal;
    font-size: 14px;
    padding: 15px;
  }

  [data-footer-tooltip]::before {
    bottom: auto;
    top: 100%;
    border-color: gold transparent transparent transparent;
  }

  /* Activación alternativa en móviles */
  [data-footer-tooltip].active::after,
  [data-footer-tooltip].active::before {
    opacity: 1;
    visibility: visible;
  }
}



/* =============================================
   TOOLTIP FORMULARIO de CONTACTO - OPEN SANS 300 (RESPONSIVO)
============================================= */

    :root {
        --primary-bg: #5050a2;
        --gradient-start: #5050a2;
        --gradient-intermediate: #6464cb;
        --gradient-end: #8383d5;
        --radius-lg: 16px;
        --radius-sm: 10px;
        --shadow-light: 0 12px 30px rgba(0, 0, 0, 0.08);
        --shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.15);
        --primary-text: #2a2a6b;
        --secondary-text: #555;
        --accent-color: #6b6eca;
        --tooltip-bg: linear-gradient(to right, #ffd700, #f9e076);
        --note-title-color: #44459c;
    }

    .form-container {
        max-width: 850px;
        width: 100%;
        margin: 2rem auto;
        padding: 25px 25px;
        background: linear-gradient(135deg, #f9f9ff 0%, #f0f2ff 100%);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-light);
        border: 1px solid rgba(0, 0, 0, 0.08);
    }

    .form-container h2 {
        font-size: 1.8rem;
        color: var(--primary-text);
        margin: 0.5rem 0;
        text-align: center;
        font-weight: 600;
    }

    .subheading {
        color: var(--secondary-text);
        font-size: 1rem;
        text-align: center;
        margin-bottom: 1.5rem;
        line-height: 1.5;
        font-weight: 400;
    }

    .form-group {
        padding: 5px;
        margin-bottom: 5px;
        position: relative;
    }

    .form-control {
        width: 100%;
        background: rgba(248, 249, 255, 0.7);
        border: 2px solid #e0e2ff;
        border-radius: var(--radius-sm);
        padding: 12px 15px;
        font-size: 0.95rem;
        font-weight: 400;
        color: var(--primary-text);
        box-shadow: 0 2px 8px rgba(107, 110, 202, 0.1);
        transition: all 0.3s ease;
        font-family: inherit;
    }

    .form-control:hover {
        border-color: #a5a8e4;
        background: rgba(240, 243, 255, 0.9);
    }

    .form-control:focus {
        border-color: var(--accent-color);
        background: #ffffff;
        outline: none;
        box-shadow: 0 0 0 3px rgba(107, 110, 202, 0.2);
    }

    textarea.form-control {
        min-height: 160px;
        resize: vertical;
    }

    .btn-primary {
        background: linear-gradient(135deg, #c5c7ee 0%, #a7aad8 100%);
        border: 2px solid #a7aad8;
        border-radius: 50px;
        box-shadow: 0 4px 8px rgba(58, 62, 158, 0.2);
        color: #3a3e9e;
        cursor: pointer;
        display: block;
        font-size: 1.1rem;
        font-weight: 600;
        margin: 20px auto 10px;
        padding: 12px 30px;
        transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .btn-primary:hover {
        background: linear-gradient(135deg, #5a5cb8 0%, #3a3e9e 100%);
        border-color: #8b8ecf;
        box-shadow: 0 12px 24px rgba(107, 110, 202, 0.4);
        color: white;
        transform: translateY(-3px);
    }

    .btn-primary:active {
        transform: translateY(1px);
        box-shadow: 0 6px 12px rgba(107, 110, 202, 0.3);
    }

    .form-tooltip {
        position: absolute;
        bottom: 100%;
        left: 0;
        background: var(--tooltip-bg);
        color: #333;
        font-weight: 100;
        font-size: 14px;
        padding: 12px 16px;
        border-radius: 8px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        width: 100%;
        max-width: 300px;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 1000;
        box-shadow: var(--shadow-medium);
        margin-bottom: 10px;
        letter-spacing: 0.3px;
    }

    .form-group:hover .form-tooltip,
    .form-group:focus-within .form-tooltip {
        opacity: 1;
        visibility: visible;
    }

    .form-tooltip::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 20px;
        border-width: 8px;
        border-style: solid;
        border-color: #ffd700 transparent transparent transparent;
    }

    .contact-note-title {
        font-weight: 600;
        color: var(--note-title-color);
        margin: 2rem 0 1rem;
        font-size: 1.3rem;
        display: flex;
        align-items: center;
    }

    .contact-note-title i {
        color: inherit;
        margin-right: 0.5rem;
    }

    .contact-note-paragraph {
        color: #666;
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
        text-align: justify;
        text-justify: inter-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }

    @supports (-moz-appearance:none) {
        .contact-note-paragraph {
            -moz-hyphens: auto;
        }
    }

@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
    }

    .form-tooltip {
        bottom: auto;
        top: 100%;
        margin-top: 10px;
        max-width: 100%;
    }

    .form-tooltip::after {
        top: auto;
        bottom: 100%;
        border-color: transparent transparent #ffd700 transparent;
    }

    .contact-note-title {
        font-size: 1rem !important;
        justify-content: center;
    }

    .contact-note-paragraph {
        /* Justificado + separación automática de palabras */
        text-align: justify;
        hyphens: auto;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;

        /* Conserva el padding móvil */
        padding: 0 0.5rem;
        overflow-wrap: break-word;
    }
}


    .visually-hidden {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

/* Estilos para el contador de caracteres */
.char-counter {
    position: absolute;
    right: 15px;
    bottom: 15px;
    font-size: 0.8rem;
    color: #888;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 2px 6px;
    border-radius: 10px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.char-counter.chars-alert {
    color: #d4a017;
    background-color: rgba(255, 240, 200, 0.8);
}

.char-counter.chars-warning {
    color: #c0392b;
    background-color: rgba(255, 220, 220, 0.8);
    font-weight: 600;
}

/* Añadir posición relativa al grupo del textarea */
.textarea-group {
    position: relative;
    margin-bottom: 1.5rem;
}

/* =============================================
   RESPONSIVIDAD OPTIMIZADA (768px y menos)
============================================= */
@media (max-width: 768px) {
  /* --------- Tooltips del Footer --------- */
  [data-footer-tooltip] {
    position: relative; /* Necesario para el contenedor */
  }
 
}

/* =============================================
   AJUSTES PARA PANTALLAS MUY PEQUEÑAS (576px y menos)
============================================= */
@media (max-width: 576px) {
  /* --------- Formulario --------- */
  .form-control {
    padding: 10px;
    font-size: 14px;
  }
  
  .data-form-tooltip {
    font-size: 12px;
    padding: 8px 10px;
  }
  
  /* --------- Footer --------- */
  [data-footer-tooltip]::after {
    font-size: 12px; /* Texto más pequeño en móviles */
    padding: 10px 12px;
  }
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 768px) {
  [data-tooltip]::after {
    display: none !important;
  }
  
  .float-image-left,
  .float-image-right {
    float: none;
    margin: 0 auto 20px;
    display: block;
  }
}



@media screen and (max-width: 768px) {
  #footer {
    width: 100%;
    margin-left: 0;
  }

  ul.icons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
  }

  ul.icons li {
    padding: 0;
  }

  ul.icons li a {
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}


/* =========================
   TOOLTIPS PARA PUZZLES 
========================= */
[data-puzzle-tooltip] {
  position: relative;
  cursor: help;
  display: inline-block;
}

[data-puzzle-tooltip]::after {
  content: attr(data-puzzle-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Roboto', sans-serif;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

[data-puzzle-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Posiciones alternativas */
[data-puzzle-tooltip-position="right"]::after {
  left: 115%;
  bottom: 50%;
  transform: translateY(50%);
}

[data-puzzle-tooltip-position="left"]::after {
  right: 115%;
  bottom: 50%;
  left: auto;
  transform: translateY(50%);
}

[data-puzzle-tooltip-position="bottom"]::after {
  top: 115%;
  bottom: auto;
}

/* Versión para móviles */
@media (max-width: 768px) {
  [data-puzzle-tooltip]::after {
    font-size: 13px;
    white-space: normal;
    max-width: 200px;
  }
}


@media (max-width: 768px) {
  /* Elimina cualquier tooltip existente */
  [data-form-tooltip]::after, 
  .data-form-tooltip {
    display: none !important;
  }
  
  /* Nuevo tooltip móvil FULLSCREEN */
  .mobile-tooltip-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  
  .mobile-tooltip-content {
    background: gold;
    color: black;
    padding: 20px;
    border-radius: 10px;
    max-width: 100%;
    width: 100%;
    animation: fadeIn 0.3s;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
  }
}


/* =====================================================
   DISPARADORES: Posición y cursor sin contaminar estilo
===================================================== */
[data-escaque-tooltip],
[data-top-tooltip-left],
[data-top-tooltip-right] {
  position: relative;
  cursor: help;
}

/* =====================================================
   CUERPO DE LOS TOOLTIP (ESCAQUE Y TOP-BAR)
===================================================== */

/* Estilos comunes a todos los tooltips (solo el contenido) */
[data-escaque-tooltip]::after,
[data-top-tooltip-left]::after,
[data-top-tooltip-right]::after {
  font-family: 'Open Sans', sans-serif !important;
  font-weight: 300 !important;
  font-size: 13px !important;
  letter-spacing: 0.3px !important;
  font-variant: normal !important;
  text-transform: none !important;
  color: black;

  border-radius: 6px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* === Tooltip vertical superior (escaque clásico) === */
[data-escaque-tooltip]::after {
  content: attr(data-escaque-tooltip);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #bbb;
  z-index: 1001;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* === Flechita ascendente para escaque === */
[data-escaque-tooltip]::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  border: 6px solid transparent;
  border-bottom-color: #bbb;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 1000;
}

/* === Tooltip lateral izquierdo (ES / EN) === */
[data-top-tooltip-left]::after {
  content: attr(data-top-tooltip-left);
  position: absolute;
  top: 50%;
  right: 105%;
  transform: translateY(-50%);
  padding: 10px 12px;
  background: gold;
}

/* === Tooltip lateral derecho (Contacto) === */
[data-top-tooltip-right]::after {
  content: attr(data-top-tooltip-right);
  position: absolute;
  top: 50%;
  left: 105%;
  transform: translateY(-50%);
  padding: 10px 12px;
  background: gold;
}

/* =====================================================
   ACTIVACIÓN: Hover y focus
===================================================== */
[data-escaque-tooltip]:hover::after,
[data-escaque-tooltip]:hover::before,
[data-escaque-tooltip]:focus::after,
[data-escaque-tooltip]:focus::before,
[data-top-tooltip-left]:hover::after,
[data-top-tooltip-right]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* =====================================================
   CONTEXTO VISUAL POR SUBDOMINIO
===================================================== */

/* CHESS: azul pastel */
.chess [data-escaque-tooltip]::after {
  background: linear-gradient(to right, #d4e4f4, #c9d8ec);
}
.chess [data-escaque-tooltip]::before {
  border-bottom-color: #a5bddc;
}

/* MATH: anaranjado suave */
.math [data-escaque-tooltip]::after {
  background: linear-gradient(to right, #ffe5cc, #ffefdb);
}
.math [data-escaque-tooltip]::before {
  border-bottom-color: #f2b277;
}

/* INSIGHT: verde suave */
.insight [data-escaque-tooltip]::after {
  background: linear-gradient(to right, #d5f5e3, #c7f0d8);
}
.insight [data-escaque-tooltip]::before {
  border-bottom-color: #9ed8bb;
}

/* Tooltip fijo (estilo alternativo opcional) */
a.tooltip-fijo[data-escaque-tooltip]::after {
  background: gold !important;
  border: 1px solid #bbb !important;
  color: black !important;
}

/* =====================================================
   RESPONSIVE: Desactiva tooltip vertical en móvil
===================================================== */
@media screen and (max-width: 600px) and (orientation: portrait) {
  [data-escaque-tooltip]::after,
  [data-escaque-tooltip]::before {
    display: none !important;
  }
}
