/**
 * Cabecera del sitio (welow_header).
 *
 * Breakpoints:
 *   Desktop:  > 980px  → 3 zonas: logo + menú + CTAs
 *   Móvil:    ≤ 980px  → logo + hamburger → overlay
 *
 * @since 2.6.0
 */

/* ==========================================================================
   VARIABLES (overridables vía inline style en .welow-header)
   ========================================================================== */
.welow-header {
    --welow-h-bg: #ffffff;
    --welow-h-color: #1f2937;
    --welow-h-btn-bg: #2563eb;
    --welow-h-btn-color: #ffffff;
    --welow-h-btn-bg-hover: #1d4ed8;
    --welow-h-border: #e2e8f0;
    --welow-h-logo-h: 50px;
    --welow-h-padding-y: 12px;
    --welow-h-gap: 24px;

    /* v2.7.0 — Variables tipográficas */
    --welow-h-font: inherit;
    --welow-h-fw-menu: 600;
    --welow-h-fw-boton: 700;
    --welow-h-fs-menu: 14px;
    --welow-h-fs-boton: 14px;
    --welow-h-fs-tel: 14px;
    --welow-h-tt-menu: none;
    --welow-h-ls-menu: normal;

    background: var(--welow-h-bg);
    color: var(--welow-h-color);
    border-bottom: 1px solid var(--welow-h-border);
    font-family: var(--welow-h-font);
    width: 100%;
    box-sizing: border-box;
    z-index: 100;
}
/* v2.20.0 — Backdrop blur opcional cuando el header es translúcido.
   v2.76.2 — Solo si está configurado: cualquier backdrop-filter (aunque sea
   blur(0)) convierte la cabecera en el marco de los elementos "fixed" y el
   menú móvil quedaba encerrado en la franja del header, debajo de la portada. */
.welow-header--blur {
    backdrop-filter: blur(var(--welow-h-blur, 0));
    -webkit-backdrop-filter: blur(var(--welow-h-blur, 0));
}
/* Con el menú móvil abierto, nada en la cabecera puede encerrarlo */
body.welow-header-open .welow-header {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    transform: none !important;
    z-index: 99998 !important;
}
body.welow-header-open .welow-header:not(.welow-header--sticky) { position: relative; }

/* v2.7.1 — Truco "fullwidth breakout": cuando el header NO es sticky/fixed,
   hace que rompa cualquier contenedor padre (módulo Divi, fila, sección)
   y ocupe el 100% del viewport. Cuando ES sticky/fixed, ya cubre el
   viewport por su cuenta. */
.welow-header:not(.welow-header--sticky) {
    position: relative;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    max-width: none !important;
}

/* Neutralizar paddings del módulo Divi que contiene el shortcode.
   El JS añade la clase .welow-header-parent al padre directo del header. */
.welow-header-parent,
.welow-header-parent > .et_pb_text_inner,
.welow-header-parent > .et_pb_code_inner {
    padding: 0 !important;
    margin: 0 !important;
}

/* Si la sección/fila Divi también lo envuelve, neutralizar */
.welow-header-section-parent {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.welow-header-row-parent {
    padding: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
}

.welow-header *,
.welow-header *::before,
.welow-header *::after { box-sizing: border-box; }

/* v2.6.2 — Sticky cambiado de position: sticky a position: fixed.
   sticky falla con frecuencia en Divi porque algunas secciones tienen
   overflow o transform que rompen el contexto. fixed es robusto.
   El JS añade un spacer dinámico justo después del header para que
   el contenido siguiente no quede oculto debajo. */
/* v2.7.2 — z-index muy alto para superponerse a sliders de Divi y otros
   elementos con z-index propio. El overlay móvil va aún más alto (999999). */
.welow-header--sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99998;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    isolation: isolate;
}

/* Compatibilidad con admin bar de WP */
body.admin-bar .welow-header--sticky { top: 32px; }
@media (max-width: 782px) {
    body.admin-bar .welow-header--sticky { top: 46px; }
}

/* Spacer que reserva el hueco del header fixed (lo crea/dimensiona el JS) */
.welow-header-spacer {
    display: block;
    width: 100%;
    flex-shrink: 0;
}

.welow-header__inner {
    display: flex;
    align-items: center;
    gap: var(--welow-h-gap);
    padding: var(--welow-h-padding-y) 0;        /* v2.6.1 — sin padding lateral por defecto */
    margin: 0 auto;
    width: 100%;
}
/* v2.6.1 — Si max-width está limitado, mantener algo de padding para que no toque
   el borde en pantallas exactas al breakpoint. Si es 100%, queda pegado. */
