/* ========================================
   MODERN RESPONSIVE NAVIGATION
   GSY School - Complete Navigation Redesign
   ======================================== */

/* ========== Core Navigation ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #0f1a2e 50%, var(--accent-color) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(245, 183, 26, 0.15);
    z-index: 9999;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar.scrolled {
    height: 70px;
    background: linear-gradient(135deg, rgba(24, 48, 90, 0.98) 0%, rgba(15, 26, 46, 0.98) 100%);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    border-bottom: 2px solid rgba(245, 183, 26, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* ========== Logo ========== */
.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    z-index: 10001;
    flex-shrink: 0;
}

.nav-logo .logo-image {
    width: 55px;
    height: 55px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.navbar.scrolled .nav-logo .logo-image {
    width: 48px;
    height: 48px;
}

.nav-logo:hover .logo-image {
    transform: scale(1.05);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========== Desktop Menu ========== */
.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 5px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
}

.nav-link i {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    color: var(--white);
    background: rgba(245, 183, 26, 0.15);
}

.nav-link:hover i {
    transform: scale(1.15);
}

.nav-link.active {
    color: var(--primary-color);
    background: rgba(245, 183, 26, 0.2);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px;
}

/* Portal Link Special Style */
.nav-link.portal-link {
    background: linear-gradient(135deg, var(--primary-color), #e6a617);
    color: var(--accent-color);
    font-weight: 600;
    padding: 10px 16px;
    box-shadow: 0 4px 15px rgba(245, 183, 26, 0.3);
}

.nav-link.portal-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 183, 26, 0.4);
    background: linear-gradient(135deg, #ffc83d, var(--primary-color));
}

/* ========== Nav Right Section ========== */
.nav-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* ========== Hamburger Menu ========== */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 45px;
    height: 45px;
    padding: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(245, 183, 26, 0.3);
    border-radius: 12px;
    z-index: 10001;
    transition: all 0.3s ease;
}

.hamburger:hover {
    background: rgba(245, 183, 26, 0.2);
    border-color: var(--primary-color);
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--white);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 2.5px 0;
}

.hamburger.active {
    background: rgba(245, 183, 26, 0.3);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
    background: var(--primary-color);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: var(--primary-color);
}

