﻿/* =========================================================
   ERP-UNIV ATLAS
   NAVBAR
   ========================================================= */


/* =========================================================
   CONTENEDOR PRINCIPAL
   ========================================================= */

.atlas-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    min-height: 84px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(220, 231, 236, 0.75);
}


/* =========================================================
   CONTENEDOR INTERIOR
   ========================================================= */

.atlas-navbar__inner {
    position: relative;
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}


/* =========================================================
   MARCA Y LOGOTIPO
   ========================================================= */

.atlas-navbar__brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.atlas-navbar__logo {
    width: auto;
    height: 44px;
    max-width: 180px;
    object-fit: contain;
}


/* =========================================================
   NAVEGACIÓN DE ESCRITORIO
   ========================================================= */

.atlas-navbar__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 28px;
}


/* =========================================================
   ENLACES
   ========================================================= */

.atlas-navbar__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 2px;
    color: var(--erp-text);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    transition: color 180ms ease, transform 180ms ease;
}

    .atlas-navbar__link::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 3px;
        width: 0;
        height: 2px;
        border-radius: var(--erp-radius-pill);
        background: linear-gradient( 90deg, var(--erp-primary), var(--erp-primary-dark) );
        opacity: 0;
        transform: translateX(-50%);
        transition: width 240ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease;
    }

    .atlas-navbar__link:hover {
        color: var(--erp-primary-dark);
        transform: translateY(-1px);
    }

        .atlas-navbar__link:hover::after {
            width: 18px;
            opacity: 0.45;
        }

    .atlas-navbar__link.is-active {
        color: var(--erp-primary-dark);
    }

        .atlas-navbar__link.is-active::after {
            width: 30px;
            opacity: 1;
        }


/* =========================================================
   CTA PRINCIPAL DE ESCRITORIO
   ========================================================= */

.atlas-navbar__actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.atlas-navbar__cta {
    min-height: 44px;
    padding-inline: 20px;
    font-size: 0.9rem;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

    .atlas-navbar__cta:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 24px rgba(35, 69, 88, 0.18);
    }

    .atlas-navbar__cta.is-active {
        box-shadow: 0 0 0 3px rgba(76, 121, 156, 0.15), 0 8px 20px rgba(0, 0, 0, 0.12);
    }


/* =========================================================
   CTA DEL MENÚ RESPONSIVE
   OCULTO EN ESCRITORIO
   ========================================================= */

.atlas-navbar__mobile-action {
    display: none;
}

.atlas-navbar__mobile-cta {
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    text-align: center;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

    .atlas-navbar__mobile-cta:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 24px rgba(35, 69, 88, 0.18);
    }

    .atlas-navbar__mobile-cta.is-active {
        box-shadow: 0 0 0 3px rgba(76, 121, 156, 0.15), 0 8px 20px rgba(0, 0, 0, 0.12);
    }


/* =========================================================
   CONTROL DEL MENÚ
   ========================================================= */

.atlas-navbar__toggle {
    display: none;
}


/* =========================================================
   BOTÓN HAMBURGUESA
   ========================================================= */

.atlas-navbar__hamburger {
    display: none;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
    background: var(--erp-surface);
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-pill);
    cursor: pointer;
}

    .atlas-navbar__hamburger span {
        width: 18px;
        height: 2px;
        border-radius: var(--erp-radius-pill);
        background: var(--erp-primary-dark);
        transition: var(--erp-transition-fast);
    }


    /* =========================================================
   ACCESIBILIDAD
   ========================================================= */

    .atlas-navbar__brand:focus-visible,
    .atlas-navbar__link:focus-visible,
    .atlas-navbar__cta:focus-visible,
    .atlas-navbar__mobile-cta:focus-visible,
    .atlas-navbar__hamburger:focus-visible {
        outline: 3px solid rgba(75, 116, 145, 0.25);
        outline-offset: 4px;
    }


