/* ============================================================
   NAVBAR REDQ — Diseño Profesional & Responsivo
   Paleta: --azul-marino #003d5b | --verde-institucional #108c35
   ============================================================ */

/* ── Franja Superior ── */
.top-accent-bar {
    height: 4px;
    background: linear-gradient(90deg,
        var(--verde-institucional) 0%,
        #0db33f 40%,
        var(--azul-marino) 100%);
    background-size: 200% 100%;
    animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── Barra de contexto superior ── */
.nav-topbar {
    background-color: #002233;
    height: 36px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
}

.nav-topbar .topbar-info {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-topbar .topbar-info i {
    color: var(--verde-institucional);
    font-size: 0.75rem;
}

.nav-topbar .topbar-social {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-topbar .topbar-social a {
    color: rgba(255,255,255,0.45);
    font-size: 0.82rem;
    text-decoration: none;
    transition: color 0.25s ease, transform 0.25s ease;
    display: inline-flex;
}

.nav-topbar .topbar-social a:hover {
    color: var(--verde-institucional);
    transform: translateY(-2px);
}

/* ── Navbar Principal ── */
.navbar-redq {
    background-color: var(--azul-marino);
    background-image: linear-gradient(180deg, #004d73 0%, var(--azul-marino) 100%);
    padding: 0.9rem 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    transition: padding 0.35s ease, background-color 0.35s ease, box-shadow 0.35s ease;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-redq.scrolled {
    padding: 0.45rem 0;
    background-image: none;
    background-color: rgba(0, 30, 48, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.45);
}

/* ── Logo ── */
.navbar-redq .navbar-brand {
    padding: 4px 6px;
    margin-right: 0;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    border-radius: 8px;
}

.navbar-redq .navbar-brand img {
    max-height: 68px;
    width: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.35));
    transition: max-height 0.35s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
}

.navbar-redq.scrolled .navbar-brand img {
    max-height: 48px;
}

.navbar-redq .navbar-brand:hover img {
    transform: scale(1.06);
}

/* Efecto de brillo deslizante en el logo */
.navbar-redq .navbar-brand::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -75%;
    width: 35%;
    height: 200%;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(255,255,255,0.25) 50%,
        transparent 70%
    );
    transform: rotate(25deg);
    animation: logoShine 5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes logoShine {
    0%, 70%  { left: -75%; }
    85%      { left: 130%; }
    100%     { left: 130%; }
}

/* ── Links de navegación ── */
.navbar-redq .nav-link {
    color: rgba(255,255,255,0.82) !important;
    font-weight: 500;
    font-size: 0.88rem;
    letter-spacing: 0.02em;
    padding: 0.55rem 1.1rem !important;
    margin: 0 2px;
    border-radius: 8px;
    position: relative;
    transition: color 0.25s ease, background 0.25s ease;
    text-transform: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.navbar-redq .nav-link i {
    font-size: 0.85rem;
    opacity: 0.75;
    transition: opacity 0.25s ease, transform 0.3s ease;
}

/* Línea inferior animada */
.navbar-redq .nav-link::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--verde-institucional);
    border-radius: 2px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-redq .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.06);
}

.navbar-redq .nav-link:hover::before,
.navbar-redq .nav-link.active::before {
    width: 55%;
}

.navbar-redq .nav-link:hover i {
    opacity: 1;
    transform: translateY(-1px);
}

.navbar-redq .nav-link.active {
    color: #fff !important;
    background: rgba(16,140,53,0.15);
}

/* ── Dropdown Toggle flecha animada ── */
.navbar-redq .dropdown-toggle::after {
    border: none;
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.65rem;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.navbar-redq .dropdown.show > .dropdown-toggle::after {
    transform: rotate(180deg);
    opacity: 1;
}

/* ── Dropdown Menú ── */
.navbar-redq .dropdown-menu {
    background: #fff;
    border: none;
    border-top: 3px solid var(--verde-institucional);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.08);
    padding: 8px;
    min-width: 230px;
    margin-top: 0 !important;

    /* Animación de entrada */
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition:
        opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.25s;
    display: block !important; /* Evita el toggle de Bootstrap para controlar con CSS */
    pointer-events: none;
}

.navbar-redq .dropdown:hover > .dropdown-menu,
.navbar-redq .dropdown.show > .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

/* Items del dropdown */
.navbar-redq .dropdown-item {
    color: #2d3748;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 2px;
    border: none;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;

    /* Stagger de aparición */
    opacity: 0;
    transform: translateX(-6px);
    transition:
        background 0.2s ease,
        color 0.2s ease,
        padding-left 0.2s ease,
        opacity 0.2s ease,
        transform 0.2s ease;
}

.navbar-redq .dropdown:hover .dropdown-item,
.navbar-redq .dropdown.show .dropdown-item {
    opacity: 1;
    transform: translateX(0);
}

/* Delays escalonados */
.navbar-redq .dropdown-item:nth-child(1) { transition-delay: 0.04s; }
.navbar-redq .dropdown-item:nth-child(2) { transition-delay: 0.08s; }
.navbar-redq .dropdown-item:nth-child(3) { transition-delay: 0.12s; }
.navbar-redq .dropdown-item:nth-child(4) { transition-delay: 0.16s; }
.navbar-redq .dropdown-item:nth-child(5) { transition-delay: 0.20s; }

