/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
    background: var(--color-black);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    will-change: transform;
}

.header .logo {
    display: flex;
    align-items: center;
    height: 75px;
    flex-shrink: 0;
}

.header .logo img {
    height: 100%;
    width: auto;
    max-height: 75px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1;
    justify-content: center;
}

.nav a {
    font-size: 0.95rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.75);
    transition: color var(--transition);
    position: relative;
    padding: 4px 0;
    white-space: nowrap;
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--color-gold);
    transition: width var(--transition);
}

.nav a:hover::after,
.nav a.active::after {
    width: 100%;
}

.nav a:hover {
    color: #fff;
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.header-actions .icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: transform 0.2s, color 0.2s;
    padding: 6px;
    border-radius: 50%;
    touch-action: manipulation;
    position: relative;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions .icon-btn:hover {
    color: #fff;
    transform: scale(1.1);
}

.header-actions .icon-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-gold);
    color: var(--color-black);
    font-size: 0.6rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.user-avatar-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.user-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-gold);
}

.user-name {
    font-size: 0.9rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #fff;
    cursor: pointer;
    touch-action: manipulation;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
    padding: 0;
}

/* ===== MOBILE NAV ===== */
.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    max-width: 85vw;
    height: 100vh;
    background: var(--color-black);
    box-shadow: 8px 0 48px rgba(0, 0, 0, 0.30);
    padding: 40px 32px;
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 1100;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    will-change: transform;
    overscroll-behavior: contain;
}

.mobile-nav.open {
    transform: translateX(0);
}

.mobile-nav .close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    position: absolute;
    top: 20px;
    left: 24px;
    transition: transform 0.3s, color 0.3s;
    touch-action: manipulation;
    min-height: var(--touch-min);
    min-width: var(--touch-min);
}

.mobile-nav .close-btn:hover {
    transform: rotate(-90deg);
    color: #fff;
}

.mobile-nav .logo-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
}

.mobile-nav .logo-mobile img {
    height: 50px;
    width: auto;
}

.mobile-nav a {
    display: block;
    padding: 14px 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: color 0.3s, padding-right 0.3s;
    touch-action: manipulation;
    min-height: var(--touch-min);
}

.mobile-nav a:hover {
    color: #fff;
    padding-right: 8px;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 1050;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    will-change: opacity;
    backdrop-filter: blur(2px);
}

.mobile-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .header { padding: 0 20px; }
    .nav { gap: 12px; }
    .nav a { font-size: 0.85rem; }
}

@media (max-width: 768px) {
    .nav { display: none; }
    .menu-toggle { display: block; }

    .header {
        padding: 0 16px;
        justify-content: center;
    }

    .header .logo {
        height: 55px;
        margin-right: auto;
    }
    .header .logo img { max-height: 55px; }

    .header-actions {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 18px;
        position: relative;
    }

    .header-actions .menu-toggle {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        font-size: 1.5rem;
        display: block;
    }

    .user-avatar-link .user-name {
        display: none;
    }

    .user-avatar-link .user-avatar-img {
        width: 30px;
        height: 30px;
    }

    #login-register-btn {
        font-size: 1.4rem;
    }

    .header-actions .icon-btn {
        font-size: 1.2rem;
        padding: 4px;
        min-height: 44px;
        min-width: 44px;
    }

    .header-actions .icon-btn .badge {
        width: 18px;
        height: 18px;
        font-size: 0.5rem;
        top: -2px;
        right: -2px;
    }
}

/* شاشات صغيرة جداً (≤360px) */
@media (max-width: 360px) {
    .header {
        padding: 0 10px;
        height: 60px;
    }
    .header .logo {
        height: 45px;
    }
    .header .logo img { max-height: 45px; }
    .header-actions .icon-btn {
        font-size: 1rem;
        min-height: 40px;
        min-width: 40px;
    }
    .header-actions {
        gap: 12px;
    }
    .user-avatar-link .user-avatar-img {
        width: 26px;
        height: 26px;
    }
    #login-register-btn {
        font-size: 1.2rem;
    }
}