@media (min-width: 1281px) {
    .welow-header__inner { padding-left: 16px; padding-right: 16px; }
}

/* ==========================================================================
   LOGO
   ========================================================================== */
/* v2.9.0 — Wrap del logo (puede contener logo concesionario + logo marca) */
.welow-header__logo-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.welow-header__logo {
    flex-shrink: 0;
}
.welow-header__logo a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}
.welow-header__logo-img {
    display: block;
    width: auto;
    max-height: var(--welow-h-logo-h);
    height: auto;
}
.welow-header__logo-img--movil { display: none; }

/* v2.9.0 — Separador vertical entre logos */
.welow-header__logo-separador {
    display: block;
    width: 1px;
    height: calc(var(--welow-h-logo-h) * 0.7);
    background: currentColor;
    opacity: 0.2;
    flex-shrink: 0;
}

/* v2.9.0 — Logo de la marca actual al lado */
.welow-header__logo-marca {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.welow-header__logo-marca a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.15s;
}
.welow-header__logo-marca a:hover { opacity: 0.7; }
.welow-header__logo-marca-img {
    display: block;
    width: auto;
    max-height: var(--welow-h-logo-marca-h, var(--welow-h-logo-h));
    height: auto;
}

/* En móvil: reducir gap y altura del logo de marca para que quepa */
@media (max-width: 600px) {
    .welow-header__logo-wrap { gap: 10px; }
    .welow-header__logo-marca-img {
        max-height: calc(var(--welow-h-logo-marca-h, var(--welow-h-logo-h)) * 0.75);
    }
    .welow-header__logo-separador {
        height: calc(var(--welow-h-logo-h) * 0.55);
    }
}
.welow-header__logo-texto {
    font-size: 18px;
    font-weight: 800;
    color: var(--welow-h-color);
    letter-spacing: -0.3px;
}

/* ==========================================================================
   MENÚ DESKTOP
   ========================================================================== */
.welow-header__menu--desktop {
    flex: 1;
    display: flex;
    justify-content: center;
}
/* v2.6.1 — list-style none reforzado para sobrescribir cualquier reset del tema */
/* v2.21.0 — Separación entre items configurable */
.welow-header { --welow-h-menu-gap: 4px; }

.welow-header ul.welow-header__menu-list,
.welow-header__menu-list {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--welow-h-menu-gap, 4px);
    flex-wrap: wrap;
    align-items: center;
}
.welow-header__menu-list li,
.welow-header ul.welow-header__menu-list > li {
    position: relative;
    list-style: none !important;
    list-style-type: none !important;
}
.welow-header__menu-list li::before,
.welow-header__menu-list li::marker {
    display: none !important;
    content: none !important;
}
.welow-header__menu-list a {
    display: block;
    padding: 8px 12px;   /* v2.71.2 — algo más compacto (cabe en portátil) */
    color: var(--welow-h-color);
    text-decoration: none;
    font-family: var(--welow-h-font);
    font-size: var(--welow-h-fs-menu);
    font-weight: var(--welow-h-fw-menu);
    text-transform: var(--welow-h-tt-menu);
    letter-spacing: var(--welow-h-ls-menu);
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}
/* v2.21.0 — Estilos de hover seleccionables vía clase del header */

/* fondo (default): pill azul claro */
.welow-header--hover-fondo .welow-header__menu-list a:hover,
.welow-header--hover-fondo .welow-header__menu-list .current-menu-item > a,
.welow-header--hover-fondo .welow-header__menu-list .current-menu-parent > a,
.welow-header--hover-fondo .welow-header__menu-list .current-menu-ancestor > a {
    background: rgba(37, 99, 235, 0.08);
    color: var(--welow-h-btn-bg);
}

/* color: solo cambia el color del texto */
.welow-header--hover-color .welow-header__menu-list a:hover,
.welow-header--hover-color .welow-header__menu-list .current-menu-item > a,
.welow-header--hover-color .welow-header__menu-list .current-menu-parent > a,
.welow-header--hover-color .welow-header__menu-list .current-menu-ancestor > a {
    color: var(--welow-h-btn-bg);
    background: transparent;
}