.navbar-redq .dropdown-item i {
    color: var(--azul-marino);
    font-size: 0.85rem;
    width: 18px;
    text-align: center;
    opacity: 0.65;
    transition: opacity 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.navbar-redq .dropdown-item:hover {
    background: #f0faf4;
    color: var(--verde-institucional);
    padding-left: 20px;
}

.navbar-redq .dropdown-item:hover i {
    color: var(--verde-institucional);
    opacity: 1;
}

.navbar-redq .dropdown-divider {
    border-color: #f0f0f0;
    margin: 4px 8px;
    opacity: 1;
}

/* ── Botón Funcionarios (CTA destacado) ── */
.navbar-redq .nav-btn-cta {
    color: #fff !important;
    background: rgba(16,140,53,0.85);
    border: 1px solid rgba(16,140,53,0.5);
    border-radius: 8px;
    padding: 0.5rem 1.1rem !important;
    margin-left: 8px !important;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(16,140,53,0.25);
    transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.navbar-redq .nav-btn-cta:hover {
    background: var(--verde-institucional) !important;
    box-shadow: 0 6px 20px rgba(16,140,53,0.45);
    transform: translateY(-2px);
    color: #fff !important;
}

.navbar-redq .nav-btn-cta::before {
    display: none; /* Sin línea subrayada en el CTA */
}

/* ── Toggler (Hamburguesa) ── */
.navbar-redq .navbar-toggler {
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 7px 10px;
    background: rgba(255,255,255,0.06);
    transition: background 0.25s ease;
    box-shadow: none;
}

.navbar-redq .navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(16,140,53,0.35);
}

.navbar-redq .navbar-toggler:hover {
    background: rgba(255,255,255,0.12);
}

/* Las 3 líneas del hamburger con animación a X */
.nav-toggler-icon {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 22px;
}

.nav-toggler-icon span {
    display: block;
    height: 2px;
    width: 100%;
    background: #fff;
    border-radius: 2px;
    transform-origin: center;
    transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
}

/* Animación a X cuando el menú está abierto */
.navbar-toggler[aria-expanded="true"] .nav-toggler-icon span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.navbar-toggler[aria-expanded="true"] .nav-toggler-icon span:nth-child(2) {
    opacity: 0;
    width: 0;
}
.navbar-toggler[aria-expanded="true"] .nav-toggler-icon span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ══════════════════════════════════
   RESPONSIVE — Mobile (< 992px)
   ══════════════════════════════════ */
@media (max-width: 991.98px) {

    .nav-topbar .topbar-info {
        display: none; /* Solo iconos sociales en móvil */
    }

    .navbar-redq {
        padding: 0.7rem 0;
    }

    .navbar-redq .navbar-brand img {
        max-height: 52px;
    }

    .navbar-redq.scrolled .navbar-brand img {
        max-height: 44px;
    }

    /* Menú colapsado: panel completo */
    .navbar-redq .navbar-collapse {
        background: #002d44;
        border-radius: 14px;
        margin-top: 12px;
        padding: 12px;
        box-shadow: 0 12px 30px rgba(0,0,0,0.35);

        /* Animación de apertura */
        animation: mobileMenuIn 0.3s ease-out forwards;
    }

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

    .navbar-redq .nav-link {
        padding: 0.7rem 1rem !important;
        margin: 2px 0;
        border-radius: 8px;
        font-size: 0.9rem;
    }

    .navbar-redq .nav-link::before {
        display: none;
    }

    .navbar-redq .nav-link:hover,
    .navbar-redq .nav-link.active {
        background: rgba(16,140,53,0.15);
    }

    /* Dropdown en móvil: panel interno */
    .navbar-redq .dropdown-menu {
        background: rgba(0,20,32,0.6);
        border-top: 2px solid var(--verde-institucional);
        border-radius: 10px;
        box-shadow: none;
        margin: 6px 0 6px 10px !important;
        padding: 6px;
        position: static !important;
        float: none;
        min-width: unset;
        opacity: 1 !important;
        transform: none !important;
        visibility: visible !important;
        pointer-events: auto !important;
        display: none !important;
    }

    .navbar-redq .dropdown-menu.show {
        display: block !important;
    }

    .navbar-redq .dropdown-item {
        color: rgba(255,255,255,0.8);
        opacity: 1;
        transform: none;
        transition-delay: 0s;
        font-size: 0.875rem;
        padding: 9px 12px;
    }

    .navbar-redq .dropdown-item:hover {
        background: rgba(16,140,53,0.2);
        color: #fff;
        padding-left: 18px;
    }

    .navbar-redq .dropdown-item i {
        color: var(--verde-institucional);
        opacity: 0.9;
    }

    .navbar-redq .dropdown-divider {
        border-color: rgba(255,255,255,0.1);
    }

    .navbar-redq .nav-btn-cta {
        margin-left: 0 !important;
        margin-top: 6px;
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .nav-topbar {
        height: 30px;
    }

    .navbar-redq .navbar-brand img {
        max-height: 44px;
    }
}
