/* =========================================== */
/* RESET LISTAS */
/* =========================================== */
ul,
ol,
li {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0;
    padding: 0;
}

/* Pero permitir viñetas en contenido de artículo si las necesitas */
article ul,
article ol {
    list-style: disc;
    padding-left: 20px;
}

article li {
    list-style: inherit;
}

/* =========================================== */
/* RESET Y ESTILOS BASE */
/* =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* Asegurar que Font Awesome esté disponible */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

/* =========================================== */
/* NAVBAR PRINCIPAL */
/* =========================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    transition: all 0.5s ease;
    background: transparent;
    box-shadow: none;
}

header.scrolled {
    background: rgba(1, 121, 91, 0.95);
    padding: 15px 40px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo img {
    height: 55px;
}

/* =========================================== */
/* MENÚ PRINCIPAL - ESTILOS PARA DESKTOP */
/* =========================================== */
.main-menu {
    display: flex;
    list-style: none;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.main-menu>li {
    position: relative;
}

.main-menu>li>a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    font-family: 'Nunito', sans-serif;
    transition: all 0.3s ease;
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.main-menu>li>a:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.main-menu>li.active>a {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================================== */
/* PUENTE INVISIBLE PARA MEJOR UX */
/* =========================================== */
.dropdown::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 8px;
    background: transparent;
    z-index: 999;
    display: none;
}

/* =========================================== */
/* FLECHAS CORREGIDAS */
/* =========================================== */
.dropdown>a::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free", "Segoe UI", sans-serif;
    font-weight: 900;
    font-size: 0.8em;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.submenu .dropdown>a::after {
    content: "\f054";
    font-family: "Font Awesome 6 Free", "Segoe UI", sans-serif;
}

.submenu .dropdown:hover>a::after {
    transform: rotate(90deg);
}

/* =========================================== */
/* SUBMENÚS - COMPORTAMIENTO HOVER CORREGIDO */
/* =========================================== */

/* Primer nivel de submenú */
.submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(1, 121, 91, 0.95);
    padding: 10px 0;
    min-width: 250px;

    /* IMPORTANTE: Oculto por defecto */
    display: none;

    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    margin-top: 3px;

    /* Transición suave */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* Asegurar que cada <li> dentro de un .submenu sea un contenedor posicionado
   para que los submenús laterales se posicionen correctamente
   a la derecha del item padre en escritorio. */
.submenu>li {
    position: relative;
}

/* Mostrar SOLO con hover */
.dropdown:hover>.submenu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Segundo nivel de submenú */
.submenu .submenu {
    position: absolute;
    top: 0;
    left: 100%;
    background: rgba(0, 102, 76, 0.95);
    padding: 10px 0;
    min-width: 220px;

    /* IMPORTANTE: Oculto por defecto */
    display: none;

    border-radius: 8px;
    box-shadow: 10px 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    margin-left: 3px;

    /* Transición suave */
    opacity: 0;
    visibility: hidden;
    transform: translateX(-3px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

/* Mostrar SOLO con hover */
.submenu .dropdown:hover>.submenu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

/* Delay al desaparecer */
.dropdown:not(:hover)>.submenu {
    transition-delay: 0.1s;
}

/* Estilos para enlaces en submenús */
.submenu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #fff;
    font-size: 15px;
    font-family: 'Nunito', sans-serif;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    font-weight: 700;
}

.submenu li a:hover {
    background: rgba(255, 255, 255, 0.15);
    padding-left: 25px;
}

/* =========================================== */
/* BOTÓN HAMBURGUESA */
/* =========================================== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: #fff;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* =========================================== */
/* ESTILOS PARA MÓVIL (max-width: 1024px) */
/* =========================================== */
@media (max-width: 1024px) {

    header {
        padding: 15px 20px;
        background: rgba(1, 121, 91, 0.95) !important;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 21px;
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 1100;
    }

    /* ===== MENÚ LATERAL ===== */
    .main-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #01795b;
        padding: 80px 20px 20px;

        display: flex;
        /* ✅ SOLO AQUÍ */
        flex-direction: column;

        transition: right 0.35s ease;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
        overflow-y: auto;
        z-index: 1000;
    }

    .main-menu.active {
        right: 0;
    }

    .main-menu>li {
        width: 100%;
        margin-bottom: 6px;
    }

    /* ===== ITEMS ===== */
    .main-menu>li>a {
        position: relative;
        padding: 15px 45px;
        border-radius: 8px;
        display: block;
        text-align: center;
        font-weight: 700;
        color: #fff;
        text-decoration: none;
        white-space: normal;
        word-wrap: break-word;
        word-break: break-word;
        overflow-wrap: break-word;
        line-height: 1.4;
    }

    .main-menu>li>a i {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
    }

    /* ===== FLECHA ===== */
    .dropdown>a::after {
        content: "\f054";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        right: 16px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }

    .dropdown.active>a::after {
        transform: translateY(-50%) rotate(90deg);
    }

    /* ===== SUBMENÚ ===== */
    .submenu {
        position: static !important;
        display: none;
        background: rgba(0, 0, 0, 0.25);
        margin: 10px 0 10px 15px;
        border-radius: 8px;
        box-shadow: none;
        padding: 0;
        min-width: auto !important;
        max-height: 0;
        overflow: hidden;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .dropdown.active>.submenu {
        display: block;
        padding: 10px 0;
        max-height: 1000px;
    }

    /* ===== ENLACES EN SUBMENÚS (MÓVIL) ===== */
    .submenu li a {
        white-space: normal !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        padding: 12px 20px 12px 30px;
        line-height: 1.4;
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
        text-align: left;
    }

    .submenu li a i {
        flex-shrink: 0;
        min-width: 20px;
    }

    /* ===== OVERLAY ===== */
    .menu-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .5);
        z-index: 999;
    }

    .menu-overlay.active {
        display: block;
    }

    body.menu-open {
        overflow: hidden;
    }
}

/* =========================================== */
/* MOSTRAR PUENTE INVISIBLE SOLO EN DESKTOP */
/* =========================================== */
@media (min-width: 1025px) {
    .dropdown::after {
        display: block;
    }
}