/* Header Architecture - Premium Glassmorphism System */
/* Final Structure Implementation */

/* ==============================================
   HEADER FIXES - STICKY & PROPORTIONS
   ============================================== */

/* Sticky header fix */
.header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transform: translateZ(0); /* GPU acceleration */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(0, 119, 182, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add body padding to prevent content overlap */
body {
    padding-top: 60px;
}

/* Better proportions */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    padding: 0 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.header-nav {
    display: flex;
    justify-content: center;
    flex: 1;
}

.header-menu {
    display: flex !important;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-direction: row !important;
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: row;
}

/* ==============================================
   DROPDOWN MENU ARCHITECTURE
   ============================================== */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding: 0.75rem 1.25rem;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    color: #374151;
    transition: all 0.3s ease;
}

.dropdown-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 0.5rem;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

/* Premium Glassmorphism Dropdown */
.dropdown-menu {
    position: absolute !important;
    top: calc(100% + 0.2rem);
    left: 0;
    min-width: 240px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(0, 119, 182, 0.15);
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0 !important;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none !important;
    z-index: 1001;
    overflow: hidden;
    display: block !important;
}

/* Fix hover area - add invisible padding */
.dropdown::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: -10px;
    z-index: -1;
    pointer-events: auto;
}

.dropdown:hover .dropdown-menu {
    opacity: 1 !important;
    transform: translateY(0);
    pointer-events: auto !important;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 1px solid rgba(0, 119, 182, 0.08);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    color: var(--primary);
    background: rgba(0, 119, 182, 0.05);
    transform: translateX(3px);
}

/* Remove the vertical line animation */

/* ==============================================
   MENU ITEMS STYLING
   ============================================== */

.menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: #374151;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    min-height: 48px;
    box-sizing: border-box;
}

.menu-link:hover {
    color: var(--primary);
    background: rgba(0, 119, 182, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ==============================================
   USER DROPDOWN ARCHITECTURE
   ============================================== */

.user-dropdown {
    min-width: 300px;
    right: 0;
    left: auto;
}

.user-info {
    padding: 1.25rem 1.5rem;
    background: rgba(0, 119, 182, 0.05);
    border-bottom: 1px solid rgba(0, 119, 182, 0.1);
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.user-email {
    font-size: 0.95rem;
    color: #64748b;
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 119, 182, 0.1);
    margin: 0;
}

.logout-item {
    color: #dc2626 !important;
    border-top: 1px solid rgba(220, 38, 38, 0.1);
    background: rgba(220, 38, 38, 0.02);
}

.logout-item:hover {
    background: rgba(220, 38, 38, 0.1) !important;
    color: #dc2626 !important;
}

/* ==============================================
   AVATAR ARCHITECTURE
   ============================================== */

.header-user {
    margin-left: auto;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 119, 182, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 119, 182, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-avatar:hover {
    background: rgba(0, 119, 182, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.3);
}

.username {
    font-size: 0.9rem;
    font-weight: 500;
    color: #1e293b;
}

/* ==============================================
   MOBILE MENU ARCHITECTURE
   ============================================== */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 30px;
    height: 30px;
    position: relative;
    padding: 0;
    z-index: 1002;
}

.mobile-menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--primary);
    margin: 5px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

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

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

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

/* ==============================================
   ENHANCED NAVIGATION STYLES
   ============================================== */

.header-menu a {
    position: relative;
    overflow: hidden;
}

.header-menu a::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.header-menu a:hover::before {
    left: 100%;
}

/* Active page indicator */
.header-menu a.active {
    color: var(--primary);
    background: rgba(0, 119, 182, 0.1);
    box-shadow: 0 2px 8px rgba(0, 119, 182, 0.2);
}

.header-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* ==============================================
   RESPONSIVE ARCHITECTURE
   ============================================== */

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-nav {
        display: none !important;
    }
    
    .header-user {
        display: none !important;
    }
    
    .header-menu {
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px);
        border-bottom: 1px solid rgba(0, 119, 182, 0.15);
        flex-direction: column;
        gap: 0;
        padding: 0;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none;
        z-index: 1000;
    }
    
    .header-menu.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    
    .header-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 119, 182, 0.1);
    }
    
    .header-menu a {
        padding: 1rem 2rem;
        display: block;
        border-radius: 0;
        background: transparent;
        border: none;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        box-shadow: none;
        border: none;
        backdrop-filter: none;
        background: rgba(0, 119, 182, 0.02);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .dropdown:hover .dropdown-menu,
    .dropdown.active .dropdown-menu {
        max-height: 300px;
    }
    
    .dropdown-item {
        padding: 0.75rem 3rem;
        font-size: 0.85rem;
    }
    
    .user-dropdown {
        min-width: auto;
        right: auto;
        left: 0;
    }
}

/* ==============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================== */

/* GPU acceleration for smooth animations */
.dropdown-menu,
.header-menu a,
.mobile-menu-toggle span {
    will-change: transform, opacity;
}

/* ==============================================
   НЕАВТОРИЗОВАННЫЙ РЕЖИМ
   ============================================== */

.header-auth {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.auth-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.login-btn {
    color: #0077b6;
    background: rgba(0, 119, 182, 0.1);
    border-color: rgba(0, 119, 182, 0.2);
}

.login-btn:hover {
    background: rgba(0, 119, 182, 0.15);
    border-color: rgba(0, 119, 182, 0.3);
    transform: translateY(-2px);
}

.register-btn {
    color: #ffffff;
    background: linear-gradient(135deg, #0077b6 0%, #023e8a 100%);
    box-shadow: 0 4px 15px rgba(0, 119, 182, 0.3);
}

.register-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 119, 182, 0.4);
}

/* Mobile Auth */
.mobile-auth-section {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-auth-btn {
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 500;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.mobile-login-btn {
    color: #0077b6;
    background: rgba(0, 119, 182, 0.1);
    border: 1px solid rgba(0, 119, 182, 0.2);
}

.mobile-register-btn {
    color: #ffffff;
    background: linear-gradient(135deg, #0077b6 0%, #023e8a 100%);
}

/* ==============================================
   TEMPORARY LABELS FOR DEVELOPMENT
   ============================================== */

.temp-label {
    font-size: 0.7rem;
    color: #94a3b8;
    font-style: italic;
    margin-left: 0.5rem;
    opacity: 0.8;
}

/* ==============================================
   DYNAMIC SCROLL EFFECTS
   ============================================== */

/* Header becomes more compact on scroll */
.header.scrolled {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(30px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.12);
    border-bottom: 1px solid rgba(0, 119, 182, 0.2);
}

.header.scrolled .header-container {
    min-height: 60px;
    padding: 0 1.5rem;
}

.header.scrolled .menu-link,
.header.scrolled .dropdown-toggle {
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
}

.header.scrolled .logo-text {
    font-size: 1.6rem;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .dropdown-menu,
    .header-menu a,
    .mobile-menu-toggle span,
    .dropdown-item {
        transition: none;
    }
    
    .dropdown-menu {
        animation: none;
    }
    
    .header.scrolled {
        transition: none;
    }
}