/* ============================================================
 * header-v2.css – Header sticky mobile-first
 * Sobrescribe estilos legacy del header.
 * Incluir DESPUÉS de responsive.css
 * ============================================================ */

/* ── Eliminar franja negra legacy del body ── */
body {
    background-image: none !important;
}

:root {
    --brand-red: #E11112;
    --brand-red-dark: #C80E10;
    --brand-red-darker: #A90B0D;
    --brand-red-ring: rgba(225, 17, 18, 0.16);
}

/* ── CTA de registro en cabecera — solo en la landing de captación (que-es),
   oculto en móvil estrecho (la cabecera ya va muy justa de espacio ahí; el
   móvil tiene su propia barra fija de conversión, ver .qe-sticky-cta) ── */
.header-inner a.qe-header-cta {
    display: none !important;
}
@media screen and (min-width: 560px) {
    .header-inner a.qe-header-cta {
        display: inline-flex !important;
        align-items: center;
        height: 34px !important;
        padding: 0 16px !important;
        /* margin-left:auto empuja el botón junto al hamburguesa, lejos del
           logo (position:absolute + z-index:1002, centrado independiente
           del flujo flex) para que no se solapen visualmente */
        margin: 0 8px 0 auto !important;
        position: relative;
        z-index: 5;
        border-radius: 999px;
        background: var(--brand-red) !important;
        color: #fff !important;
        font-size: 12.5px !important;
        font-weight: 700 !important;
        text-decoration: none !important;
        white-space: nowrap;
        border: none !important;
        transition: background 0.18s ease, transform 0.18s ease;
    }
    .header-inner a.qe-header-cta:hover {
        background: var(--brand-red-dark) !important;
        color: #fff !important;
        transform: translateY(-1px);
    }
}
@media screen and (min-width: 981px) {
    .header-inner a.qe-header-cta {
        height: 38px !important;
        padding: 0 20px !important;
        font-size: 13px !important;
    }
}

/* ── Header bar fijo ── */
#header {
    display: block !important;
    float: none !important;
    clear: none !important;
    height: auto !important;
    padding: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: visible !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 3px 12px rgba(0,0,0,0.045);
    transition: box-shadow 0.3s ease;
}
#header::after { display: none !important; }

#header.scrolled {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 324px;
    margin: 0 auto;
    height: 44px;
    padding: 0 10px;
    position: relative;
}

/* ── Spacer para compensar el header fijo ── */
#header-spacer {
    height: 44px;
}

/* ============================================================
 * LANGUAGE SELECTOR (izquierda)
 * ============================================================ */
#langnav {
    float: none !important;
    display: block !important;
    position: relative;
    flex: 0 0 auto;
    width: auto !important;
    height: auto !important;
    text-align: left !important;
    padding: 0 !important;
    padding-left: 4px !important;
    margin-left: -4px !important;
    gap: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible !important;
    z-index: 4;
}

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 44px;
    height: 28px;
    padding: 0 8px;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    color: #666;
    font-size: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: visible;
}

.lang-toggle:hover {
    background: rgba(0,0,0,0.04);
}

.lang-toggle:active {
    background: rgba(0,0,0,0.06);
    transform: scale(0.97);
}

.lang-toggle:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

.lang-flag {
    display: block;
    width: 22px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    object-fit: cover;
    opacity: 1 !important;
    filter: saturate(1.08) contrast(1.05);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.lang-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.lang-toggle[aria-expanded="true"] .lang-chevron {
    transform: rotate(180deg);
}

/* Dropdown de idiomas */
.lang-dropdown {
    position: fixed;
    top: 48px;
    left: 10px;
    min-width: auto;
    max-width: 140px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(-4px);
    transform-origin: top left;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 999;
}

.lang-dropdown.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Items del dropdown (reset agresivo de estilos legacy) */
.lang-option {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 12px !important;
    text-decoration: none !important;
    color: #555 !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    transition: background 0.15s ease, color 0.15s ease !important;
    cursor: pointer;
    width: auto !important;
    height: auto !important;
    float: none !important;
    clear: none !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    position: static !important;
}

.lang-option:hover {
    background: #f7f5f0 !important;
    color: #1a1a1a !important;
    transform: none !important;
    border-color: transparent !important;
}

.lang-option:focus-visible {
    background: #f7f5f0 !important;
    color: #1a1a1a !important;
    outline: 2px solid var(--brand-red);
    outline-offset: -2px;
}

.lang-option-active {
    background: #f7f5f0 !important;
    color: #1a1a1a !important;
    font-weight: 600;
    cursor: default;
}

.lang-option-active::after {
    display: none !important;
}

.lang-flag-sm {
    display: block;
    width: 22px;
    height: 14px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.12);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    object-fit: cover;
    opacity: 1 !important;
    filter: saturate(1.08) contrast(1.05);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.lang-check {
    margin-left: auto;
    color: var(--brand-red);
    font-size: 13px;
    font-weight: 400;
}

/* ============================================================
 * LOGO (centrado)
 * ============================================================ */
a.toplogo {
    position: absolute !important;
    left: 50% !important;
    top: 2px !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: auto !important;
    float: none !important;
    padding: 0 !important;
    display: block !important;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 1002;
    transition: opacity 0.2s ease;
}}

