/* ==========================================================================
   GLOBAL LAYOUT MECHANICS
   ========================================================================== */
/* Prevents horizontal scrolling while allowing sticky bounding boundaries to calculate safely */
html, body {
    overflow-x: clip;
}

/* THE STICKY FIX: Apply layout stickiness directly onto the component container 
   which is fetched dynamically via JavaScript into your pages.
*/
#sharedHeader {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* ==================== DESKTOP HEADER ==================== */
.desktop-header {
    position: relative !important; /* Managed globally by #sharedHeader */
    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: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.logo a {
    text-decoration: none;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.logo-text .accent {
    color: #F5A623;
}

.desktop-nav {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    border-radius: 60px;
}

.nav-link {
    padding: 8px 24px;
    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.15);
}

.nav-link.active {
    background: linear-gradient(135deg, #F5A623, #E8871E);
    color: #1B4D3E;
}

.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.btn-login, .btn-register {
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.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: 8px 16px;
    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; /* Managed globally by #sharedHeader */
    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-telegram-link {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 136, 204, 0.12);
    padding: 6px 12px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mobile-telegram-link i {
    color: #0088cc;
    font-size: 0.9rem;
}

.mobile-telegram-link span {
    color: #0088cc;
    font-size: 0.75rem;
    font-weight: 500;
}

.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    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: 2000;
    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: 1999;
    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;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: #E2E8F0;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.25s ease;
    border-radius: 12px;
    margin-bottom: 4px;
    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: 24px;
    font-size: 1.1rem;
    color: #F5A623;
}

.sidebar-link span {
    flex: 1;
}

.sidebar-divider {
    margin: 16px 12px;
    border-top: 1px solid rgba(245, 166, 35, 0.15);
}

.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;
}

.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.9rem;
    font-weight: 500;
    margin-left: 8px;
}

.telegram-nav-link i {
    color: #0088cc;
    font-size: 1rem;
}

/* ==================== RESPONSIVE MEDIA QUERIES ==================== */
@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;
    }
}