* {
    font-family: 'Cairo', 'Inter', sans-serif;
}
body {
    background: #0d1117;
    color: #e6edf3;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}
/* الثيم الفاتح */
body.light-theme {
    background: #f3f4f6;
    color: #1f2937;
}
body.light-theme .card-glass {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(156, 163, 175, 0.4);
}
body.light-theme .bg-gray-800 {
    background-color: #e5e7eb;
}
body.light-theme .text-gray-400 {
    color: #4b5563;
}
body.light-theme .border-gray-700 {
    border-color: #d1d5db;
}
body.light-theme .ticker-tape {
    background: #e5e7eb;
    border-bottom-color: #9ca3af;
}
body.light-theme .table-pro td {
    background: #ffffff;
}
::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: #1a212b; }
::-webkit-scrollbar-thumb { background: #3b4a5a; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #4f6f8f; }

.card-glass {
    background: rgba(22, 28, 36, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(66, 82, 110, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 40px -15px rgba(0,0,0,0.5);
    transition: all 0.2s;
}
.card-glass:hover {
    border-color: #3b82f6;
    box-shadow: 0 25px 50px -12px #1e3a8a80;
}

.btn-primary {
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    color: white;
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: linear-gradient(145deg, #1d4ed8, #1e3a8a);
    transform: scale(1.02);
    box-shadow: 0 10px 25px -5px #2563eb80;
}
.btn-outline {
    background: transparent;
    border: 1px solid #3b82f6;
    color: #3b82f6;
    border-radius: 12px;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-outline:hover {
    background: #3b82f6;
    color: white;
}

.table-pro {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}
.table-pro th {
    color: #8b9bb5;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 12px 8px;
    text-align: right;
}
.table-pro td {
    background: #1a212b;
    padding: 14px 8px;
    border-radius: 14px;
    transition: background 0.15s;
}
.table-pro tr:hover td {
    background: #252f3c;
}

.up { color: #22c55e; }
.down { color: #ef4444; }

.ticker-tape {
    background: #0f1419;
    border-bottom: 1px solid #2a3744;
    overflow: hidden;
    white-space: nowrap;
    padding: 8px 0;
    transition: background-color 0.3s;
}
.ticker-item {
    display: inline-block;
    padding: 0 20px;
    font-size: 0.9rem;
    border-left: 1px solid #2a3744;
}
@keyframes marquee {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}
.animate-marquee {
    animation: marquee 30s linear infinite;
}

.demo-badge {
    background: #f59e0b20;
    color: #fbbf24;
    border: 1px solid #f59e0b40;
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 0.7rem;
    font-weight: 600;
}

.tab {
    padding: 8px 16px;
    border-radius: 30px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.tab.active {
    background: #2563eb;
    color: white;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    border-right: 4px solid #3b82f6;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 9999;
    transform: translateX(400px);
    transition: transform 0.3s;
}
.toast.show {
    transform: translateX(0);
}

/* صورة المستخدم */
.avatar {
    width: 45px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3b82f6;
}
.avatar-small {
    width: 35px;
    height: 32px;
}
.avatar-placeholder {
    background: #2563eb;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

/* مؤشر التحميل */
.loading-spinner {
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 18px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 8px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* مودال دفتر اليومية */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.modal.active {
    display: flex;
}
.modal-content {
    background: #1f2937;
    border-radius: 24px;
    padding: 24px;
    max-width: 850px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
}
body.light-theme .modal-content {
    background: #ffffff;
    color: #1f2937;
}

/* ===== CSS خاص بمودال السحب (مأخوذ من التصميم المقدم مع تعديل طفيف) ===== */
:root{
    --bg:#0b1220;
    --card:#111a2e;
    --card2:#0f172a;
    --border:#1e293b;
    --text:#e5e7eb;
    --muted:#94a3b8;
    --green:#10b981;
    --yellow:#facc15;
}

.withdraw-modal {
    background: linear-gradient(180deg, #0b1220, #020617);
    color: var(--text);
    border-radius: 24px;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    margin: auto;
    border: 1px solid var(--border);
}
.withdraw-modal .header {
    padding: 18px;
    border-radius: 14px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 16px;
}
.withdraw-modal .card {
    background: linear-gradient(180deg, var(--card), var(--card2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1px;
    margin-bottom: 12px;
}
.withdraw-modal .label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 10px;
    padding-top: 10px;
}
.withdraw-modal .input {
    width: 100%;
    background: #0b1220;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    color: var(--text);
    outline: none;
    margin-top: 5px;
}
.withdraw-modal .input.green {
    color: var(--green);
    font-weight: bold;
    font-size: 18px;
}
.withdraw-modal .input.yellow {
    color: var(--yellow);
    font-weight: bold;
}
.withdraw-modal .btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #022c22;
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    border: none;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}
.withdraw-modal .message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    display: none;
    position: relative;
}
.withdraw-modal .message.visible { display: block; }
.withdraw-modal .message.error {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: #fff;
    border: 1px solid rgba(0,0,0,0.2);
}
.withdraw-modal .msg-close {
    position: absolute;
    left: 8px;
    top: -8px;
    background: var(--card2);
    border: 1px solid rgba(255,255,255,0.04);
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    width: 30px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 6px 12px rgba(2,6,23,0.5);
    z-index: 12;
    padding: 0;
}
/* لوحة السجل الجانبية داخل المودال */
.withdraw-modal .history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s;
    z-index: 10060;
}
.withdraw-modal .history-overlay.open { opacity: 1; visibility: visible; }
.withdraw-modal .history-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 400px;
    max-width: 92%;
    background: linear-gradient(180deg, #0f172a, #071026);
    box-shadow: -12px 0 30px rgba(2,6,23,0.7);
    transform: translateX(110%);
    transition: transform .28s;
    z-index: 10070;
    padding: 16px;
    display: flex;
    flex-direction: column;
}
.withdraw-modal .history-panel.open { transform: translateX(0); }
.withdraw-modal .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.withdraw-modal .panel-title { font-weight: bold; font-size: 16px; }
.withdraw-modal .close-panel {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
}
.withdraw-modal .empty { color: var(--muted); text-align: center; padding: 28px 8px; }
.withdraw-modal .list-wrap { overflow: auto; flex: 1; }
.withdraw-modal .history {
    list-style: none;
    padding: 0;
    margin: 0;
}
.withdraw-modal .history li {
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255,255,255,0.02);
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}
.withdraw-modal .history li.error { border-color: rgba(255,0,0,0.12); }
.withdraw-modal .history .time { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
.withdraw-modal .footer {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
    margin-top: 14px;
    cursor: pointer;
}
.withdraw-modal .footer i { font-size: 16px; }
/* زر إغلاق المودال العام */
.close-withdraw-modal {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.3);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    border-radius: 50%;
    width: 45px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10080;
}
.close-withdraw-modal:hover { background: rgba(255,255,255,0.2); }
/* جعل القائمة المنسدلة الرئيسية قابلة للتمرير */
#userDropdown {
    max-height: 80vh; /* لا يتجاوز 80% من ارتفاع الشاشة */
    overflow-y: auto;  /* تفعيل التمرير الرأسي */
    scrollbar-width: thin; /* تحسين مظهر شريط التمرير (لفايرفوكس) */
    scrollbar-color: #3b4a5a #1a212b; /* لون شريط التمرير والخلفية */
}

/* تخصيص شريط التمرير لمتصفحات WebKit (كروم، سفاري، إيدج) */
#userDropdown::-webkit-scrollbar {
    width: 8px;
}
#userDropdown::-webkit-scrollbar-track {
    background: #1a212b;
    border-radius: 10px;
}
#userDropdown::-webkit-scrollbar-thumb {
    background: #3b4a5a;
    border-radius: 10px;
}
#userDropdown::-webkit-scrollbar-thumb:hover {
    background: #4f6f8f;
}

/* إذا كانت قائمة تبديل الحسابات طويلة، نجعلها قابلة للتمرير داخليًا أيضًا */
#userSwitchList {
    max-height: 200px; /* ارتفاع مناسب لعرض عدة حسابات */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3b4a5a #1a212b;
}

#userSwitchList::-webkit-scrollbar {
    width: 8px;
}
#userSwitchList::-webkit-scrollbar-track {
    background: #1a212b;
}
#userSwitchList::-webkit-scrollbar-thumb {
    background: #3b4a5a;
    border-radius: 10px;
}
#userSwitchList::-webkit-scrollbar-thumb:hover {
    background: #4f6f8f;
}

/* تحسين القائمة الجانبية للموبايل (إذا كانت موجودة) */
#mobileMenu {
    max-height: calc(100vh - 100px); /* ترك مساحة للشريط العلوي */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3b4a5a #1a212b;
}

#mobileMenu::-webkit-scrollbar {
    width: 8px;
}
#mobileMenu::-webkit-scrollbar-track {
    background: #1a212b;
}
#mobileMenu::-webkit-scrollbar-thumb {
    background: #3b4a5a;
    border-radius: 10px;
}
#mobileMenu::-webkit-scrollbar-thumb:hover {
    background: #4f6f8f;
    }
