/* Header and Navigation Styles */
body.menu-open {
    overflow: hidden;
}

header {
    background: var(--gradient);
    color: white;
    border-bottom: 1px solid rgba(143, 143, 143, 0.936);
    padding: 0.8rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    align-items: center;
    gap: 10px;
}

/* Logo Styles */
.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
    cursor: pointer;
}


.logo {
    display: flex;
    border-radius: 5px;
    align-items: center;
    justify-content: center;
}

.logo img {
    width: 60px;
    height: auto;
    border-radius: 8px;
}

.title-container {
    display: flex;
    flex-direction: column;
}

.title-container h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: var(--heading-letter-spacing);
    line-height: 1.2;
    font-family: var(--heading-font);
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Navigation Links */
.nav-container {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 25px;
}

.nav-links a {
    text-decoration: none;
    color: white;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 5px 0;
    position: relative;
    overflow: hidden;
}

.nav-links a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: white;
    transition: all 0.3s ease;
    transform: translateX(-50%);
    opacity: 0;
}

.nav-links a:hover:after {
    width: 100%;
    opacity: 1;
}

/* Enhanced Mobile Menu Button */
.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 101;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.hamburger {
    width: 24px;
    height: 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.hamburger span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: white;
    border-radius: 3px;
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6),
        opacity 0.3s ease,
        width 0.3s ease;
}

/* Improved hamburger animation */
.hamburger span:nth-child(1) {
    width: 100%;
}

.hamburger span:nth-child(2) {
    width: 100%;
}

.hamburger span:nth-child(3) {
    width: 100%;
}

/* Active state for mobile menu button with improved animation */
.mobile-menu-button.active .hamburger span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
    width: 100%;
}

.mobile-menu-button.active .hamburger span:nth-child(2) {
    opacity: 0;
    transform: translateX(-10px);
}

.mobile-menu-button.active .hamburger span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
    width: 100%;
}

/* Responsive Navigation with enhanced animations */
@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
    }

    .mobile-controls {
        display: flex;
    }

    /* Hide desktop auth link */
    #auth-link {
        display: none;
    }

    /* Mobile user avatar styling */
    #mobile-auth-link .user-menu-container {
        position: relative;
    }

    #mobile-auth-link .user-avatar-nav {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    #mobile-auth-link .user-dropdown {
        top: calc(100% + 15px);
        right: -100px;
    }

    #mobile-auth-link .user-dropdown::before {
        right: 110px;
    }

    #mobile-auth-link a {
        color: white;
        text-decoration: none;
        font-weight: 500;
        font-size: 0.9rem;
    }

    .nav-container {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: var(--gradient);
        z-index: 100;
        transition: right 0.5s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
        display: flex;
        justify-content: center;
    }

    .nav-container.active {
        right: 0;
    }

    .nav-links {
        flex-direction: column;
        gap: 20px;
        top: -20px;
        position: relative;
        align-items: center;
        justify-content: center;
    }

    .nav-links li {
        opacity: 0;
        transform: translateX(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
        transition-delay: 0.1s;
    }

    .nav-container.active .nav-links li {
        opacity: 1;
        transform: translateX(0);
    }

    /* Staggered animation for menu items */
    .nav-container.active .nav-links li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-container.active .nav-links li:nth-child(2) {
        transition-delay: 0.2s;
    }

    .nav-container.active .nav-links li:nth-child(3) {
        transition-delay: 0.3s;
    }

    .nav-container.active .nav-links li:nth-child(4) {
        transition-delay: 0.4s;
    }

    .nav-container.active .nav-links li:nth-child(5) {
        transition-delay: 0.5s;
    }

    .nav-container.active .nav-links li:nth-child(6) {
        transition-delay: 0.6s;
    }

    .nav-container.active .nav-links li:nth-child(7) {
        transition-delay: 0.7s;
    }

    .nav-container.active .nav-links li:nth-child(8) {
        transition-delay: 0.8s;
    }

    .nav-container.active .nav-links li:nth-child(9) {
        transition-delay: 0.9s;
    }

    .nav-container.active .nav-links li:nth-child(10) {
        transition-delay: 1s;
    }

    .nav-container.active .nav-links li:nth-child(11) {
        transition-delay: 1.1s;
    }

    .nav-links a {
        font-size: 1.1rem;
        display: block;
        padding: 5px 15px;
    }

    .nav-links a:hover {
        color: #fff;
    }

    .logo img {
        width: 50px;
    }

    .title-container h1 {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .logo img {
        width: 45px;
    }

    .title-container h1 {
        font-size: 1.3rem;
    }

    .tagline {
        font-size: 0.75rem;
    }

    #mobile-auth-link .user-avatar-nav {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    .logo-container {
        gap: 10px;
    }

    .logo img {
        width: 40px;
    }

    .title-container h1 {
        font-size: 1.2rem;
    }

    .tagline {
        font-size: 0.7rem;
    }

    .hamburger {
        width: 22px;
        height: 18px;
    }

    #mobile-auth-link .user-avatar-nav {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
}

/* Dropdown menu styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown .dropbtn {
    font-size: 16px;
    border: none;
    outline: none;
    color: white;
    padding: 1px 0;
    background-color: transparent;
    font-family: inherit;
    margin: 0;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.dropdown .dropbtn i {
    margin-left: 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 101;
    border-radius: 4px;
    top: 100%;
    left: 0;
    margin-top: 1px;
}

.dropdown-content a {
    color: #333 !important;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

/* Only show dropdown on hover for desktop */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-content {
        display: block;
    }
}

/* Mobile dropdown adjustments */
@media (max-width: 768px) {
    .dropdown {
        width: 100%;
    }

    .dropdown .dropbtn {
        width: 100%;
        text-align: center;
        padding: 10px 0;
        justify-content: center;
        color: white;

    }

    .dropdown-content {
        position: static;
        width: 100%;
        box-shadow: none;
        background-color: rgba(255, 255, 255, 0.05);
        margin-top: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        display: block;
    }

    .dropdown-content a {
        color: white !important;
        text-align: center;
        padding: 12px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 0.95rem;
    }

    .dropdown-content a:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .dropdown.active .dropdown-content {
        max-height: 300px;
    }

    .dropdown.active .dropbtn i {
        transform: rotate(180deg);
    }

    /* Ensure dropdowns are properly styled in mobile menu */
    .nav-container.active .dropdown {
        width: 100%;
    }

    .nav-container.active .dropdown .dropbtn {
        width: 100%;
        text-align: left;
        padding: 15px 0;
    }

    .nav-container.active .dropdown-content {
        position: static;
        background-color: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        border-radius: 0;
        margin-top: 0;
    }
}