/* css/header.css - النسخة الكاملة والمعدلة */

/* تعريف متغيرات الألوان للثيمات */
:root {
    --bg-body: #ffffff; /* أبيض منور صافي في الوضع الفاتح */
    --bg-side: #ffffff;
    --text-main: #333333;
    --border-color: #eeeeee;
}
[data-theme="dark"] {
    --bg-body: #000000; /* الوضع الداكن رجع أسود فخم ومتوحد */
    --bg-side: #121212; /* القائمة الجانبية في الداكن */
    --text-main: #ffffff; /* الخط أبيض عشان يبان على الخلفية الداكنة */
    --border-color: #222222;
}

body { 
    background-color: var(--bg-body) !important; /* بياخد اللون حسب الوضع (فاتح أو داكن) */
    color: var(--text-main) !important; 
    transition: background-color 0.3s ease, color 0.3s ease; 
    padding-top: 55px; 
    font-family: 'Tajawal', sans-serif; 
}

/* =========================================
   --- القائمة الجانبية (Sidebar) --- 
   ========================================= */
.side-nav { 
    background-color: var(--bg-side) !important; 
    color: var(--text-main) !important; 
    width: 270px; 
    position: fixed; 
    top: 0; 
    right: -270px; 
    height: 100%; 
    z-index: 9999999 !important; 
    transition: 0.3s ease; 
    overflow-y: auto; 
    display: flex; 
    flex-direction: column; 
    box-shadow: -2px 0 15px rgba(0,0,0,0.05);
}
.side-nav.open { right: 0; }

.login-section-sidebar {
    padding: 20px 15px;
    margin: 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}
.login-section-sidebar h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
}
.login-section-sidebar p {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

.btn-green-sidebar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    background-color: #2ecc71 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 50px !important; 
    padding: 8px 20px !important; 
    font-weight: 500 !important; 
    font-size: 0.85rem !important; 
    letter-spacing: 1px !important; 
    transition: 0.3s !important;
    box-shadow: 0 4px 10px rgba(46, 204, 113, 0.2) !important;
}
.btn-green-sidebar:hover {
    background-color: #27ae60 !important;
    transform: translateY(-2px) !important;
}

.btn-google-sidebar {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    gap: 8px !important;
    background-color: #ffffff !important;
    color: #333333 !important;
    text-decoration: none !important;
    border-radius: 50px !important; 
    padding: 8px 20px !important; 
    font-weight: 500 !important; 
    font-size: 0.75rem !important; 
    white-space: nowrap !important; 
    letter-spacing: 0.5px !important; 
    border: 1px solid #dddddd !important;
    transition: 0.3s !important;
    margin-top: 10px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02) !important;
}
.btn-google-sidebar img {
    width: 18px !important;
    height: 18px !important;
    object-fit: contain !important;
}
.btn-google-sidebar:hover {
    background-color: #f8f9fa !important;
    transform: translateY(-2px) !important;
}
[data-theme="dark"] .btn-google-sidebar {
    background-color: #1a1a1a !important;
    color: #ffffff !important;
    border-color: #333333 !important;
}
[data-theme="dark"] .btn-google-sidebar:hover {
    background-color: #222222 !important;
}

.nav-links-sidebar { padding: 5px 8px !important; list-style: none; }
.nav-links-sidebar li { margin-bottom: 15px !important; }
.nav-links-sidebar a {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 8px 10px !important;
    font-size: 0.85rem !important;
    font-weight: 400 !important;
    gap: 10px !important;
    border-radius: 10px !important;
    color: var(--text-main) !important;
    text-decoration: none;
    transition: 0.2s;
}

.nav-links-sidebar a i { font-size: 0.75rem !important; width: 18px; text-align: center; }

