/* ==========================================================================
   GLOBAL LAYOUT MECHANICS
   ========================================================================== */
html, body {
    overflow-x: clip;
}

#sharedHeader {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* ==================== DESKTOP HEADER ==================== */
.desktop-header {
    position: relative !important;
    top: auto !important;
    background: rgba(15, 43, 31, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(245, 166, 35, 0.2);
    box-shadow: 0 2px 12px rgba(27, 77, 62, 0.1);
    z-index: 1000;
    height: auto;
    min-height: 70px;
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo a {
    text-decoration: none;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.logo-text .accent {
    color: #F5A623;
}

/* ==================== NAV DROPDOWNS ==================== */
.desktop-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    padding: 8px 18px;
    border-radius: 40px;
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: #94A3B8;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Inter', sans-serif;
}

.nav-dropdown-trigger:hover {
    color: #F5A623;
    background: rgba(245, 166, 35, 0.1);
}

.nav-dropdown-trigger.active {
    background: linear-gradient(135deg, #F5A623, #E8871E);
    color: #1B4D3E;
}

.nav-dropdown-trigger i {
    font-size: 0.65rem;
    transition: transform 0.2s;
}

.nav-dropdown:hover .nav-dropdown-trigger i {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: linear-gradient(135deg, #1A2A2A, #0F2B1F);
    border-radius: 16px;
    min-width: 220px;
    padding: 8px 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(245, 166, 35, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s ease;
    z-index: 100;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    text-decoration: none;
    color: #E2E8F0;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
}

.dropdown-link:hover {
    background: rgba(245, 166, 35, 0.15);
    color: #F5A623;
    padding-left: 24px;
}

.dropdown-link i {
    width: 20px;
    color: #F5A623;
    font-size: 0.9rem;
}

.nav-link {
    padding: 8px 18px;
    border-radius: 40px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    color: #94A3B8;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-link:hover {
    color: #F5A623;
    background: rgba(245, 166, 35, 0.1);
}

.nav-link.active {
    background: linear-gradient(135deg, #F5A623, #E8871E);
    color: #1B4D3E;
}

/* ==================== HEADER RIGHT ==================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.telegram-nav-link {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    background: rgba(0, 136, 204, 0.1);
    padding: 8px 16px;
    border-radius: 40px;
    text-decoration: none;
    border: 1px solid rgba(0, 136, 204, 0.2);
    transition: all 0.2s ease;
    color: #E2E8F0 !important;
    font-size: 0.85rem;
    font-weight: 500;
}

.telegram-nav-link i {
    color: #0088cc;
    font-size: 1rem;
}

.telegram-nav-link:hover {
    background: rgba(0, 136, 204, 0.2);
    border-color: rgba(0, 136, 204, 0.4);
    transform: translateY(-1px);
}

/* ==================== AUTH SECTION ==================== */
.auth-section {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.btn-login, .btn-register {
    padding: 8px 18px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: 'Inter', sans-serif;
}

.btn-login {
    background: transparent;
    color: #94A3B8;
    border: 1px solid #334155;
}

.btn-login:hover {
    border-color: #F5A623;
    color: #F5A623;
    background: rgba(245, 166, 35, 0.1);
}

.btn-register {
    background: linear-gradient(135deg, #F5A623, #E8871E);
    color: #1B4D3E;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 166, 35, 0.3);
}

.user-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 40px;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
    border: 1px solid rgba(245, 166, 35, 0.2);
}

.user-avatar:hover {
    background: rgba(245, 166, 35, 0.15);
    border-color: rgba(245, 166, 35, 0.4);
}

.user-avatar i:first-child {
    font-size: 1.2rem;
    color: #F5A623;
}

.user-avatar span {
    font-size: 0.85rem;
    font-weight: 500;
    color: white;
}

.user-avatar i:last-child {
    font-size: 0.7rem;
    color: #94A3B8;
    transition: transform 0.2s;
}

.user-avatar:hover i:last-child {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 12px;
    background: linear-gradient(135deg, #1A2A2A, #0F2B1F);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    min-width: 240px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease;
    z-index: 1000;
    border: 1px solid rgba(245, 166, 35, 0.2);
    backdrop-filter: blur(10px);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: #E2E8F0;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(245, 166, 35, 0.15);
    color: #F5A623;
    padding-left: 26px;
}

.dropdown-item i {
    width: 20px;
    color: #F5A623;
    font-size: 1rem;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.logout-item {
    color: #E63946 !important;
}

.logout-item i {
    color: #E63946 !important;
}

.logout-item:hover {
    background: rgba(230, 57, 70, 0.15) !important;
    color: #E63946 !important;
}

/* ==================== MOBILE HEADER ==================== */
.mobile-header {
    display: none;
    position: relative !important;
    top: auto !important;
    left: 0;
    right: 0;
    background: rgba(15, 43, 31, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(245, 166, 35, 0.2);
    padding: 12px 16px;
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
}

.mobile-logo a {
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 800;
    color: white;
}

.mobile-logo .accent {
    color: #F5A623;
}

.mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-telegram-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(0, 136, 204, 0.12);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mobile-telegram-link i {
    color: #0088cc;
    font-size: 1rem;
}

.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mobile-menu-btn i {
    font-size: 1.2rem;
    color: white;
}

/* ==================== MOBILE SIDEBAR ==================== */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 300px;
    height: 100%;
    background: linear-gradient(135deg, #1A2A2A, #0F2B1F);
    z-index: 9999 !important; /* Higher than mobile footer (1000) */
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 30px rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(245, 166, 35, 0.2);
}

.mobile-sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9998 !important; /* Just below sidebar, above footer */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(245, 166, 35, 0.2);
    background: linear-gradient(135deg, #1A2A2A, #0F2B1F);
}

.sidebar-logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    letter-spacing: -0.5px;
}

.sidebar-logo .accent {
    color: #F5A623;
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #94A3B8;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(230, 57, 70, 0.2);
    color: #E63946;
    transform: rotate(90deg);
}

.sidebar-menu {
    padding: 16px 12px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

.sidebar-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #F5A623;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: #E2E8F0;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.25s ease;
    border-radius: 12px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(245, 166, 35, 0.05);
}

.sidebar-link:hover {
    background: rgba(245, 166, 35, 0.1);
    color: #F5A623;
    transform: translateX(5px);
    border-color: rgba(245, 166, 35, 0.2);
}

.sidebar-link i {
    width: 22px;
    font-size: 1rem;
    color: #F5A623;
}

.sidebar-link span {
    flex: 1;
}

.sidebar-divider {
    margin: 8px 12px;
    border-top: 1px solid rgba(245, 166, 35, 0.1);
}

.sidebar-link.login-link i {
    color: #F5A623;
}

.sidebar-link.register-link {
    background: linear-gradient(135deg, #F5A623, #E8871E);
    color: #1B4D3E;
    margin-top: 8px;
    border: none;
}

.sidebar-link.register-link i {
    color: #1B4D3E;
}

.sidebar-link.register-link:hover {
    transform: translateX(5px);
}

/* ==================== RESPONSIVE MEDIA QUERIES ==================== */
@media (max-width: 992px) {
    .desktop-nav {
        gap: 2px;
    }
    .nav-dropdown-trigger, .nav-link {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .telegram-nav-link span {
        display: none;
    }
    .telegram-nav-link {
        padding: 8px 12px;
    }
}

@media (max-width: 768px) {
    .desktop-header {
        display: none !important;
    }
    .mobile-header {
        display: flex !important;
    }
}

@media (min-width: 769px) {
    .mobile-header, 
    .mobile-sidebar, 
    .sidebar-overlay {
        display: none !important;
    }
}