/* css/header.css - النسخة الكاملة والمعدلة */

/* تعريف متغيرات الألوان للثيمات */
:root {
    --bg-body: #f7f9fc;
    --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: 0.3s; 
    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: 800;
    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: 600 !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: 600 !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); }

/* 🚀 صورة البروفايل في المنيو (صغيرة 55px) 🚀 */
.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-badge { font-size: 0.65rem; display: inline-block; background: #f1c40f; color: #000; padding: 2px 8px; border-radius: 4px; }

.sidebar-username { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.sidebar-username span:not(.sidebar-badge):not(.user-id) { font-size: 1rem !important; font-weight: 800 !important; color: var(--text-main) !important; }
[data-theme="dark"] .sidebar-username span:not(.sidebar-badge):not(.user-id) { color: #ffffff !important; }

.user-id { font-size: 0.85rem !important; font-weight: 800; color: #6c757d !important; background: #e9ecef; padding: 2px 6px; border-radius: 6px; }
[data-theme="dark"] .user-id { background: #2b3035; color: #adb5bd !important; }

.sidebar-balance { font-size: 1.4rem; font-weight: 800; 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: 800; }

#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;
    border: none !important; 
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 55px; 
    z-index: 1000;
}

.header-icons { 
    display: flex; 
    align-items: center; 
    gap: 28px; 
    height: 100%;
}

#menu-btn, 
.currency-wrapper, 
.header-balance-btn, 
.notif-bell, 
.user-link {
    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; 
}

#menu-btn { font-size: 1.1rem !important; cursor: pointer; outline: none; }

.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-weight: 500 !important; 
    font-size: 0.85rem !important; 
    font-family: 'Tajawal', sans-serif;
    transform: translateY(1px);
}

.notif-bell { position: relative; font-size: 1.05rem !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: bold !important;
    box-shadow: none !important;
    line-height: 1;
}

.user-link { font-size: 1.15rem !important; }

.header-left-side {
    display: flex;
    align-items: center;
    gap: 15px; 
    height: 100%;
}

.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;
}
.back-btn-header:hover { transform: translateX(-3px); }

.logo-container { 
    display: flex; 
    align-items: center; 
    height: 100%; 
}

.logo-container img {
    /* التحكم في الحجم */
    height: 70px !important; 
    max-height: 70px !important; 
    width: auto !important; 
    object-fit: contain;

    /* 🚀 الميزة اللي إنت عاوزها: تنزيل اللوجو لتحت 🚀 */
    position: relative; 
    
    /* جرب الأرقام دي وشوف إيه اللي هيريح عينك: */
    /* 2px -> نزلة خفيفة */
    /* 5px -> نزلة متوسطة */
    /* 10px -> نزلة واضحة */
    top: 0px !important; 
}

/* =========================================
   🚀 شاشة التحميل (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;
}