/* Modern Header Styles */
.main-header {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 20px 0;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo-section {
    display: flex;
    flex-direction: column;
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -1px;
}

.tagline {
    font-size: 0.9rem;
    margin: 4px 0 0;
    opacity: 0.8;
}

/* Main Navigation */
.main-nav {
    display: flex;
    align-items: center;
}

.user-info {
    margin-right: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: block;
    padding: 8px 15px;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Dropdown styles - IMPROVED */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
}

.dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    z-index: 1000;
    margin-top: 8px;
    overflow: hidden;
    transition: opacity 0.2s, transform 0.2s;
}

/* For desktop hover behavior */
@media (min-width: 769px) {
    .dropdown:hover .dropdown-menu {
        display: block;
        animation: fadeInMenu 0.2s ease forwards;
    }
}

@keyframes fadeInMenu {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

/* Logout button */
.logout-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.2s;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    width: 30px;
    height: 30px;
    position: relative;
    cursor: pointer;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
    display: block;
    width: 100%;
    height: 3px;
    background-color: white;
    position: absolute;
    transition: transform 0.3s, opacity 0.3s;
}

.menu-icon {
    top: 50%;
    transform: translateY(-50%);
}

.menu-icon::before {
    content: '';
    top: -8px;
}

.menu-icon::after {
    content: '';
    bottom: -8px;
}

/* Mobile Menu Active State */
.mobile-menu-toggle.active .menu-icon {
    background-color: transparent;
}

.mobile-menu-toggle.active .menu-icon::before {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle.active .menu-icon::after {
    transform: translateY(-8px) rotate(-45deg);
}

/* Fix to prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
}

/* Responsive styles - IMPROVED */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
        z-index: 100;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--primary-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 20px;
        z-index: 90;
        transition: right 0.3s ease;
        overflow-y: auto;
    }

    .main-nav.active {
        right: 0;
    }

    .user-info {
        margin: 0 0 20px;
        padding-bottom: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }

    .nav-list {
        flex-direction: column;
        width: 100%;
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        padding: 12px 0;
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Mobile dropdown behavior */
    .dropdown-menu {
        position: static;
        background: rgba(0, 0, 0, 0.1);
        box-shadow: none;
        margin-top: 0;
        border-radius: 0;
        padding-left: 15px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .dropdown.active .dropdown-menu {
        display: block;
        max-height: 500px; /* Large value to accommodate varying content sizes */
    }

    .dropdown-item {
        color: white;
        padding-left: 20px;
    }

    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .logout-item {
        margin-top: 20px;
    }

    .logout-button {
        width: 100%;
        text-align: left;
        background: rgba(255, 255, 255, 0.2);
    }
}