/* ============================================================
   IDEALUM — layout.css
   Estilos del "armazón" que traen includes/header.php y
   includes/footer.php: menú móvil, barra de progreso de
   scroll y botón de volver arriba.

   IMPORTANTE
   ----------
   Este archivo lo enlaza el propio header.php. Se separó de
   index.css a propósito: header.php y footer.php insertan el
   HTML de estos componentes en TODAS las páginas, así que sus
   estilos tienen que viajar con ellos y no depender de qué
   versión de index.css esté desplegada. Si el menú móvil
   aparece desplegado en escritorio o el botón de volver
   arriba sale sin estilo, es que este archivo no se cargó.
   ============================================================ */

/* ── Botón hamburguesa ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 4px;
    background: rgba(255, 255, 255, .06);
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transition: transform .28s ease, opacity .2s ease;
}

.nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Menú móvil ── */
.nav-mobile {
    display: none;
    background: var(--navy);
    border-top: 1px solid rgba(255, 255, 255, .08);
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}

.nav-mobile.is-open {
    max-height: 80vh;
    overflow-y: auto;
}

.nav-mobile ul {
    list-style: none;
    padding: 6px 20px 20px;
    margin: 0;
}

.nav-mobile li a {
    display: block;
    padding: 13px 4px;
    color: rgba(255, 255, 255, .82);
    font-size: .95rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    transition: color .2s ease, padding-left .2s ease;
}

.nav-mobile li a:hover,
.nav-mobile li a.active {
    color: #fff;
    padding-left: 10px;
}

.nav-mobile-search {
    display: flex;
    gap: 8px;
    padding: 18px 20px 4px;
}

.nav-mobile-search input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .15);
    color: #fff;
    padding: 11px 14px;
    font-size: .9rem;
    border-radius: 4px;
    outline: none;
}

.nav-mobile-search input::placeholder {
    color: rgba(255, 255, 255, .4);
}

.nav-mobile-search button {
    border: 0;
    background: var(--wine);
    color: #fff;
    padding: 0 18px;
    border-radius: 4px;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
}

body.nav-open {
    overflow: hidden;
}

/* ══════════════════════════════════════════════
   BARRA DE PROGRESO Y BOTÓN VOLVER ARRIBA
   Van aquí (y no en animaciones.css) porque index.css se
   carga en TODAS las páginas, incluidas las que conservan
   el diseño anterior y no usan el motor de animaciones.
══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   BARRA DE PROGRESO DE SCROLL
══════════════════════════════════════════════ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 100%;
    transform: scaleX(0);
    transform-origin: 0 50%;
    background: linear-gradient(90deg, var(--wine, #752656), var(--wine-light, #8f3068));
    z-index: 2000;
    pointer-events: none;
}

/* ══════════════════════════════════════════════
   BOTÓN VOLVER ARRIBA
══════════════════════════════════════════════ */
.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 88px;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 4px;
    background: var(--wine, #752656);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    transition: opacity .3s ease, transform .3s ease, visibility .3s, background-color .2s ease;
    z-index: 1500;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
}

.back-to-top.is-shown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--wine-light, #8f3068);
    transform: translateY(-3px);
}

/* ── Navegación móvil: hamburguesa bajo 900px ── */
@media (max-width: 1100px) {

    .nav-links,
    .nav-search {
        display: none;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-mobile {
        display: block;
    }

    .main-nav .nav-inner {
        height: 60px;
        padding: 0 18px;
    }

    .main-nav.scrolled .nav-inner {
        height: 54px;
    }
}

@media (max-width: 560px) {
    .back-to-top {
        right: 14px;
        bottom: 76px;
        width: 40px;
        height: 40px;
    }
}

/* ══════════════════════════════════════════════
   WHATSAPP FLOTANTE (elige sucursal)
══════════════════════════════════════════════ */
.wa-float {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1600;
    /* El contenedor mide exactamente lo que el botón. El panel va
       posicionado encima de forma absoluta para que, estando cerrado,
       no ocupe espacio ni robe clics a lo que haya debajo (como el
       botón de volver arriba). */
    width: 56px;
    height: 56px;
}

.wa-float-btn {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(37, 211, 102, .38);
    transition: transform .22s ease, background-color .22s ease;
}

.wa-float-btn:hover {
    transform: scale(1.06);
    background: #1fb457;
}

.wa-float-btn svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
    transition: opacity .2s ease, transform .25s ease;
}

