/*
 * FILE: assets/css/components/navbar.css
 * COMPONENT: navbar.php  →  .navbar
 * PURPOSE: Navbar con estados transparente/sólido, dropdowns, responsive
 *
 * Estados:
 *   .navbar--transparent   → sobre hero: fondo transparente, texto blanco
 *   .navbar--solid         → JS lo aplica: fondo sólido al scroll/dropdown
 */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-navbar);
    background: rgba(0, 56, 36, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition:
        background      0.35s ease,
        box-shadow      0.35s ease,
        border-radius   0.35s ease,
        border-bottom   0.35s ease,
        backdrop-filter 0.35s ease;
}

.navbar__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
    gap: clamp(1rem, 2vw, 2rem);
    transition: height 0.35s ease;
}

.navbar--solid {
    top:          var(--navbar-offset);
    left:         20px;
    right:        20px;
    background:   #ffffff;
    border-radius: var(--navbar-radius);
    box-shadow:   0 12px 48px rgba(0, 56, 36, 0.18), var(--navbar-shadow);
    border-bottom: none;

    --navbar-fg:         #1a2e1e;
    --navbar-fg-strong:  #003824;
    --navbar-fg-muted:   #5a6b5f;
    --navbar-bg:         #ffffff;
    --navbar-border:     #003824;

    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.navbar--solid .navbar__container {
    height: var(--navbar-height-solid);
    padding-inline: var(--space-5);
}

.navbar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
    color: var(--navbar-fg-strong);
    padding: 8px 0;
}

.navbar__logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    flex-shrink: 0;
    filter: brightness(0) invert(1);
    transition: filter 0.35s ease, width 0.35s ease, height 0.35s ease;
}

.navbar--solid .navbar__logo {
    filter: none;
    width: 38px;
    height: 38px;
}

.navbar__brand-text {
    font-size: 0.82rem;
    line-height: 1.3;
    color: var(--navbar-fg);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: color 0.35s ease, text-shadow 0.35s ease;
}
.navbar__brand-text strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navbar-fg-strong);
    transition: color 0.35s ease;
}

.navbar--solid .navbar__brand-text {
    text-shadow: none;
}

.navbar__nav-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    max-width: calc(100% - 340px);
    margin: 0;
}

.navbar__list {
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 1rem);
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar__item {
    position: relative;
}

.navbar__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    color: var(--navbar-fg);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--radius-md);
    background: none;
    border: none;
    cursor: pointer;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition:
        color         0.2s ease,
        background-color 0.2s ease,
        text-shadow   0.35s ease,
        padding       0.2s ease;
}

.navbar--solid .navbar__link {
    text-shadow: none;
}

.navbar__link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 14px;
    right: 14px;
    height: 2px;
    background: var(--navbar-active);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar__link:hover {
    color: var(--navbar-fg-strong);
    background: rgba(255, 255, 255, 0.1);
}

.navbar--solid .navbar__link:hover {
    background: rgba(69, 168, 90, 0.08);
}

.navbar__link:hover::after {
    transform: scaleX(1);
}

.navbar__link.is-active {
    color: var(--navbar-fg-strong);
    font-weight: 600;
}

.navbar__link.is-active::after {
    transform: scaleX(1);
}

.navbar__link:focus-visible {
    outline: 2px solid var(--navbar-active);
    outline-offset: 3px;
}

.navbar__dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    color: var(--navbar-fg);
    font-size: 0.78rem;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition:
        color         0.2s ease,
        background-color 0.2s ease,
        text-shadow   0.35s ease;
}

.navbar--solid .navbar__dropdown-trigger {
    text-shadow: none;
}

.navbar__dropdown-trigger:hover {
    color: var(--navbar-fg-strong);
    background: rgba(255, 255, 255, 0.1);
}

.navbar--solid .navbar__dropdown-trigger:hover {
    background: rgba(69, 168, 90, 0.08);
}

.navbar__dropdown-trigger:focus-visible {
    outline: 2px solid var(--navbar-active);
    outline-offset: 3px;
}

.navbar__dropdown-icon {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.85;
    color: currentColor;
    position: relative;
}

/* Fallback chevron en CSS puro — visible aunque Lucide no cargue */
.navbar__dropdown-icon:empty::before {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    display: block;
}

.navbar__item.is-open .navbar__dropdown-icon {
    transform: rotate(180deg);
}

