/* Navbar Styles */
.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 70px;
    will-change: background-position;
}

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

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.nav-brand {
    font-size: 1.4em;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
    z-index: 1001;
}

.nav-brand a {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-brand:hover {
    transform: translateY(-2px);
    text-shadow: 0 4px 15px rgba(255, 255, 255, 0.4);
}


.nav-logo {
    height: 38px;
    width: auto;
    filter: brightness(0) saturate(100%) invert(100%) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: transform 0.3s ease, filter 0.3s ease;
    display: block;
}

.nav-brand:hover .nav-logo {
    transform: scale(1.1);
    filter: brightness(0) saturate(100%) invert(100%) drop-shadow(0 4px 8px rgba(255, 255, 255, 0.3));
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1002;
    transition: transform 0.3s ease;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
}

.hamburger-line {
    display: block;
    height: 3px;
    width: 100%;
    background: white;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform-origin: center;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.2rem;
    border-radius: 25px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: transform 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    will-change: transform;
    transform: translateX(-100%);
}

.nav-menu a:hover::before {
    transform: translateX(100%);
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    font-weight: 500;
}

#navbar-user-name {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

.logout-btn:hover {
    background: linear-gradient(135deg, #ee5a24, #ff6b6b);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
}

/* Responsive navbar */
@media (max-width: 1024px) {
    .navbar {
        padding: 1rem 1.5rem;
    }

    .nav-menu a {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }

    .nav-brand {
        font-size: 1.3rem;
    }

    .nav-icon {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 1rem 1.5rem;
        flex-wrap: nowrap;
        position: relative;
    }

    .nav-icon {
        display: inline;
    }

    .mobile-menu-toggle {
        display: flex;
        order: 2;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        padding: 0.5rem;
        /* Add padding around container */
        margin: 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(20px);
        border-radius: 0 0 12px 12px;
        z-index: 1001;
        overflow: visible;
        align-items: stretch;
        /* Force full width */
        gap: 0.5rem;
        /* Space between items */
    }

    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-menu a {
        padding: 0.8rem 1.2rem;
        /* Comfortable padding */
        margin: 0;
        border-radius: 8px;
        /* Rounded corners for buttons */
        border: 1px solid transparent;
        /* Prepare for border */
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        width: auto;
        /* Let flex stretch handle it */
        justify-content: flex-start;
        /* Left align content */
        gap: 0.8rem;
        font-size: 1rem;
        color: #333;
        font-weight: 500;
        text-decoration: none;
        background: transparent;
        flex-shrink: 0;
    }

    .nav-menu a:first-child {
        padding-top: 0.8rem;
        /* Reset extra padding */
    }

    .nav-menu a:last-child {
        border-bottom: 1px solid transparent;
        /* Reset border */
    }

    .nav-menu a:hover {
        background: rgba(102, 126, 234, 0.08);
        color: #667eea;
    }

    .nav-menu a.active {
        background: rgba(102, 126, 234, 0.12);
        color: #667eea;
        font-weight: 600;
    }

    .user-info {
        order: 3;
        position: static;
        display: none;
        flex-direction: column;
        gap: 0.8rem;
        align-items: stretch;
        /* Full width items */
        padding: 0.8rem;
        background: rgba(248, 249, 250, 0.5);
        /* Lighter background */
        border-top: 1px solid rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        margin-top: 0.5rem;
    }

    .nav-menu.active .user-info {
        display: flex;
    }

    .nav-brand {
        order: 1;
        font-size: 1.2rem;
    }


    #navbar-user-name {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        text-align: center;
        width: 100%;
        /* Full width */
        color: #666;
        background: rgba(255, 255, 255, 0.8);
        border-radius: 8px;
        border: 1px solid rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
        /* Include padding in width */
    }

    .logout-btn {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
        width: 100%;
        /* Full width */
        text-align: center;
        background: #667eea;
        color: white;
        border: none;
        border-radius: 8px;
        font-weight: 500;
        transition: all 0.2s ease;
    }

    .logout-btn:hover {
        background: #5a6fd8;
        transform: translateY(-1px);
        box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 1rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-logo {
        height: 28px;
    }

    .nav-menu a {
        padding: 1.2rem 1.5rem;
        font-size: 1rem;
    }

    .user-info {
        padding: 1rem 1.5rem;
    }

    #navbar-user-name {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    .logout-btn {
        padding: 0.5rem 1.2rem;
        font-size: 0.85rem;
    }
}

/* Mobile menu overlay */
@media (max-width: 768px) {
    .navbar.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.2);
        z-index: 999;
        opacity: 0;
        animation: fadeIn 0.3s ease forwards;
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}