/*************************************************
                    CORE.CSS
        TODO lo común a TODAS las páginas
**************************************************/
/* ==================================================
  1. IMPORTS
==================================================*/
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==================================================
  2. VARIABLES
==================================================*/
:root {
    --font-family-body: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    --font-weight-body: 400;
    --font-weight-heading: 600;
}

/* ==================================================
  3. REGLAS BASE
==================================================*/
body {
    font-family: var(--font-family-body);
    font-weight: var(--font-weight-body);
    font-optical-sizing: auto;
    font-variation-settings: "wdth" 100;
}

/* ==================================================
  4. TÍTULOS GLOBALES
==================================================*/
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-heading);
}

/* ==================================================
  5. FOOTER
==================================================*/

.footer { font-family: var(--font-family-body); }

/* ==================================================
  6. UTILIDADES OPEN SANS (opcional)
==================================================*/
.open-sans {
    font-family: var(--font-family-heading);
    font-optical-sizing: auto;
    font-variation-settings: "wdth" 100;
}

.open-sans-light     { font-weight: 300; }
.open-sans-regular   { font-weight: 400; }
.open-sans-medium    { font-weight: 500; }
.open-sans-semibold  { font-weight: 600; }
.open-sans-bold      { font-weight: 700; }
.open-sans-extrabold { font-weight: 800; }
.open-sans-italic    { font-style: italic; }

/*==================================================
  2. VARIABLES (:root)
==================================================*/

:root {
    /* ===== COLORES ===== */
    --color-primary: hsl(222, 96%, 55%);        /* az */
    --color-primary-dark: hsl(222, 80%, 40%);
    background-color: #1f1f1f;
    --color-secondary: #1f1f1f;      /* ne2 */
    --color-accent: hsl(44, 100%, 50%);         /* am */
    --color-accent-light: hsl(36, 79%, 74%);    /* am2 */
    
    --color-text: hsl(220, 20%, 18%);
    --color-muted: hsl(0, 0%, 63%);             /* gr */
    --color-white: hsl(0, 0%, 100%);            /* bl */
    --color-black: hsl(0, 0%, 0%);              /* ne */
    --color-bg-light: hsl(222, 53%, 92%);       /* bl2 */
    
    /* Navbar */
    --color-top-header: hsl(0, 0%, 2%);
    --color-top-header-text: hsl(0, 0%, 90%);
    --color-nav-bg: #ffffff;
    --color-nav-text: hsl(242, 54%, 14%);
    --color-sidepanel-bg: #1f2937;
    --color-sidepanel-text: #e5e7eb;
    --color-sidepanel-hover: rgba(255,255,255,0.05);
    --color-dropdown-bg: hsl(220, 15%, 20%);
    --color-dropdown-text: hsl(0, 0%, 90%);
    
    /* Colores de estado */
    --color-whatsapp: #25D366;
    
    /* ===== TIPOGRAFÍA ===== */
    --font-family: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-base: 16px;
    --font-size-small: 0.875rem;
    
    /* ===== ESPACIADO ===== */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 4rem;
    
    /* ===== LAYOUT ===== */
    --container-max-width: 1200px;
    --border-radius: 0.5rem;
    --box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
    
    /* ===== Z-INDEX ===== */
    --z-sidepanel: 9999;
    --z-overlay: 4000;
    --z-nav-logo: 1500;
    --z-nav-toggle: 1500;
    --z-nav-menu: 1100;
    --z-dropdown: 1000;
    --z-dropdown-sub: 1001;
    --z-whatsapp: 900;
    --z-ai-panel: 800;
}


/*==================================================
  3. REGLAS BASE
==================================================*/

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    position: relative;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--color-text);
    background: var(--color-white);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body.nav-open {
    overflow: hidden;
}

/* Títulos */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-secondary);
}

/* Enlaces */
a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

/* Imágenes */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Main (para footer abajo) */
main {
    flex: 1;
}


/*==================================================
  4. UTILIDADES (SOLO las que usas)
==================================================*/

.text-center { text-align: center; }
.text-small  { font-size: var(--font-size-small); }
.text-muted  { color: var(--color-muted); }

