/**
 * ARCHIVO    : navbar_active.css
 * UBICACIÓN  : assets/css/navbar_active.css
 * DESCRIPCIÓN: Estilos del enlace activo en la barra de navegación.
 *
 * IMPORTANTE: El navbar.php debe usar is_active() que retorna
 * 'ca-nav-active' (no 'active') para que esto funcione.
 *
 * AUTOR      : ERenovar SAS ®
 */

/* ─────────────────────────────────────────────────────────────────
   VARIABLES
   ───────────────────────────────────────────────────────────────── */
:root {
    --color-primary:       #ff6600;
    --color-primary-light: #ff8533;
    --color-primary-dark:  #cc5200;
    --transition-normal:   0.3s ease;
}

/* ─────────────────────────────────────────────────────────────────
   ENLACE ACTIVO — estado base
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .nav-link-ca.ca-nav-active {
    color: var(--color-primary) !important;
    font-weight: 700;
    position: relative;
}

/* Línea decorativa debajo */
.navbar-custom .nav-link-ca.ca-nav-active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    opacity: 1;
    transition: all var(--transition-normal);
}

/* Hover sobre enlace activo */
.navbar-custom .nav-link-ca.ca-nav-active:hover {
    color: var(--color-primary-dark) !important;
    text-shadow: 0 0 10px rgba(255, 102, 0, 0.3);
}

/* ─────────────────────────────────────────────────────────────────
   DROPDOWN TOGGLE ACTIVO
   Solo cuando PHP lo marcó explícitamente (programas.php, legal.php).
   La clase ca-nav-active la pone is_active() en navbar.php.
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .nav-link-ca.dropdown-toggle.ca-nav-active {
    color: var(--color-primary) !important;
    font-weight: 700;
}

/* Flecha del dropdown activo */
.navbar-custom .nav-link-ca.dropdown-toggle.ca-nav-active::after {
    border-color: var(--color-primary);
    opacity: 1;
}

/* Línea decorativa en dropdown activo */
.navbar-custom .nav-link-ca.dropdown-toggle.ca-nav-active::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 3px;
    background: var(--color-primary);
    border-radius: 2px;
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────
   ANULAR Bootstrap — cuando pone 'active' sin que PHP lo haya
   marcado con ca-nav-active, forzar color blanco normal.
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .dropdown-toggle.active:not(.ca-nav-active),
.navbar-custom .nav-link.active:not(.ca-nav-active) {
    color: white !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

/* Anular subrayado que Bootstrap pueda agregar */
.navbar-custom .dropdown-toggle.active:not(.ca-nav-active)::before,
.navbar-custom .dropdown-toggle.active:not(.ca-nav-active)::after,
.navbar-custom .nav-link.active:not(.ca-nav-active)::before,
.navbar-custom .nav-link.active:not(.ca-nav-active)::after {
    width: 0 !important;
    opacity: 0 !important;
    display: none !important;
}

/* ─────────────────────────────────────────────────────────────────
   DROPDOWN ITEMS ACTIVOS
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .dropdown-menu {
    border: 1px solid rgba(255, 102, 0, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    animation: caDropdownSlideIn 0.3s ease;
    /* z-index alto para que en móvil quede encima del contenido */
    z-index: 1050;
    /* Evitar que el scroll del dedo cierre el dropdown */
    touch-action: auto;
}

.navbar-custom .dropdown-menu .dropdown-item {
    color: #666;
    transition: all var(--transition-normal);
    border-left: 4px solid transparent;
    padding-left: 1rem;
}

.navbar-custom .dropdown-menu .dropdown-item:hover {
    background-color: rgba(255, 102, 0, 0.08);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    transform: translateX(4px);
}

/* ─────────────────────────────────────────────────────────────────
   BOTÓN CTA
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .btn-cta.ca-nav-active {
    background: var(--color-primary-dark) !important;
    border-color: var(--color-primary-dark) !important;
    box-shadow: 0 6px 20px rgba(204, 82, 0, 0.4);
}

/* ─────────────────────────────────────────────────────────────────
   ANIMACIONES
   ───────────────────────────────────────────────────────────────── */