.wa-float-btn .wa-icon-close {
    position: absolute;
    width: 19px;
    height: 19px;
    opacity: 0;
    transform: rotate(-90deg);
}

.wa-float-btn.is-open .wa-icon-chat {
    opacity: 0;
    transform: rotate(90deg);
}

.wa-float-btn.is-open .wa-icon-close {
    opacity: 1;
    transform: rotate(0);
}

.wa-float-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    width: min(88vw, 310px);
    pointer-events: none;
    background: #fff;
    border: 1px solid rgba(29, 35, 64, .12);
    border-radius: 6px;
    box-shadow: 0 20px 46px rgba(17, 31, 67, .22);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(.97);
    transform-origin: bottom right;
    transition: opacity .24s ease, transform .24s ease, visibility .24s;
}

.wa-float-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.wa-float-head {
    padding: 15px 16px;
    background: var(--navy, #12193A);
    color: #fff;
}

.wa-float-head strong {
    display: block;
    font-size: .92rem;
    line-height: 1.3;
}

.wa-float-head span {
    display: block;
    margin-top: 3px;
    font-size: .76rem;
    color: rgba(255, 255, 255, .6);
}

.wa-float-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    text-decoration: none;
    border-bottom: 1px solid rgba(29, 35, 64, .08);
    transition: background-color .18s ease;
}

.wa-float-item:last-child {
    border-bottom: 0;
}

.wa-float-item:hover {
    background: #f4f6fb;
}

.wa-float-item-icon {
    width: 34px;
    height: 34px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(37, 211, 102, .12);
    color: #1fa855;
}

.wa-float-item-icon svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.wa-float-item-text strong {
    display: block;
    font-size: .89rem;
    color: var(--text, #1C2340);
    line-height: 1.3;
}

.wa-float-item-text span {
    display: block;
    margin-top: 2px;
    font-size: .76rem;
    color: var(--muted, #6B7280);
}

/* Realce cuando el panel se abre desde otro botón de la página
   (por ejemplo el "Consultar por WhatsApp" de la ficha) */
.wa-float.is-calling .wa-float-btn {
    animation: waPulse .7s ease;
}

@keyframes waPulse {

    0%,
    100% {
        box-shadow: 0 10px 26px rgba(37, 211, 102, .38);
    }

    50% {
        box-shadow: 0 10px 26px rgba(37, 211, 102, .38), 0 0 0 14px rgba(37, 211, 102, .18);
    }
}

@media (max-width: 560px) {
    .wa-float {
        right: 14px;
        bottom: 14px;
        width: 50px;
        height: 50px;
    }

    .wa-float-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ══════════════════════════════════════════════
   ACORDEÓN DE PRODUCTOS (menú móvil)
══════════════════════════════════════════════ */
.nav-mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 4px;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, .82);
    font-size: .95rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color .2s ease;
}

.nav-mobile-toggle:hover {
    background: rgba(255, 255, 255, .06);
}

.nav-mobile-toggle .nav-caret {
    transition: transform .25s ease;
}

.nav-mobile-toggle.is-open .nav-caret {
    transform: rotate(180deg);
}

.nav-mobile-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.nav-mobile-sub.is-open {
    max-height: 640px;
}

.nav-mobile-sub a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px 11px 20px;
    color: rgba(255, 255, 255, .62);
    font-size: .88rem;
    border-bottom: 1px solid rgba(255, 255, 255, .05);
    border-radius: 4px;
    transition: color .2s ease, background-color .2s ease, padding-left .2s ease;
}

.nav-mobile-sub a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
    padding-left: 24px;
}

.nav-mobile-sub a span {
    font-size: .72rem;
    color: rgba(255, 255, 255, .35);
}

