/**
 * Tabora Boys Secondary School - Navbar Styles
 * Features: Glassmorphism, Mega Menu with Typing Animation, Mobile Drawer
 * Palette: Khaki + Gold
 */

/* ===== FLOATING NAVBAR ===== */
.navbar-wrapper {
    position: fixed;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 92%;
    max-width: 1400px;
    z-index: 1000;
    background: var(--khaki-glass);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    padding: 12px 35px;
    box-shadow: 0 8px 32px rgba(61, 46, 24, 0.35);
    transition: var(--transition-smooth);
}

.navbar-wrapper.scrolled {
    top: 0;
    width: 100%;
    border-radius: 0;
    background: rgba(61, 46, 24, 0.97);
    padding: 10px 60px;
    box-shadow: 0 4px 30px rgba(61, 46, 24, 0.5), 0 2px 0 rgba(212, 160, 23, 0.35);
    border-bottom: 2px solid var(--gold-primary);
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== LOGO ===== */
.navbar-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-glow-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.nav-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    transition: var(--transition-smooth);
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.3));
}

.navbar-brand:hover .nav-logo {
    transform: scale(1.05) rotate(-2deg);
    filter: drop-shadow(0 0 10px rgba(212, 160, 23, 0.6));
}

.brand-text {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--white);
    letter-spacing: 1.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    margin-left: 10px;
}

/* ===== DESKTOP NAV LINKS ===== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
}

.nav-link {
    color: var(--white);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 8px 4px;
    transition: var(--transition-smooth);
    opacity: 0.9;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--gold-soft);
    opacity: 1;
    text-shadow: 0 0 8px rgba(243, 201, 77, 0.5);
}

/* Glowing underline effect */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-primary), var(--gold-soft));
    box-shadow: 0 0 8px var(--gold-primary);
    transition: var(--transition-smooth);
    transform: translateX(-50%);
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

/* Nav item with mega menu */
.nav-item.has-mega {
    position: relative;
}

.nav-item.has-mega .mega-trigger {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.nav-item.has-mega .mega-trigger i {
    font-size: 0.75rem;
    transition: var(--transition-smooth);
}

.nav-item.has-mega:hover .mega-trigger i,
.nav-item.has-mega.active .mega-trigger i {
    transform: rotate(180deg);
    color: var(--gold-soft);
}

/* ===== MEGA MENU PANELS ===== */
.mega-panels-wrapper {
    position: fixed;
    top: 85px;
    left: 0;
    width: 100%;
    z-index: 999;
    pointer-events: none;
}

.navbar-wrapper.scrolled ~ .mega-panels-wrapper {
    top: 60px;
}

.mega-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(61, 46, 24, 0.97);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 2px solid rgba(212, 160, 23, 0.3);
    box-shadow: 0 20px 60px rgba(61, 46, 24, 0.5);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1),
                opacity 0.4s ease,
                padding 0.4s ease;
}

.mega-panel.active {
    max-height: 400px;
    opacity: 1;
    pointer-events: auto;
    padding: 50px 0;
}

.mega-panel-inner {
    display: flex;
    gap: 60px;
    align-items: flex-start;
}

.mega-col {
    flex: 1;
}

.mega-col-desc {
    flex: 0 0 350px;
    display: flex;
    align-items: center;
}

.mega-col-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--gold-primary);
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(212, 160, 23, 0.2);
}

/* Mega links with typing animation */
.mega-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mega-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: 1.05rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.mega-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: rgba(212, 160, 23, 0.1);
    border-radius: 12px;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.mega-link:hover::before {
    width: 100%;
}

.mega-link:hover {
    color: var(--gold-soft);
}

.mega-link-text {
    position: relative;
    z-index: 2;
    min-height: 1.3em;
    display: inline-block;
}

/* Typing cursor blink */
.mega-link-text.typing::after {
    content: '|';
    animation: cursorBlink 0.6s infinite;
    color: var(--gold-primary);
    margin-left: 2px;
    font-weight: 300;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.mega-link-arrow {
    position: relative;
    z-index: 2;
    font-size: 0.75rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: var(--transition-smooth);
    color: var(--gold-primary);
}

.mega-link:hover .mega-link-arrow {
    opacity: 1;
    transform: translateX(0);
}

.mega-description {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    line-height: 1.7;
    font-style: italic;
    border-left: 3px solid var(--gold-primary);
    padding-left: 20px;
}

/* ===== CTA BUTTON ===== */
.btn-nav-glass {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-deep, #b8860b));
    color: var(--white);
    padding: 10px 24px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--transition-smooth);
    border: 1px solid var(--gold-primary);
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.2);
    display: inline-block;
}

.btn-nav-glass:hover {
    background: transparent;
    border-color: var(--gold-soft);
    color: var(--gold-soft);
    box-shadow: 0 0 15px rgba(243, 201, 77, 0.5);
    transform: translateY(-2px);
}

/* ===== MOBILE TOGGLE ===== */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--white);
    margin: 5px 0;
    border-radius: 3px;
    transition: var(--transition-smooth);
}

/* ===== MOBILE DRAWER ===== */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 46, 24, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.drawer-overlay.show {
    opacity: 1;
    visibility: visible;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 340px;
    max-width: 85%;
    height: 100%;
    background: rgba(61, 46, 24, 0.98);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-left: 1px solid rgba(212, 160, 23, 0.2);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-drawer.open {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.6rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}

.drawer-close:hover {
    color: var(--gold-soft);
    background: rgba(212, 160, 23, 0.1);
    transform: rotate(90deg);
}

.drawer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-link {
    color: var(--white);
    text-decoration: none;
    font-size: 1.15rem;
    font-weight: 700;
    padding: 10px 0;
    display: block;
    transition: var(--transition-smooth);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.drawer-link:hover, .drawer-link.active {
    color: var(--gold-soft);
    padding-left: 8px;
}

/* Mobile Accordions */
.drawer-dropdown {
    width: 100%;
}

.drawer-dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.drawer-dropdown-toggle .drawer-link {
    border-bottom: none;
    flex-grow: 1;
}

.drawer-dropdown-toggle i {
    color: rgba(255, 255, 255, 0.6);
    transition: transform 0.3s ease;
    padding: 10px;
}

.drawer-dropdown.active .drawer-dropdown-toggle i {
    color: var(--gold-soft);
}

.drawer-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.25, 1, 0.5, 1);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding-left: 15px;
}

.drawer-sublink {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.98rem;
    font-weight: 500;
    padding: 10px 0;
    display: block;
    transition: var(--transition-smooth);
}

.drawer-sublink:hover {
    color: var(--gold-soft);
    padding-left: 8px;
}

.drawer-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-drawer-cta {
    background: var(--gold-primary);
    color: var(--khaki-dark, #3D2E18);
    padding: 12px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    display: block;
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.3);
    transition: var(--transition-smooth);
}

.btn-drawer-cta:hover {
    background: var(--gold-soft);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .navbar-wrapper {
        padding: 10px 25px;
    }
    .nav-links {
        gap: 15px;
    }
    .nav-link {
        font-size: 0.88rem;
    }
}

@media (max-width: 992px) {
    .nav-links {
        display: none;
    }
    .mobile-toggle {
        display: flex;
        flex-direction: column;
    }
    .btn-nav-glass {
        display: none;
    }
    .mega-panels-wrapper {
        display: none;
    }
}