@keyframes caDropdownSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes caNavLinkActive {
    from { transform: translateY(-2px); opacity: 0.8; }
    to   { transform: translateY(0);    opacity: 1; }
}

.navbar-custom .nav-link-ca.ca-nav-active {
    animation: caNavLinkActive 0.5s ease-out;
}

/* ─────────────────────────────────────────────────────────────────
   ACCESIBILIDAD
   ───────────────────────────────────────────────────────────────── */
.navbar-custom .nav-link-ca:focus-visible,
.navbar-custom .dropdown-item:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────
   TEMA OSCURO
   ───────────────────────────────────────────────────────────────── */
[data-theme="dark"] .navbar-custom .nav-link-ca.ca-nav-active {
    color: #ff8533 !important;
    text-shadow: 0 0 10px rgba(255, 133, 51, 0.4);
}

[data-theme="dark"] .navbar-custom .dropdown-menu {
    background-color: #2d2d44;
    border-color: rgba(255, 102, 0, 0.3);
}

[data-theme="dark"] .navbar-custom .dropdown-menu .dropdown-item {
    color: #cbd5e0;
}

[data-theme="dark"] .navbar-custom .dropdown-menu .dropdown-item:hover {
    background-color: rgba(255, 102, 0, 0.15);
    color: #ff8533;
}

/* ─────────────────────────────────────────────────────────────────
   MOBILE (< 992px)
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
    .navbar-custom .navbar-collapse.show {
        background: rgba(26, 26, 26, 0.98);
        backdrop-filter: blur(10px);
        padding: 1rem 0;
    }

    .navbar-custom .nav-link-ca.ca-nav-active {
        background: rgba(255, 102, 0, 0.1);
        padding: 0.75rem 1rem;
        border-radius: 8px;
        margin: 0.25rem;
    }

    /* Sin línea decorativa en mobile */
    .navbar-custom .nav-link-ca.ca-nav-active::after,
    .navbar-custom .nav-link-ca.ca-nav-active::before,
    .navbar-custom .nav-link-ca.dropdown-toggle.ca-nav-active::before {
        display: none;
    }

    .navbar-custom .dropdown-menu .dropdown-item {
        padding: 0.75rem 1.5rem;
        border-left: none;
        border-top: 1px solid rgba(255, 102, 0, 0.1);
    }

    .navbar-custom .dropdown-menu .dropdown-item:hover {
        border-left-color: transparent;
        padding-left: 1.5rem;
    }
}

/* ─────────────────────────────────────────────────────────────────
   TABLETS (768px – 991px)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 991px) {
    .navbar-custom .nav-link-ca.ca-nav-active {
        font-size: 0.95rem;
    }

    .navbar-custom .dropdown-menu {
        min-width: 220px;
    }

    .navbar-custom .dropdown-menu .dropdown-item {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

/* ─────────────────────────────────────────────────────────────────
   TABLETS GRANDES (992px – 1199px)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 992px) and (max-width: 1199px) {
    .navbar-custom .nav-link-ca.ca-nav-active::after {
        width: 70%;
    }

    .navbar-custom .nav-link-ca.dropdown-toggle.ca-nav-active::before {
        width: 70%;
    }
}

/* ─────────────────────────────────────────────────────────────────
   PANTALLAS GRANDES (1200px+)
   ───────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
    .navbar-custom .nav-link-ca.ca-nav-active {
        text-shadow: 0 0 15px rgba(255, 102, 0, 0.2);
    }

    .navbar-custom .nav-link-ca.ca-nav-active::after {
        width: 90%;
        height: 4px;
    }
}

/* ─────────────────────────────────────────────────────────────────
   FIN — navbar_active.css v2.0 DEFINITIVO
   ───────────────────────────────────────────────────────────────── */