.dv-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.dv-section {
    padding: var(--spacing-xl) 0;
}

/* ===== ESPACIADO LEGADO ===== */
.spa  { padding-right: 5px; }
.spa2 { padding-right: 12px; }

/* ===== CLASES LEGADO (compatibilidad) ===== */
.am  { color: hsl(44, 100%, 50%); }
.na  { color: hsl(32, 93%, 56%); }
.az  { color: hsl(222, 96%, 55%); }
.az2 { color: hsl(222, 72%, 32%); }
.ne  { color: hsl(0, 0%, 0%); }
.bl  { color: hsl(0, 0%, 100%); }
.gr  { color: hsl(0, 0%, 63%); }
.vw  { color: var(--color-whatsapp); } /* ✅ Verde WhatsApp OFICIAL */

.bg-am  { background-color: hsl(44, 100%, 50%); }
.bg-az  { background-color: hsl(222, 96%, 55%); }
.bg-ne  { background-color: hsl(0, 0%, 0%); }
.bg-bl  { background-color: hsl(0, 0%, 100%); }


/*==================================================
  5. NAVBAR COMPLETO
==================================================*/

/* ===== 5.1 TOP HEADER ===== */
.top-header {
    position: relative;
    height: 42px;
    background: var(--color-top-header);
    display: flex;
    align-items: center;
    justify-content: center;
}

.top-header .row {
    width: 100%;
    margin: 0;
}

.top-header .col-lg-4 {
    padding: 0;
}

.top-header p {
    margin: 0;
    font-size: 14px;
    color: var(--color-top-header-text);
}

.top-header .foot-link {
    color: var(--color-top-header-text);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.top-header .foot-link:hover {
    opacity: 0.9;
}

.top-header .gr {
    color: var(--color-top-header-text);
    margin-right: 2px;
}

.top-header .spa {
    margin-right: 8px;
}

/* ===== 5.2 NAVBAR PRINCIPAL ===== */
.nav__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    min-height: 90px;
    position: relative;
    background: var(--color-nav-bg);
}

.nav__logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--color-nav-text);
    font-size: 1.4rem;
    text-decoration: none;
    z-index: var(--z-nav-logo);
}

.nav__logo img {
    max-height: 5.5rem;
}

.nav__toggle {
    display: block;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-nav-text);
    background: none;
    border: none;
    padding: 0.75rem;
    z-index: var(--z-nav-toggle);
}

.nav__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    color: var(--color-top-header-text);
    padding: 1rem 1.8rem;
    color: var(--color-nav-text);
    z-index: var(--z-nav-menu);
}

.nav__menu.show-menu {
    display: block;
}

.nav__list {
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav__link,
.dropdown__toggle,
.dropdown__link {
    width: 100%;
    justify-content: flex-start;
    padding: 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    text-decoration: none;
    color: var(--color-nav-text);
    font-weight: 600;
    cursor: pointer;
}

/* ===== 5.3 SIDEPANEL (menú mobile) ===== */
.sidepanel {
    position: fixed;
    top: 133px; /* 42px top-header + 90px nav = 132px */
    left: -100%;
    width: 82%;
    max-width: 320px;
    height: calc(100vh - 132px);
    color: var(--color-top-header-text);
    background: var(--color-sidepanel-bg);
    transition: left .35s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.25);
    overflow-y: auto;
    z-index: var(--z-sidepanel);
}

.sidepanel.open {
    left: 0;
}

.sidepanel__header {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1rem 0.5rem;
    min-height: 50px;
}