/* ========== Mobile Menu Overlay ========== */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* ========== TABLET STYLES (768px - 992px) ========== */
@media (max-width: 992px) {
    .nav-menu {
        gap: 3px;
    }

    .nav-link {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .nav-link span {
        display: none;
    }

    .nav-link i {
        font-size: 1.1rem;
    }

    /* Tooltip on hover */
    .nav-link::before {
        content: attr(data-tooltip);
        position: absolute;
        bottom: -35px;
        left: 50%;
        transform: translateX(-50%);
        padding: 5px 10px;
        background: rgba(0, 0, 0, 0.9);
        color: white;
        font-size: 0.75rem;
        border-radius: 6px;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 100;
    }

    .nav-link:hover::before {
        opacity: 1;
        visibility: visible;
        bottom: -40px;
    }

    .nav-link.portal-link span {
        display: inline;
    }

    .nav-link.portal-link {
        padding: 8px 14px;
    }
}

/* ========== MOBILE STYLES (< 768px) ========== */
@media (max-width: 768px) {
    .navbar {
        height: 70px;
    }

    .hamburger {
        display: flex !important;
    }

    .nav-center {
        position: fixed;
        top: 0;
        right: -100%;
        width: 85%;
        max-width: 350px;
        height: 100vh;
        background: linear-gradient(180deg,
                rgba(24, 48, 90, 0.99) 0%,
                rgba(15, 26, 46, 0.99) 50%,
                rgba(10, 18, 32, 0.99) 100%);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding: 100px 25px 40px;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 9998;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
        border-left: 1px solid rgba(245, 183, 26, 0.2);
        overflow-y: auto;
    }

    .nav-center.active {
        right: 0;
    }

    .nav-menu {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        width: 100%;
        padding: 0;
    }

    .nav-menu li {
        width: 100%;
        opacity: 0;
        transform: translateX(30px);
        transition: all 0.3s ease;
    }

    .nav-center.active .nav-menu li {
        opacity: 1;
        transform: translateX(0);
    }

    /* Staggered animation for menu items */
    .nav-center.active .nav-menu li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-center.active .nav-menu li:nth-child(2) {
        transition-delay: 0.15s;
    }

    .nav-center.active .nav-menu li:nth-child(3) {
        transition-delay: 0.2s;
    }

    .nav-center.active .nav-menu li:nth-child(4) {
        transition-delay: 0.25s;
    }

    .nav-center.active .nav-menu li:nth-child(5) {
        transition-delay: 0.3s;
    }

    .nav-center.active .nav-menu li:nth-child(6) {
        transition-delay: 0.35s;
    }

    .nav-center.active .nav-menu li:nth-child(7) {
        transition-delay: 0.4s;
    }

    .nav-center.active .nav-menu li:nth-child(8) {
        transition-delay: 0.45s;
    }

    .nav-center.active .nav-menu li:nth-child(9) {
        transition-delay: 0.5s;
    }

    .nav-center.active .nav-menu li:nth-child(10) {
        transition-delay: 0.55s;
    }

    .nav-link {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 16px 20px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 1rem;
        font-weight: 500;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.3s ease;
    }

    .nav-link span {
        display: inline !important;
    }

    .nav-link i {
        width: 24px;
        font-size: 1.1rem;
        color: var(--primary-color);
    }

    .nav-link:hover,
    .nav-link.active {
        background: rgba(245, 183, 26, 0.15);
        border-color: rgba(245, 183, 26, 0.3);
        color: var(--white);
        transform: translateX(5px);
    }

    .nav-link.active::after {
        display: none;
    }

    .nav-link.portal-link {
        margin-top: 15px;
        background: linear-gradient(135deg, var(--primary-color), #e6a617);
        border: none;
        color: var(--accent-color);
        font-weight: 600;
        justify-content: center;
    }

    .nav-link.portal-link i {
        color: var(--accent-color);
    }

    .nav-link.portal-link:hover {
        transform: translateY(-2px);
    }

    /* Mobile Menu Header */
    .nav-center::before {
        content: 'Menu';
        position: absolute;
        top: 30px;
        left: 25px;
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--primary-color);
        letter-spacing: 1px;
    }

    /* Close button in mobile menu */
    .nav-center::after {
        content: '×';
        position: absolute;
        top: 20px;
        right: 25px;
        font-size: 2.5rem;
        color: rgba(255, 255, 255, 0.5);
        cursor: pointer;
        transition: color 0.3s ease;
    }

    /* Hide tooltip on mobile */
    .nav-link::before {
        display: none !important;
    }

    /* Nav overlay for mobile */
    .nav-overlay {
        display: none;
    }

    .nav-overlay.active {
        display: block;
    }

    /* Logo adjustments */
    .nav-logo .logo-image {
        width: 50px;
        height: 50px;
    }

    .logo-text {
        font-size: 1.3rem;
    }
}

/* ========== SMALL MOBILE (< 480px) ========== */
@media (max-width: 480px) {
    .navbar {
        height: 65px;
        padding: 0 10px;
    }

    .nav-container {
        padding: 0 15px;
    }

    .nav-logo .logo-image {
        width: 45px;
        height: 45px;
    }

    .logo-text {
        font-size: 1.2rem;
    }

    .hamburger {
        width: 42px;
        height: 42px;
    }

    .nav-center {
        width: 90%;
        max-width: 320px;
        padding: 90px 20px 30px;
    }

    .nav-link {
        padding: 14px 16px;
        font-size: 0.95rem;
    }

    .nav-center::before {
        font-size: 1.3rem;
        top: 25px;
        left: 20px;
    }

    .nav-center::after {
        top: 15px;
        right: 20px;
        font-size: 2.2rem;
    }
}

/* ========== RTL Support ========== */
[dir="rtl"] .nav-center {
    right: auto;
    left: -100%;
    border-left: none;
    border-right: 1px solid rgba(245, 183, 26, 0.2);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.5);
}

[dir="rtl"] .nav-center.active {
    left: 0;
    right: auto;
}

[dir="rtl"] .nav-menu li {
    transform: translateX(-30px);
}

[dir="rtl"] .nav-center.active .nav-menu li {
    transform: translateX(0);
}

[dir="rtl"] .nav-link:hover,
[dir="rtl"] .nav-link.active {
    transform: translateX(-5px);
}

[dir="rtl"] .nav-center::before {
    left: auto;
    right: 25px;
}

[dir="rtl"] .nav-center::after {
    right: auto;
    left: 25px;
}

/* ========== Body padding for fixed navbar ========== */
body {
    padding-top: 80px;
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 65px;
    }
}

/* ========== Prevent scroll when menu is open ========== */
body.menu-open {
    overflow: hidden;
}

/* ========== Accessibility ========== */
.nav-link:focus,
.hamburger:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.nav-link:focus-visible,
.hamburger:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
}