a.toplogo:hover {
    opacity: 1;
    border: none !important;
}

a.toplogo:active {
    transform: translateX(-50%) scale(0.97) !important;
}

a.toplogo:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 4px;
    border-radius: 4px;
}

/* Logo imagen centrado - top alineado con bandera/hamburguesa, cuelga hacia abajo */
a.toplogo img {
    display: block !important;
    width: auto;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.18));
}

/* Ocultar textos span alternativos */
.logo-espana,
.logo-bares {
    display: none !important;
}

/* ============================================================
 * HAMBURGER (derecha)
 * ============================================================ */
.hamburger {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 32px;
    height: 32px;
    background: transparent !important;
    border: none !important;
    border-radius: 8px;
    cursor: pointer;
    padding: 0 !important;
    transition: background 0.2s ease, transform 0.1s ease;
    flex: 0 0 auto;
    position: static !important;
    right: auto !important;
    top: auto !important;
    z-index: auto !important;
    -webkit-tap-highlight-color: transparent;
}

.hamburger:hover {
    background: rgba(0,0,0,0.04) !important;
}

.hamburger:active {
    background: rgba(0,0,0,0.06) !important;
    transform: scale(0.95);
}

.hamburger:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: #333;
    border-radius: 1.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 2px 0;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* En móvil el dock inferior (Inicio/Buscador/Cuenta/Menú) ya cubre toda
   la navegación con su propio panel y su propio cierre; mostrar también
   el hamburger de cabecera duplicaba el menú y su icono de cierre (X). */
@media screen and (max-width: 980px) {
    .hamburger { display: none !important; }   /* movil-ok: la hamburguesa de la cabecera; en movil la barra de abajo ya lleva Menu con el mismo panel, y salian dos */
}

/* ============================================================
 * MENÚ PANEL (slide desde la derecha)
 * ============================================================ */
.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.menu-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

#topnav {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    left: auto !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #FEFDFB !important;
    z-index: 999 !important;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
    display: block !important;
    border-top: none !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

#topnav.open {
    transform: translateX(0) !important;
}

.topnav-close-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 56px;
    padding: 0 16px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #666;
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.menu-close:hover {
    background: rgba(0,0,0,0.04);
    color: #1a1a1a;
}

.menu-close:active {
    transform: scale(0.95);
}

.menu-close:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

#topnav a {
    display: flex !important;
    align-items: center;
    padding: 14px 24px !important;
    font-size: 15px !important;
    color: #555 !important;
    text-decoration: none !important;
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
    transition: all 0.2s ease !important;
    min-height: 48px;
    line-height: 1.4 !important;
    float: none !important;
    clear: none !important;
    width: auto !important;
    height: auto !important;
}

#topnav a:hover,
#topnav a:focus-visible {
    background: rgba(0,0,0,0.03) !important;
    color: var(--brand-red) !important;
    padding-left: 30px !important;
    border-bottom: 1px solid rgba(0,0,0,0.04) !important;
}

#topnav a.activo,
#topnav a.helvetica.activo {
    color: var(--brand-red) !important;
    font-weight: 600;
}

.topnav-footer-copy {
    padding: 16px 24px;
    border-top: 1px solid rgba(0,0,0,0.06);
    text-align: center;
    margin-top: 8px;
}

.topnav-footer-copy p {
    font-size: 12px;
    color: #999;
    margin: 0;
}

/* ── Login dentro del menú hamburguesa ── */
.topnav-login {
    padding: 16px 20px;
    margin: 12px 16px;
    background: #f8f8f8;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
}

.topnav-login h4 {
    font-size: 13px;
    font-weight: 700;
    color: #333;
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}

.topnav-login-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topnav-login-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

.topnav-login-input:focus {
    border-color: var(--brand-red);
    outline: none;
    box-shadow: 0 0 0 2px rgba(225,17,18,0.1);
}

.topnav-login-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 4px;
    background: var(--brand-red);
    color: #fff !important;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none !important;
    transition: background 0.2s ease;
    box-sizing: border-box;
}

.topnav-login-btn:hover {
    background: var(--brand-red-dark);
    padding-left: 10px !important;
}