.sidepanel-close {
    background: none;
    border: none;
    color: var(--color-top-header-text);
    font-size: 2rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.sidepanel-close:hover {
    background-color: var(--color-sidepanel-hover);
}

.sidepanel__brand {
    padding: 1.25rem 1.5rem;
    text-align: center;
}

.sidepanel__logo {
    max-height: 65px;
    opacity: 0.6;
    margin-bottom: 0.5rem;
}

.sidepanel__brand-text {
    color: var(--color-sidepanel-text);
    font-size: 1rem;
    font-weight: 600;
}

.sidepanel__nav {
    display: flex;
    flex-direction: column;
    padding: 1rem 1.2rem;
}

.sidepanel__nav a,
.sidepanel__nav button {
    font-size: 17px;
    padding: 0.85rem 0.4rem;
    color: #ffffff;
    background: none;
    border: none;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 0.125rem;
}

.sidepanel__nav a:hover,
.sidepanel__nav button:hover {
    background: var(--color-sidepanel-hover);
}

.sidepanel__nav i {
    color: var(--color-accent);
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

/* Submenú en sidepanel */
.sp-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.sp-arrow {
    font-size: 24px;
    transition: transform 0.25s ease;
}

.sp-toggle.open .sp-arrow {
    transform: rotate(90deg);
}

.sp-submenu {
    display: none;
    padding-left: 1rem;
    margin-bottom: 0.5rem;
    border-left: 2px solid rgba(255,255,255,0.25);
}

.sp-submenu.open {
    display: block;
}

.sp-submenu a {
    display: block;
    padding: 0.55rem 0;
    font-size: 15px;
    color: #eaeaea;
    font-weight: 500;
}

.sp-cta {
    margin-top: 1rem;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    text-align: center;
    padding: 0.75rem 0 !important;
}

/* Overlay */
.sidepanel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    opacity: 0;
    pointer-events: none;
    transition: .3s;
    z-index: var(--z-overlay);
}

.sidepanel-overlay.open {
    opacity: 1;
    pointer-events: all;
}


/*==================================================
  6. WHATSAPP FLOTANTE
==================================================*/

.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #29ad19;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.2);
    z-index: var(--z-whatsapp);
    transition: transform 0.3s ease-in-out;
    animation: bounce 1.5s infinite;
}

.whatsapp-float img {
    width: 40px;
    height: 40px;
}

.whatsapp-float:hover {
    transform: scale(1.1);
}


/*==================================================
  7. FOOTER
==================================================*/