.navbar__dropdown-menu {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    min-width: 200px;
    background: #ffffff;
    border: 1px solid rgba(0, 56, 36, 0.08);
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 30, 16, 0.16), 0 8px 24px rgba(0, 0, 0, 0.06);
    padding: 8px;
    z-index: 300;
    list-style: none;
    margin: 0;

    opacity: 0;
    pointer-events: none;
    transition:
        opacity   0.22s ease,
        transform 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar__item.is-open .navbar__dropdown-menu {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.navbar__dropdown-item {
    display: block;
    padding: 12px 16px;
    color: #1a2e1e;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.navbar__dropdown-item:hover {
    background: rgba(69, 168, 90, 0.12);
    color: #003824;
    transform: translateX(2px);
}

.navbar__dropdown-item:focus-visible {
    outline: 2px solid var(--navbar-active);
    outline-offset: 3px;
    background: rgba(69, 168, 90, 0.12);
    color: #003824;
}

.navbar__cta-wrap {
    flex-shrink: 0;
}

.navbar__end {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-left: 1.5rem;
    flex-shrink: 0;
}

.navbar__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: linear-gradient(135deg, #45A85A 0%, #3a9450 100%);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-md);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    box-shadow: 0 4px 16px rgba(69, 168, 90, 0.3);
    transition:
        background-color 0.2s ease,
        transform        0.2s ease,
        box-shadow       0.2s ease,
        padding          0.2s ease;
}

.navbar__cta:hover {
    background: linear-gradient(135deg, #3a9450 0%, #2e8c3e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(69, 168, 90, 0.4);
    padding: 12px 30px;
}

.navbar--solid .navbar__cta {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.navbar__cta:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.navbar__mobile-actions {
    display: none;
}

.navbar__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.navbar__burger-bar {
    display: block;
    width: 24px;
    height: 2.5px;
    background-color: var(--navbar-fg-strong);
    border-radius: 2px;
    transition:
        transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
        opacity   0.2s ease;
}

.navbar__burger.is-active .navbar__burger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.navbar__burger.is-active .navbar__burger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.navbar__burger.is-active .navbar__burger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 1024px) {
    .navbar__burger {
        display: flex;
    }

    .navbar__end {
        display: none;
    }

    .navbar__cta-wrap {
        display: none;
    }

    .navbar__nav-wrap {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        height: 100vh;
        height: 100dvh;
        max-width: none;
        flex: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        background: linear-gradient(180deg, #003824 0%, #002a1c 100%);
        z-index: 299;
        padding: calc(var(--navbar-height) + var(--space-5)) var(--space-6) var(--space-10);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: none;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .navbar__nav-wrap::-webkit-scrollbar {
        display: none;
    }

    .navbar__nav-wrap.is-open {
        transform: translateX(0);
    }

    .navbar__mobile-header {
        display: flex;
        align-items: center;
        padding-bottom: var(--space-5);
        margin-bottom: var(--space-4);
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .navbar__mobile-header .navbar__logo {
        filter: brightness(0) invert(1);
        width: 36px;
        height: 36px;
    }

    .navbar__mobile-header .navbar__brand-text {
        color: rgba(255, 255, 255, 0.9);
        text-shadow: none;
    }

    .navbar__mobile-header .navbar__brand-text strong {
        color: #ffffff;
    }

    .navbar__list {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .navbar__link,
    .navbar__dropdown-trigger {
        display: flex;
        width: 100%;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-4) var(--space-3);
        font-size: 1.05rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 0;
        color: rgba(255, 255, 255, 0.9);
    }

    .navbar__link-icon {
        display: flex;
        align-items: center;
        width: 20px;
        height: 20px;
        opacity: 0.85;
    }

    .navbar__link-text {
        flex: 1;
        text-align: left;
    }

    .navbar__dropdown-icon {
        width: 16px;
        height: 16px;
        margin-left: auto;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 1;
    }

    .navbar__link:hover,
    .navbar__dropdown-trigger:hover {
        background: rgba(255, 255, 255, 0.05);
        color: #ffffff;
    }

    .navbar__link::after {
        display: none;
    }

    .navbar__dropdown-menu {
        position: static;
        transform: none;
        min-width: 100%;
        background: rgba(0, 0, 0, 0.25);
        border: none;
        box-shadow: none;
        padding: 0;
        margin-top: 0;

        display: none;
    }

    .navbar__item.is-open .navbar__dropdown-menu {
        display: block;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }

    .navbar__dropdown-item {
        padding: var(--space-3) var(--space-5);
        color: rgba(255, 255, 255, 0.8);
        font-size: 0.95rem;
    }

    .navbar__dropdown-item:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #ffffff;
        transform: none;
    }

    .navbar {
        background: #003824;
        --navbar-fg:        rgba(255, 255, 255, 0.9);
        --navbar-fg-strong: #ffffff;
    }

    .navbar--solid {
        top: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        background: #003824;
    }

    .navbar__brand {
        padding: 6px 0;
    }

    /* CTA móvil dentro del drawer */
    .navbar__mobile-actions {
        display: block;
        margin-top: var(--space-6);
        padding-top: var(--space-5);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .navbar__cta--mobile {
        display: flex;
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: 1rem;
    }

    /* En solid+móvil el logo debe mantenerse blanco sobre fondo verde oscuro */
    .navbar--solid .navbar__logo {
        filter: brightness(0) invert(1);
    }

    /* En solid+móvil restablecer variables de color a blanco para contraste */
    .navbar--solid {
        --navbar-fg:        rgba(255, 255, 255, 0.9);
        --navbar-fg-strong: #ffffff;
    }
}

/* Header interno del drawer mobile — oculto en desktop */
.navbar__mobile-header {
    display: none;
}


/* Iconos leading de cada item */
.navbar__link-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: currentColor;
    opacity: 0.9;
}

/* Si Lucide no cargó, el <i> queda vacío: colapsamos el espacio */
.navbar__link-icon:empty {
    width: 0;
    height: 0;
}

/* Scroll-lock cuando el menú mobile está abierto */
body.body--menu-open {
    overflow: hidden;
}