/* underline: subrayado estático bajo el ítem activo / en hover */
.welow-header--hover-underline .welow-header__menu-list > li > a {
    position: relative;
    background: transparent;
    border-radius: 0;
}
.welow-header--hover-underline .welow-header__menu-list > li > a::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--welow-btn-bg, var(--welow-h-btn-bg));   /* v2.71.2 — color principal */
    opacity: 0;
    transition: opacity 0.15s;
}
.welow-header--hover-underline .welow-header__menu-list > li > a:hover,
.welow-header--hover-underline .welow-header__menu-list .current-menu-item > a,
.welow-header--hover-underline .welow-header__menu-list .current-menu-parent > a,
.welow-header--hover-underline .welow-header__menu-list .current-menu-ancestor > a {
    color: var(--welow-h-color);   /* v2.71.2 — solo la raya marca la página actual */
    background: transparent;
}
.welow-header--hover-underline .welow-header__menu-list > li > a:hover::after,
.welow-header--hover-underline .welow-header__menu-list .current-menu-item > a::after,
.welow-header--hover-underline .welow-header__menu-list .current-menu-parent > a::after,
.welow-header--hover-underline .welow-header__menu-list .current-menu-ancestor > a::after {
    opacity: 1;
}

/* subrayado-animado: la barra crece desde el centro al hover (estilo Divi) */
.welow-header--hover-subrayado-animado .welow-header__menu-list > li > a {
    position: relative;
    background: transparent;
    border-radius: 0;
}
.welow-header--hover-subrayado-animado .welow-header__menu-list > li > a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 0;
    height: 2px;
    background: var(--welow-h-btn-bg);
    transform: translateX(-50%);
    transition: width 0.22s ease;
}
.welow-header--hover-subrayado-animado .welow-header__menu-list > li > a:hover,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-item > a,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-parent > a,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-ancestor > a {
    color: var(--welow-h-btn-bg);
    background: transparent;
}
.welow-header--hover-subrayado-animado .welow-header__menu-list > li > a:hover::after,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-item > a::after,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-parent > a::after,
.welow-header--hover-subrayado-animado .welow-header__menu-list .current-menu-ancestor > a::after {
    width: calc(100% - 24px);
}