.footer {
    color: var(--color-white);
    padding: 10px;
    background-color: var(--color-secondary);
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.foot-link {
    color: var(--color-white);
    font-size: 1em;
    text-decoration: none;
}

.foot-link:link,
.foot-link:active,
.foot-link:visited {
    color: var(--color-white);
    text-decoration: none;
}

.foot-link:hover {
    color: var(--color-accent);
    font-weight: bold;
    text-decoration: none;
}


/*==================================================
  8. ANIMACIONES
==================================================*/

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/*==================================================
  9. RESPONSIVE - DESKTOP (1024px+)
==================================================*/

@media (min-width: 1024px) {

    /* ===== TOP HEADER ===== */
    .top-header .row {
        display: flex;
        justify-content: space-between;
        max-width: var(--container-max-width);
        margin: 0 auto;
        padding: 0 1rem;
    }

    .top-header .col-lg-4 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }

    /* ===== NAVBAR ===== */
    .nav__container {
        margin: 0 auto;
        padding: 0 2%;
        min-height: 144px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: relative;
        border-bottom: 1px solid #d1d1d1;
    }

    .nav__logo {
        position: static;
        flex-shrink: 0;
        font-size: 1.44rem;
        margin-right: 3.6rem;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        white-space: normal;
        z-index: 100;
    }

    .nav__logo img {
        max-height: 5.4rem;
        max-width: none;
        width: auto;
    }

    .nav__logo span {
        font-size: 1.1rem;
        font-weight: 600;
        white-space: normal;
        line-height: 1.2;
    }

    /* ===== MENÚ PRINCIPAL ===== */
    .nav__menu {
        flex: 1;
        display: flex;
        justify-content: center;
        position: static;
        width: auto;
        background: none;
        padding: 0;
    }

    .nav__list {
        flex-direction: row;
        display: flex;
        gap: 0.54rem;
        align-items: center;
        margin-left: 0;
        list-style: none;
        margin: 0;
        padding: 0;
        justify-content: center;
    }

    .nav__item > .nav__link {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 200px;
    }

    .nav__link,
    .dropdown__toggle {
        padding: 1rem 1rem;
        color: hsl(0, 0%, 18%);
        font-weight: 600;
        border-radius: 4px;
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 0.35rem;
        cursor: pointer;
        background: none;
        border: none;
        white-space: nowrap;
        min-width: max-content;
    }

    .nav__link:hover,
    .dropdown__toggle:hover {
        background-color: var(--color-accent);
        color: var(--color-black);
    }

    .dropdown__toggle i {
        display: inline-block;
        transition: all 0.25s ease;
    }

    .dropdown:hover .dropdown__toggle i {
        transform: rotate(180deg);
    }

    /* ===== DROPDOWN ===== */
    .dropdown {
        position: relative;
    }

    .dropdown__menu {
        position: absolute;
        top: 100%;
        left: 0;
        background-color: var(--color-dropdown-bg);
        border-radius: 4px;
        min-width: 220px;
        padding: 0.5rem 0;
        display: none;
        z-index: var(--z-dropdown);
        list-style: none;
        margin: 0;
    }

    .dropdown:hover > .dropdown__menu {
        display: block;
    }

    .dropdown__item {
        position: relative;
    }

    .dropdown__item::after {
        content: "";
        position: absolute;
        top: 0;
        right: -8px;
        width: 8px;
        height: 100%;
    }

    .dropdown__link {
        padding: 0.6rem 1rem;
        color: var(--color-dropdown-text);
        display: block;
        text-decoration: none;
        font-weight: 600;
        cursor: pointer;
        background: none;
        border: none;
        width: 100%;
        text-align: left;
    }

    .dropdown__link:hover {
        background-color: var(--color-accent);
        color: var(--color-black);
    }

    /* ===== SUB-DROPDOWN ===== */
    .dropdown__submenu {
        position: absolute;
        top: 0;
        background-color: var(--color-dropdown-bg);
        min-width: 150px;
        padding: 0.4rem 0;
        display: none;
        list-style: none;
        border-radius: 4px;
        left: calc(100% - 1px);
        box-shadow: 3px 3px 10px rgba(0,0,0,0.2);
        margin: 0;
        z-index: var(--z-dropdown-sub);
    }

    .dropdown__item:hover > .dropdown__submenu {
        display: block;
    }

    .dropdown__submenu a {
        padding: 0.5rem 0.9rem;
        color: var(--color-white);
        display: block;
        text-decoration: none;
        font-size: 0.95em;
        font-weight: 500;
    }

    .dropdown__submenu a:hover {
        background-color: var(--color-accent);
        color: var(--color-black);
    }

    /* Flecha en items con submenu */
    .has-submenu {
        position: relative;
    }

    .has-submenu::after {
        content: "›";
        font-size: 2.7rem;
        color: hsl(0, 1%, 85%);
        position: absolute;
        right: 10px;
        top: 12%;
        transform: translateY(-50%) translateX(-4px);
        opacity: 0;
        transition: all .18s ease;
    }

    .has-submenu:hover::after {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }

    /* ===== FLAG ===== */
    .nav__item--flag {
        display: flex;
        align-items: center;
        padding-left: 12px;
    }

    .nav__item--flag img {
        width: 20px;
        opacity: 0.8;
    }

    /* ===== OCULTAR ELEMENTOS MOBILE ===== */
    .nav__toggle {
        display: none;
    }

    .sidepanel,
    .sidepanel-overlay {
        display: none;
    }

    /* ===== UTILIDADES RESPONSIVE ===== */
    .d-none {
        display: none !important;
    }

    .d-lg-block {
        display: block !important;
    }
}


/*==================================================
  10. RESPONSIVE - TABLET Y MÓVIL
==================================================*/

@media (max-width: 1023px) {
    /* Ajustes para mobile si son necesarios */
    .d-lg-block {
        display: none !important;
    }
}

@media (max-width: 768px) {
    /* Ajustes para móviles pequeños */
    .whatsapp-float {
        bottom: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }

    .whatsapp-float img {
        width: 30px;
        height: 30px;
    }
}