.nav-mobile-sub-todo {
    color: var(--wine-light, #8f3068) !important;
    font-weight: 700;
}

/* ══════════════════════════════════════════════
   MENÚ DE PRODUCTOS (escritorio)
══════════════════════════════════════════════ */

/* NUEVO: Contenedor global como referencia para el mega panel */
.nav-inner {
    position: relative;
}

.nav-item-mega {}

.nav-caret {
    display: inline-block;
    font-size: 1.3em;
    margin-left: 6px;
    opacity: 0.9;
    vertical-align: middle;
    transition: transform 0.3s ease;
}

.nav-item-mega:hover .nav-caret,
.nav-item-mega.is-open .nav-caret {
    transform: rotate(180deg);
}

.mega-panel {
    position: absolute;
    left: 50%;
    top: calc(83% + 12px);
    z-index: 1200;
    width: 920px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    box-shadow: 0 24px 48px rgba(17, 31, 67, .20), 0 2px 10px rgba(17, 31, 67, .08);
    border: 1px solid rgba(29, 35, 64, .06);
}

.nav-item-mega:hover .mega-panel,
.nav-item-mega.is-open .mega-panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.mega-inner {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 540px;
    /* <--- ALTURA FIJA PARA EVITAR BRINCOS */
    max-height: 75vh;
}

.mega-secciones {
    background: #f7f9fc;
    border-right: 1px solid #e6eaf1;
    padding: 12px 10px 14px;
    overflow-y: auto;
}

.mega-seccion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    margin: 2px 0;
    border-left: 3px solid transparent;
    color: #38425e !important;
    font-size: .86rem;
    line-height: 1.3;
    position: relative;
    /* <--- PARA POSICIONAR LA FLECHA INDICADORA */
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.mega-seccion em {
    font-style: normal;
    font-size: .72rem;
    color: #9aa3ba;
    flex: none;
}

/* Hover: acento suave para no convertir la lista en 11 bloques
   sólidos de color al pasar el mouse. El seleccionado (is-active)
   sí queda sólido, para que se note cuál sección se está viendo. */
.mega-seccion:hover {
    background: rgba(117, 38, 86, .07);
    color: var(--wine, #752656) !important;
    border-left-color: rgba(143, 47, 100, .4);
}

.mega-seccion.is-active {
    background: #752656;
    color: #fff !important;
    border-left-color: #752656;
}

.mega-seccion.is-active em {
    color: rgba(255, 255, 255, .75);
}

/* <--- FLECHA INDICADORA HACIA LA DERECHA ---> */
.mega-seccion.is-active::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #752656;
    z-index: 10;
}

.mega-seccion-todo {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid #e6eaf1;
    font-weight: 700;
    font-size: .8rem;
    color: var(--wine, #752656) !important;
}

/* Guía por proyecto: mismo ancho que la lista, distinguida por su
   color de fondo y un acento a la izquierda (no por esquinas
   redondeadas, para mantener la misma estética rectangular). */
.mega-seccion-guia {
    display: block;
    margin: 14px 0 0;
    padding: 11px 12px 11px 14px;
    border-left: 3px solid var(--wine, #752656);
    line-height: 1.4;
    background: #fdf2f8;
    color: var(--navy, #12193A) !important;
}

.mega-seccion-guia small {
    display: block;
    font-weight: 500;
    font-size: .74rem;
    color: #8f2f64;
    margin-top: 2px;
}

/* Estas dos van DESPUÉS de la regla genérica .mega-seccion:hover
   para poder ganarle y arreglar el contraste del hover */
.mega-seccion-guia:hover,
.mega-seccion-guia.is-active {
    background: #752656 !important;
    border-left-color: #752656 !important;
    color: #fff !important;
}

.mega-seccion-guia:hover small,
.mega-seccion-guia.is-active small {
    color: rgba(255, 255, 255, .82) !important;
}

.mega-detalle {
    position: relative;
    padding: 24px 30px 22px;
    overflow-y: auto;
}

.mega-familias {
    display: none;
}

.mega-familias.is-active {
    display: block;
}

.mega-detalle-cab {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e6eaf1;
}

.mega-detalle-cab h3 {
    margin: 0;
    font-size: 1.12rem;
    color: var(--navy, #12193A);
}

.mega-detalle-cab p {
    margin: 5px 0 0;
    font-size: .84rem;
    color: #6f7896;
    line-height: 1.5;
}

.mega-familias-lista {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px 24px;
}

/* <--- MEJORA DE HITBOX Y ANIMACIÓN EN ENLACES ---> */
.mega-familias-lista a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 12px;
    margin-left: -12px;
    font-size: .87rem;
    line-height: 1.3;
    color: #4a5570 !important;
    border-radius: 4px;
    transition: color .2s ease, transform .2s ease, background-color .2s ease;
}

.mega-familias-lista a:hover {
    color: var(--wine, #752656) !important;
    background-color: rgba(117, 38, 86, 0.04);
    transform: translateX(4px);
}

.mega-detalle-pie {
    display: inline-block;
    margin-top: 16px;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--wine, #752656) !important;
}

.mega-panel::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 25%;
    /* MODIFICADO para que la flecha apunte visualmente al botón Productos */
    width: 12px;
    height: 12px;
    background: #fff;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: -2px -2px 4px rgba(17, 31, 67, .06);
}

@media (max-width: 1100px) {
    .mega-panel {
        width: 760px;
    }
}

.nav-links .nav-guia {
    color: #ffd9ec !important;
}

.mega-seccion-icon {
    flex: none;
    width: 18px;
    height: 18px;
    display: inline-flex;
}

.mega-seccion-icon svg {
    width: 100%;
    height: 100%;
}

/* ══════════════════════════════════════════════
   MENÚ DE SUCURSALES (escritorio)
══════════════════════════════════════════════ */

/* El <li> se estira a toda la altura del navbar para que el panel
   pueda colgar de top:100% y quede pegado al borde inferior: si
   quedara un hueco, el hover se cortaría al bajar el mouse. */
.nav-links .nav-item-suc {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.nav-item-suc:hover .nav-caret,
.nav-item-suc:focus-within .nav-caret {
    transform: rotate(180deg);
}

.suc-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    z-index: 1200;
    width: 400px;
    max-width: calc(100vw - 48px);
    background: #fff;
    border: 1px solid rgba(29, 35, 64, .06);
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -6px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    box-shadow: 0 24px 48px rgba(17, 31, 67, .20), 0 2px 10px rgba(17, 31, 67, .08);
}

.nav-item-suc:hover .suc-panel,
.nav-item-suc:focus-within .suc-panel,
.nav-item-suc.is-open .suc-panel {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

/* Reset: los links de adentro heredan el estilo de .nav-links a
   (mayúsculas, blanco, subrayado animado). Hay que apagarlo. */
.nav-links .suc-panel a {
    display: block;
    padding: 0;
    color: inherit !important;
    font-size: inherit;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.nav-links .suc-panel a::before,
.nav-links .suc-panel a::after {
    content: none;
}

.suc-panel-cab {
    padding: 15px 20px 12px;
    background: #f7f9fc;
    border-bottom: 1px solid #e6eaf1;
}

.suc-panel-cab h3 {
    margin: 0;
    font-size: 1.02rem;
    color: var(--navy, #12193A);
}

.suc-panel-cab p {
    margin: 4px 0 0;
    font-size: .8rem;
    color: #6f7896;
}

.nav-links .suc-panel .suc-item {
    padding: 12px 20px;
    border-bottom: 1px solid #eef1f6;
    transition: background-color .15s ease, padding-left .15s ease;
}

.nav-links .suc-panel .suc-item:last-child {
    border-bottom: 0;
}

.nav-links .suc-panel .suc-item:hover {
    background: #f7f9fc;
    padding-left: 24px;
}

.suc-item-cab {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.suc-item-cab strong {
    font-size: .92rem;
    color: var(--navy, #12193A);
}

.suc-item-cab em {
    font-style: normal;
    font-size: .72rem;
    color: #8b93ad;
}

.suc-item-dir {
    display: block;
    margin-top: 3px;
    font-size: .8rem;
    line-height: 1.45;
    color: #6f7896;
}

.suc-item-tel {
    display: block;
    margin-top: 2px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--wine, #752656);
}

.suc-panel::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    background: #f7f9fc;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: -2px -2px 4px rgba(17, 31, 67, .06);
}

/* ══════════════════════════════════════════════
   SCROLLBARS PERSONALIZADAS (menú desplegable)
══════════════════════════════════════════════ */
.mega-secciones::-webkit-scrollbar,
.mega-detalle::-webkit-scrollbar {
    width: 6px;
}

.mega-secciones::-webkit-scrollbar-track,
.mega-detalle::-webkit-scrollbar-track {
    background: transparent;
}

.mega-secciones::-webkit-scrollbar-thumb,
.mega-detalle::-webkit-scrollbar-thumb {
    background-color: rgba(117, 38, 86, 0.15);
    border-radius: 4px;
}

.mega-secciones:hover::-webkit-scrollbar-thumb,
.mega-detalle:hover::-webkit-scrollbar-thumb {
    background-color: rgba(117, 38, 86, 0.4);
}