/* =========================================================
   TABLET Y MENÚ RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {

    /* ---------------------------------------------------------
       BOTÓN HAMBURGUESA
       --------------------------------------------------------- */

    .atlas-navbar__hamburger {
        display: inline-flex;
    }


    /* ---------------------------------------------------------
       MENÚ DESPLEGABLE
       --------------------------------------------------------- */

    .atlas-navbar__nav {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        padding: 22px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid var(--erp-border);
        border-radius: var(--erp-radius-lg);
        box-shadow: var(--erp-shadow-md);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        overscroll-behavior: contain;
    }


    /* ---------------------------------------------------------
       ENLACES DEL MENÚ
       --------------------------------------------------------- */

    .atlas-navbar__link {
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        justify-content: flex-start;
    }

        .atlas-navbar__link::after {
            left: 14px;
            bottom: 5px;
            transform: none;
        }

        .atlas-navbar__link:hover::after {
            width: 18px;
        }

        .atlas-navbar__link.is-active::after {
            width: 28px;
        }


    /* ---------------------------------------------------------
       CTA DENTRO DEL MENÚ
       --------------------------------------------------------- */

    .atlas-navbar__mobile-action {
        display: block;
        margin-top: 10px;
        padding-top: 18px;
        border-top: 1px solid rgba(76, 121, 156, 0.16);
    }

    .atlas-navbar__mobile-cta {
        display: flex;
        width: 100%;
        min-height: 48px;
        align-items: center;
        justify-content: center;
        border-radius: var(--erp-radius-pill);
        box-shadow: 0 10px 24px rgba(35, 69, 88, 0.16);
    }


    /* ---------------------------------------------------------
       APERTURA DEL MENÚ
       --------------------------------------------------------- */

    .atlas-navbar__toggle:checked ~ .atlas-navbar__nav {
        display: flex;
        animation: atlas-navbar-menu-open 220ms ease both;
    }


    /* ---------------------------------------------------------
       ANIMACIÓN DE APERTURA
       --------------------------------------------------------- */

    @keyframes atlas-navbar-menu-open {

        from {
            opacity: 0;
            transform: translateY(-8px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }


    /* ---------------------------------------------------------
       TRANSFORMACIÓN DE HAMBURGUESA A X
       --------------------------------------------------------- */

    .atlas-navbar__toggle:checked + .atlas-navbar__hamburger
    span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .atlas-navbar__toggle:checked + .atlas-navbar__hamburger
    span:nth-child(2) {
        opacity: 0;
    }

    .atlas-navbar__toggle:checked + .atlas-navbar__hamburger
    span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}


/* =========================================================
   CELULARES
   ========================================================= */

@media (max-width: 560px) {

    .atlas-navbar {
        min-height: 76px;
    }

    .atlas-navbar__inner {
        min-height: 76px;
        gap: 12px;
    }

    .atlas-navbar__logo {
        height: 34px;
        max-width: 150px;
    }

    .atlas-navbar__cta {
        min-height: 38px;
        padding-inline: 14px;
        font-size: 0.8rem;
    }

    .atlas-navbar__hamburger {
        width: 38px;
        height: 38px;
    }

    .atlas-navbar__nav {
        top: calc(100% + 10px);
        padding: 18px;
        border-radius: 20px;
    }

    .atlas-navbar__mobile-action {
        margin-top: 8px;
        padding-top: 16px;
    }

    .atlas-navbar__mobile-cta {
        min-height: 48px;
        font-size: 0.9rem;
    }
}


/* =========================================================
   CELULARES PEQUEÑOS
   ========================================================= */

@media (max-width: 420px) {

    /*
       El CTA superior desaparece.
       El CTA continúa disponible dentro del menú hamburguesa.
    */

    .atlas-navbar__actions {
        display: none;
    }

    .atlas-navbar__logo {
        height: 32px;
        max-width: 140px;
    }

    .atlas-navbar__nav {
        padding: 16px;
    }
}


/* =========================================================
   REDUCCIÓN DE MOVIMIENTO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    .atlas-navbar__link,
    .atlas-navbar__link::after,
    .atlas-navbar__cta,
    .atlas-navbar__mobile-cta,
    .atlas-navbar__nav,
    .atlas-navbar__hamburger span {
        animation: none !important;
        transition: none !important;
    }
}