/* Submenú dropdown */
.welow-header__menu-list .sub-menu {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0;
    padding: 6px 0;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--welow-h-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    z-index: 110;
}
.welow-header__menu-list .sub-menu li {
    list-style: none !important;
    list-style-type: none !important;
}
.welow-header__menu-list .sub-menu li::before,
.welow-header__menu-list .sub-menu li::marker {
    display: none !important;
    content: none !important;
}
.welow-header__menu-list li:hover > .sub-menu,
.welow-header__menu-list li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.welow-header__menu-list .sub-menu a {
    padding: 8px 16px;
    border-radius: 0;
    font-weight: 500;
}
.welow-header__menu-list .sub-menu a:hover { background: #f1f5f9; }

/* ==========================================================================
   CTAs (teléfono + botones)
   ========================================================================== */
.welow-header__ctas {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.welow-header__telefono {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--welow-h-color);
    text-decoration: none;
    font-family: var(--welow-h-font);
    font-weight: 700;
    font-size: var(--welow-h-fs-tel);
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.15s;
}
.welow-header__telefono:hover { background: rgba(0,0,0,0.04); }
.welow-header__telefono svg { color: var(--welow-h-btn-bg); }

.welow-header__boton {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-family: var(--welow-h-font);
    font-weight: var(--welow-h-fw-boton);
    font-size: var(--welow-h-fs-boton);
    line-height: 1.2;
    transition: all 0.2s;
    white-space: nowrap;
}
.welow-header__boton--primario {
    background: var(--welow-h-btn-bg);
    color: var(--welow-h-btn-color);
}
.welow-header__boton--primario:hover {
    /* v2.76.8 — Sin el azul por defecto: el color al pasar el ratón lo marcan los estilos generales */
    background: var(--welow-h-btn-bg);
    color: var(--welow-h-btn-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.welow-header__boton--secundario {
    background: transparent;
    color: var(--welow-h-btn-bg);
    border: 1.5px solid var(--welow-h-btn-bg);
}
.welow-header__boton--secundario:hover {
    background: var(--welow-h-btn-bg);
    color: var(--welow-h-btn-color);
}
.welow-header__boton--full {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 18px;
}

/* ==========================================================================
   HAMBURGER (móvil)
   ========================================================================== */
.welow-header__hamburger {
    display: none;
    background: transparent;
    border: none;
    width: 40px;
    height: 40px;
    padding: 0;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
}
.welow-header__hamburger span {
    display: block;
    position: absolute;
    height: 2.5px;
    width: 22px;
    background: var(--welow-h-color);
    border-radius: 2px;
    left: 9px;
    transition: all 0.25s ease;
}
.welow-header__hamburger span:nth-child(1) { top: 13px; }
.welow-header__hamburger span:nth-child(2) { top: 19px; }
.welow-header__hamburger span:nth-child(3) { top: 25px; }

.welow-header__hamburger[aria-expanded="true"] span:nth-child(1) {
    top: 19px;
    transform: rotate(45deg);
}
.welow-header__hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.welow-header__hamburger[aria-expanded="true"] span:nth-child(3) {
    top: 19px;
    transform: rotate(-45deg);
}

/* ==========================================================================
   OVERLAY MÓVIL
   ========================================================================== */
.welow-header__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.98);
    z-index: 99999;
    overflow-y: auto;
    padding: 80px 24px 40px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.welow-header__overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.welow-header__overlay[hidden] { display: none; }
.welow-header__overlay:not([hidden]) { display: block; }

.welow-header__overlay-inner {
    max-width: 500px;
    margin: 0 auto;
}

.welow-header__overlay-menu,
.welow-header ul.welow-header__overlay-menu {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 0 30px;
    padding: 0;
}
.welow-header__overlay-menu li {
    list-style: none !important;
    list-style-type: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.welow-header__overlay-menu li::before,
.welow-header__overlay-menu li::marker {
    display: none !important;
    content: none !important;
}
.welow-header__overlay-menu a {
    display: block;
    color: #fff;
    text-decoration: none;
    font-family: var(--welow-h-font);
    font-size: 18px;
    font-weight: var(--welow-h-fw-menu);
    text-transform: var(--welow-h-tt-menu);
    letter-spacing: var(--welow-h-ls-menu);
    padding: 16px 0;
    transition: color 0.15s, padding 0.15s;
}
.welow-header__overlay-menu a:hover {
    color: var(--welow-h-btn-bg);
    padding-left: 8px;
}
.welow-header__overlay-menu .sub-menu {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 0 0 16px;
    padding: 0 0 8px;
}
.welow-header__overlay-menu .sub-menu li {
    list-style: none !important;
    list-style-type: none !important;
    border: none;
}
.welow-header__overlay-menu .sub-menu a {
    font-size: 15px;
    font-weight: 500;
    padding: 8px 0;
    color: rgba(255,255,255,0.8);
}

.welow-header__overlay-ctas {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
}
.welow-header__overlay-tel {
    color: #fff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 700;
    padding: 14px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}
.welow-header__overlay-tel .dashicons {
    color: var(--welow-h-btn-bg);
    font-size: 22px;
    width: 22px;
    height: 22px;
}

/* ==========================================================================
   RESPONSIVE — Móvil/Tablet
   ========================================================================== */
@media (max-width: 980px) {
    .welow-header__inner {
        gap: 12px;
        padding: 10px 16px;
    }

    /* Mostrar logo móvil si existe */
    .welow-header__logo-img--desktop { display: none; }
    .welow-header__logo-img--movil   { display: block; }
    /* Si no hay logo móvil, el desktop sigue mostrándose (sin oclusión) */
    .welow-header__logo-img--desktop:only-child { display: block; }

    /* Ocultar menú y CTAs desktop, mostrar hamburger */
    .welow-header__menu--desktop { display: none; }
    .welow-header__ctas { display: none; }
    .welow-header__hamburger { display: block; }
}

/* En desktop, ocultar la versión móvil del logo */
@media (min-width: 981px) {
    .welow-header__logo-img--movil { display: none; }
}

/* Body lock cuando overlay está abierto */
body.welow-header-open {
    overflow: hidden;
}

/* ==========================================================================
   v2.76.3 — MENÚ MÓVIL: aspa para cerrar y submenús plegados y compactos
   ========================================================================== */
.welow-header__overlay { padding-top: 64px; }
.welow-header__overlay-cerrar {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    color: #fff;
    cursor: pointer;
    z-index: 2;
}
.welow-header__overlay-cerrar:hover { background: rgba(255,255,255,.2); }
body.admin-bar .welow-header__overlay-cerrar { top: 60px; }

.welow-header__overlay-menu li.welow-ov-plegable { position: relative; }
.welow-header__overlay-menu li.welow-ov-plegable > a { padding-right: 52px; }
.welow-ov-toggle {
    position: absolute;
    top: 6px;
    right: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
}
.welow-ov-toggle svg { transition: transform .2s ease; }
.welow-ov-plegable.is-abierto > .welow-ov-toggle svg { transform: rotate(180deg); }
.welow-header__overlay-menu li.welow-ov-plegable > .sub-menu { display: none; }
.welow-header__overlay-menu li.welow-ov-plegable.is-abierto > .sub-menu { display: block; }

/* Submenú más compacto */
.welow-header__overlay-menu .sub-menu { padding: 0 0 10px; }
.welow-header__overlay-menu .sub-menu a { padding: 6px 0; font-size: 15px; line-height: 1.3; }
.welow-header__overlay-menu > li > a { padding: 14px 0; }