.topnav-login-links {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.topnav-login-links a {
    font-size: 12px !important;
    color: var(--brand-red) !important;
    text-decoration: none !important;
    padding: 4px 0 !important;
    min-height: auto !important;
    border-bottom: none !important;
}

.topnav-login-links a:hover {
    text-decoration: underline !important;
    background: transparent !important;
    padding-left: 0 !important;
}

.topnav-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.topnav-user-info svg {
    flex-shrink: 0;
    color: var(--brand-red);
}

.topnav-logout-link {
    display: block;
    text-align: center;
    margin-top: 8px;
    font-size: 12px !important;
    color: #999 !important;
    text-decoration: none !important;
    padding: 6px 0 !important;
    min-height: auto !important;
    border-bottom: none !important;
}

.topnav-logout-link:hover {
    color: var(--brand-red) !important;
    background: transparent !important;
    padding-left: 0 !important;
}

/* ── Body scroll lock cuando menú abierto ── */
body.menu-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
}

/* ============================================================
 * RESPONSIVE
 * ============================================================ */

/* Tablet+ */
@media screen and (min-width: 641px) {
    .lang-toggle {
        min-width: 44px;
        height: 28px;
        padding: 0 8px;
    }

    .lang-flag {
        width: 22px;
        height: 14px;
    }

    .header-inner {
        height: 46px;
        padding: 0 14px;
        max-width: 344px;
    }
    #header-spacer {
        height: 46px;
    }
    a.toplogo {
        top: 4px !important;
    }
    a.toplogo img {
        height: 61px;
    }
    .topnav-close-bar {
        height: 56px;
    }
    .lang-dropdown {
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        z-index: 1001;
    }
}

/* Desktop */
@media screen and (min-width: 981px) {
    .lang-toggle {
        min-width: 48px;
        height: 30px;
        padding: 0 10px;
    }

    .lang-flag {
        width: 24px;
        height: 16px;
    }

    .header-inner {
        padding: 0 20px;
        height: 60px;
        max-width: 1200px;
    }
    #header-spacer {
        height: 60px;
    }

    /* Logo centrado, más grande en desktop */
    a.toplogo {
        top: 5px !important;
    }
    a.toplogo img {
        height: 100px;
        transform: scaleX(1.25);
    }
}

/* ── Clearance del logo: el pico del badge cuelga bajo la barra fija y
   pisaba los primeros textos de la página (breadcrumbs, títulos h1) en
   TODOS los anchos de pantalla. Se aplica al contenedor de columnas para
   que contenido y sidebar bajen alineados. La home queda fuera: su hero
   full-width ya absorbe el logo. ── */
@media screen and (max-width: 640px) {
    body:not(.page-index) .columns-wrap { padding-top: 58px; }
}
@media screen and (min-width: 641px) and (max-width: 980px) {
    body:not(.page-index) .columns-wrap { padding-top: 30px; }
}
@media screen and (min-width: 981px) {
    /* logo bottom ≈ 105px, spacer 60px → cuelga ~45px + sombra */
    body:not(.page-index) .columns-wrap { padding-top: 52px; }
}

/* ── Una sola aspa de cerrar a la vez ──────────────────────────────────────
   Hay DOS cajones de menú: #topnav (lo abre la hamburguesa) y #mobile-menu (lo
   abre el acceso rápido de abajo). Cada uno lleva su propia aspa, y las dos
   están siempre en el DOM en la misma posición, así que según el ancho la del
   cajón cerrado asomaba en la cabecera y se veían dos aspas.

   Va aquí y no en style.css porque esta hoja se carga después: allí la regla
   perdía el empate de especificidad contra `.topnav-close-bar{display:flex}`
   de más abajo en este mismo archivo. */
.topnav-close-bar{ display: none !important; }
#topnav.open .topnav-close-bar{ display: flex !important; }
.mobile-menu-close-bar{ display: none !important; }
.mobile-menu.open .mobile-menu-close-bar{ display: flex !important; }

/* ── Los idiomas del desplegable, a 44px en el móvil ───────────────────────
   Hallazgo H-04 de la auditoría, aprobado por él el 2026-09-03. Medido: 42px
   en escritorio y 36 en el teléfono. Aquí importa más que en la caja de
   búsqueda: son tres opciones pegadas una encima de otra, así que fallar el
   dedo no es no acertar — es cambiar de idioma sin querer.

   ⚠ Va con `!important` porque la regla base también lo lleva (es el «reset
   agresivo de estilos legacy» de arriba) y con la misma especificidad el
   empate lo decidiría el orden, no la intención.

   En escritorio no cambia nada: la media es solo de 640 para abajo. */
@media screen and (max-width: 640px) {
    .lang-option {
        min-height: 44px !important;
    }
}