.nav-links-sidebar a i.icon-home { color: #198754 !important; }
.nav-links-sidebar a i.icon-balance { color: #0d6efd !important; }
.nav-links-sidebar a i.icon-payments { color: #0d6efd !important; }
.nav-links-sidebar a i.icon-wallet { color: #ffc107 !important; }
.nav-links-sidebar a i.icon-orders { color: #dc3545 !important; }
.nav-links-sidebar a i.icon-telegram { color: #0088cc !important; }
.nav-links-sidebar a i.icon-agents { color: #0d6efd !important; }
.nav-links-sidebar a i.icon-security { color: #198754 !important; }
.nav-links-sidebar a i.icon-verify { color: #198754 !important; }
.nav-links-sidebar a i.icon-api { color: #28a745 !important; }
.nav-links-sidebar a i.icon-about { color: #0dcaf0 !important; }

.nav-links-sidebar a.active-link { 
    background: #f1f5f9 !important; 
    color: var(--text-main) !important; 
    font-weight: 500 !important; 
}
[data-theme="dark"] .nav-links-sidebar a.active-link { 
    background: #1e293b !important; 
    color: #ffffff !important; 
}

.nav-links-sidebar a:hover { background: rgba(0,0,0,0.03); }
[data-theme="dark"] .nav-links-sidebar a:hover { background: rgba(255,255,255,0.03); }

.sidebar-profile { padding: 15px; border-bottom: 1px solid var(--border-color); }
.sidebar-avatar-container { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 5px; margin-bottom: 10px; }

.sidebar-avatar,
.sidebar-avatar-container img { 
    width: 55px !important; 
    height: 55px !important; 
    border-radius: 50% !important; 
    object-fit: cover !important;
    margin-bottom: 8px !important; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important;
    border: 2px solid #f1f5f9;
    font-size: 2rem !important; 
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}
[data-theme="dark"] .sidebar-avatar,
[data-theme="dark"] .sidebar-avatar-container img {
    border-color: #333333;
}

.sidebar-balance { font-size: 1.4rem; font-weight: 500; color: #0d6efd !important; background: transparent; padding: 10px; border-radius: 8px; text-align: center; margin-bottom: 15px; }

.sidebar-actions {
    display: flex !important;
    justify-content: space-between !important; 
    align-items: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 40px !important; 
    margin-top: 5px !important; 
    margin-bottom: 15px !important;
}
.sidebar-actions a { color: var(--text-main) !important; font-size: 1.15rem !important; transition: 0.2s; }
.sidebar-actions a:hover { opacity: 0.7; }
.sidebar-actions a .fa-heart, .header-user-actions a .fa-heart { color: #e74c3c !important; }

.theme-switch-container { 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 15px 20px; margin-top: auto; 
    border-top: 1px solid var(--border-color); margin-bottom: 25px; 
}
.pro-theme-btn {
    background: var(--bg-body); border: 1px solid var(--border-color);
    border-radius: 50%; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: 0.3s; color: var(--text-main); font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); outline: none;
}
.pro-theme-btn:hover { transform: rotate(15deg) scale(1.1); }
.pro-theme-btn .sun-icon { color: #f59e0b; } 
.pro-theme-btn .moon-icon { color: #818cf8; } 

.sidebar-socials { 
    display: flex; 
    justify-content: center; 
    gap: 20px; 
    padding: 0 15px; 
    margin-bottom: 30px; 
}
.sidebar-socials a { text-decoration: none; font-size: 1.2rem; }
.fa-whatsapp { color: #25D366 !important; } 
.fa-telegram { color: #0088cc !important; } 
.fa-instagram { color: #E1306C !important; }

.wa-banner-link { 
    display: inline-block; 
    border-radius: 8px; 
    overflow: hidden; 
    transition: transform 0.3s ease; 
}
.wa-banner-link img { 
    max-height: 55px !important; 
    width: auto !important;
    object-fit: contain; 
}
.wa-banner-link:hover { transform: scale(1.05); }

.dev-credit { 
    padding: 0 15px 30px 15px; 
    text-align: center; 
    font-size: 0.7rem; 
    color: var(--text-main); 
    opacity: 0.7; 
}
.dev-credit a { color: #2ecc71; text-decoration: none; font-weight: 500; }

#overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: transparent; 
    z-index: 9999998 !important; 
}

/* =========================================
   --- البار العلوي (Header) --- 
   ========================================= */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center; 
    padding: 0 15px 0 0;
    border: none !important; 
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 55px; 
    z-index: 1000;
}

/* 🚀 حاوية الأيقونات اليمين (للكل) 🚀 */
.header-icons { 
    display: flex; 
    align-items: center; 
    gap: 10px; /* تم تعديل المسافة لـ 3 بيكسل عشان متبقاش لازقة أوي */
    height: 100%;
}

.currency-wrapper, 
.header-balance-btn, 
.notif-bell {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.9) !important; 
    box-shadow: none !important;
    text-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    text-decoration: none;
    font-weight: 400 !important; 
}

/* 🚀 تنسيق مشترك لأيقونة اليوزر والقائمة لسلاسة الضغط 🚀 */
.user-link, 
#menu-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;  
    height: 26px !important; 
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.9) !important;
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent; 
}

/* تأثير سلس جداً عند الضغط */
.user-link:active, 
#menu-btn:active {
    transform: scale(0.92); 
    opacity: 0.8;
}

/* إخفاء أي عناصر HTML قديمة داخل الروابط */
.user-link *, 
#menu-btn * { 
    display: none !important; 
}

/* 🚀 أيقونة اليوزر (تسجيل الدخول) متوحدة للكل 🚀 */
.user-link {
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* 🚀 أيقونة القائمة (الثلاث شرط) 🚀 */
#menu-btn {
    border: none;
    outline: none;
    padding: 0;
    margin: 0 !important; 
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z'/%3E%3C/svg%3E") no-repeat center / contain;
}

.currency-wrapper { position: relative; font-size: 1rem !important; }
.currency-select-hidden {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; 
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

/* 🚀 زر السعر والمحاذاة 🚀 */
.header-balance-btn {
    font-size: 0.8rem !important; 
    font-family: 'Tajawal', sans-serif;
    display: inline-flex !important;
    align-items: center !important;
    transform: none !important; 
    margin: 0 !important; 
    text-decoration: none;
}

.header-balance-btn span {
    font-weight: 500 !important; 
    transform: translateY(1.5px) !important; /* 🚀 تنزيل السعر لتحت عشان يتسنتر مع الدائرة 🚀 */
    display: inline-block;
}

.header-balance-btn::before {
    content: ''; 
    display: inline-block;
    width: 15px; 
    height: 15px; 
    /* الدرجة دي بيضاء مطفية وراقية جداً */
    background-color: #f5f5f5; 
    border-radius: 50%;
    margin-right: 8px !important; 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 11h-6V5h-2v6H5v2h6v6h2v-6h6v-2z'/%3E%3C/svg%3E");
    background-size: 10px 10px; 
    background-position: center;
    background-repeat: no-repeat;
    transform: none !important;
}
.notif-bell { 
    position: relative; 
    font-size: 1.05rem !important; 
    font-weight: 400 !important; 
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transform: none !important;

    /* 👇 بيكسلات فرق للجرس لوحده 👇 */
    margin-right: 3px !important; /* المسافه بينه وبين اللي قبله (زود أو نقص براحتك) */
    margin-left: 5px !important;   /* المسافه بينه وبين اللي بعده */
}

.notif-badge {
    position: absolute; 
    top: -5px; 
    right: -5px;
    background: #e74c3c; 
    color: #ffffff !important;
    border-radius: 50%;
    padding: 2px 4px; 
    font-size: 9px; 
    font-weight: 700 !important; 
    box-shadow: none !important;
    line-height: 1;
}

.header-left-side {
    display: flex;
    align-items: center;
    gap: 15px; 
    height: 100%;
    padding-left: 15px;
}

.back-btn-header {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 1.2rem !important;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    margin-left: 5px;
    font-weight: 400 !important;
}
.back-btn-header:hover { transform: translateX(-3px); }

.logo-container { 
    display: flex; 
    align-items: center; 
    height: 100%; 
}

.logo-container img {
    height: 50px !important; 
    max-height: 50px !important; 
    width: auto !important; 
    object-fit: contain;
    position: relative;
    top: 0 !important; /* إلغاء أي إزاحة عشان اللوجو يبقى مساوي للبانر كله */
}

/* ==================================================
   🚀 تعديلات الزوار (الغير مسجلين دخول) فقط 🚀 
   استخدم كلاس <body class="guest-mode"> للزوار
==================================================
*/
body.guest-mode .header-icons {
    gap: 3px !important; /* المسافة 3 بيكسل زي ما طلبت للزوار كمان */
}

body.guest-mode .user-link {
    display: inline-flex !important;
    width: 26px !important;  
    height: 26px !important; 
    background-color: rgba(255, 255, 255, 0.9) !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12,4A4,4 0 0,1 16,8A4,4 0 0,1 12,12A4,4 0 0,1 8,8A4,4 0 0,1 12,4M12,6A2,2 0 0,0 10,8A2,2 0 0,0 12,10A2,2 0 0,0 14,8A2,2 0 0,0 12,6M12,13C14.67,13 20,14.33 20,17V20H4V17C4,14.33 9.33,13 12,13M12,14.9C9.03,14.9 5.9,16.36 5.9,17V18.1H18.1V17C18.1,16.36 14.97,14.9 12,14.9Z'/%3E%3C/svg%3E") no-repeat center / contain;
    transform: none !important; 
    margin: 0 !important;
    font-size: 0 !important;
}

body.guest-mode #menu-btn {
    display: inline-flex !important;
    width: 26px !important;  
    height: 26px !important; 
    background-color: rgba(255, 255, 255, 0.9) !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3,6H21V8H3V6M3,11H21V13H3V11M3,16H21V18H3V16Z'/%3E%3C/svg%3E") no-repeat center / contain;
    transform: none !important;
    margin: 0 !important;
    font-size: 0 !important;
    border: none !important;
}

body.guest-mode .user-link *, 
body.guest-mode #menu-btn * { 
    display: none !important; 
}

body.guest-mode .user-link, 
body.guest-mode #menu-btn {
    transition: transform 0.15s ease, opacity 0.2s ease;
    -webkit-tap-highlight-color: transparent; 
}

body.guest-mode .user-link:active, 
body.guest-mode #menu-btn:active {
    transform: scale(0.92) !important; 
    opacity: 0.8;
}

/* =========================================
   🚀 شاشة التحميل (Preloader) 🚀 
   ========================================= */
#global-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85) !important;
    z-index: 10000000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

[data-theme="dark"] #global-preloader {
    background-color: rgba(18, 18, 18, 0.85) !important; /* شاشة التحميل كمان بقت غامقة في الوضع المظلم */
}

.loader-wrapper {
    position: relative;
    width: 100px;  
    height: 100px; 
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(46, 204, 113, 0.1); 
    border-top-color: #2ecc71; 
    border-right-color: #2ecc71; 
    border-radius: 50%;
    animation: spin-loader 0.8s linear infinite;
}

.loader-logo {
    width: 55px;  
    height: auto;
    z-index: 10;
    filter: drop-shadow(0px 4px 8px rgba(0, 0, 0, 0.2)); 
    animation: pulse-logo 1.5s ease-in-out infinite alternate;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes pulse-logo {
    0% { transform: scale(0.9); opacity: 0.8; }
    100% { transform: scale(1.1); opacity: 1; }
}

.preloader-hidden {
    opacity: 0;
    visibility: hidden;
}