/* ============================================
   راصِد (Rased) — Global Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Reem+Kufi:wght@400;500;600;700&family=Tajawal:wght@300;400;500;700&display=swap');

:root {
    --bg-primary: #0f0e17;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --gold: #e6a817;
    --gold-light: #f0c040;
    --gold-dim: #b8860b;
    --text-primary: #e0e0e0;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
    --accent-purple: #a78bfa;
    --border: #2d2d4a;
    --radius: 12px;
    --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 { font-family: 'Reem Kufi', sans-serif; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; transition: border-color 0.2s; }
.card:hover { border-color: rgba(230, 168, 23, 0.3); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.2rem; border-radius: var(--radius-sm); font-family: 'Tajawal', sans-serif; font-weight: 500; font-size: 0.9rem; border: none; cursor: pointer; transition: all 0.2s; text-decoration: none; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #0f0e17; }
.btn-gold:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.1rem; }

/* Input */
.input { width: 100%; padding: 0.7rem 1rem; background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-primary); font-family: 'Tajawal', sans-serif; font-size: 0.95rem; outline: none; transition: border-color 0.2s; }
.input:focus { border-color: var(--gold); }
.input::placeholder { color: var(--text-muted); }

/* Toast */
.toast-container { position: fixed; top: 1.5rem; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.8rem 1.5rem; border-radius: var(--radius-sm); font-size: 0.9rem; animation: slideDown 0.3s ease; min-width: 300px; text-align: center; }
.toast-success { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); border: 1px solid rgba(34, 197, 94, 0.3); }
.toast-error { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.3); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-1rem); } to { opacity: 1; transform: translateY(0); } }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 0.2rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge-active { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.badge-inactive { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }

/* Table */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: right; padding: 0.8rem 1rem; font-size: 0.8rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; border-bottom: 1px solid var(--border); }
td { padding: 0.8rem 1rem; border-bottom: 1px solid rgba(45, 45, 74, 0.5); font-size: 0.9rem; }
tr:hover td { background: rgba(26, 26, 46, 0.5); }

/* Sidebar */
.sidebar { width: 250px; background: var(--bg-card); border-left: 1px solid var(--border); min-height: 100vh; padding: 1.5rem 0; position: fixed; right: 0; top: 0; }
.sidebar-logo { padding: 0 1.5rem 1.5rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.sidebar-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 1.5rem; color: var(--text-secondary); text-decoration: none; font-size: 0.9rem; transition: all 0.2s; }
.sidebar-link:hover { color: var(--gold); background: rgba(230, 168, 23, 0.05); }
.sidebar-link.active { color: var(--gold); background: rgba(230, 168, 23, 0.1); border-right: 3px solid var(--gold); }
.main-content { margin-right: 250px; padding: 2rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 90%; max-width: 480px; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* Stat cards */
.stat-card { text-align: center; padding: 1.5rem; }
.stat-number { font-size: 2rem; font-weight: 700; font-family: 'Reem Kufi', sans-serif; color: var(--gold); }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* Loading */
.spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 2px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar { width: 100%; height: 8px; background: var(--bg-primary); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

/* Session code */
.code-display { font-family: 'Reem Kufi', monospace; font-size: 3rem; font-weight: 700; letter-spacing: 0.5rem; color: var(--gold); text-align: center; padding: 1.5rem; background: var(--bg-primary); border: 2px dashed var(--border); border-radius: var(--radius); direction: ltr; user-select: all; }

/* Rank badge */
.rank-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.7rem; border-radius: 9999px; font-size: 0.8rem; font-weight: 600; border: 1px solid; }

/* Streak */
.streak-fire { color: #f97316; }

/* Achievement pill */
.achievement-pill { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.5rem; background: rgba(167, 139, 250, 0.12); border: 1px solid rgba(167, 139, 250, 0.25); border-radius: 9999px; font-size: 0.75rem; color: var(--accent-purple); }

/* Draw page */
.draw-container { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center; }
.draw-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 1rem; padding: 2.5rem; width: 100%; max-width: 500px; }
.draw-input { font-family: 'Reem Kufi', monospace; font-size: 2.2rem; letter-spacing: 0.6rem; text-align: center; text-transform: uppercase; direction: ltr; background: var(--bg-primary); border: 2px solid var(--border); border-radius: var(--radius); color: var(--gold); padding: 1rem; width: 100%; outline: none; }
.draw-input:focus { border-color: var(--gold); }
.draw-input::placeholder { letter-spacing: 0.2rem; font-size: 1.2rem; color: var(--text-muted); }
.draw-btn { width: 100%; padding: 1rem; font-size: 1.3rem; font-weight: 700; border-radius: var(--radius); border: none; cursor: pointer; font-family: 'Reem Kufi', sans-serif; transition: all 0.2s; }
.draw-btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: #0f0e17; }
.draw-btn-gold:hover { filter: brightness(1.1); transform: translateY(-2px); }
.draw-btn-gold:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.draw-btn-green { background: linear-gradient(135deg, #22c55e, #4ade80); color: #0f0e17; }
.draw-btn-red { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.4); }

/* Animations */
.suspense-text { font-family: 'Reem Kufi', sans-serif; font-size: 2rem; font-weight: 700; color: var(--gold); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.revealed-name { font-family: 'Reem Kufi', sans-serif; font-size: 2.5rem; font-weight: 700; color: var(--gold); animation: revealIn 0.5s ease-out; }
@keyframes revealIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }

/* Projector */
.projector-mode { background: var(--bg-primary); min-height: 100vh; padding: 2rem; }
.projector-header { text-align: center; padding: 1.5rem 0; border-bottom: 2px solid var(--border); margin-bottom: 2rem; }
.projector-rank-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid rgba(45, 45, 74, 0.4); transition: background 0.2s; }
.projector-rank-row:hover { background: var(--bg-card); }
.projector-position { font-family: 'Reem Kufi', sans-serif; font-size: 1.5rem; font-weight: 700; width: 2.5rem; text-align: center; }
.projector-name { font-size: 1.3rem; font-weight: 600; flex: 1; }
.projector-points { font-family: 'Reem Kufi', sans-serif; font-size: 1.5rem; font-weight: 700; color: var(--gold); }

/* Points slider */
.points-slider { -webkit-appearance: none; width: 100%; height: 8px; border-radius: 4px; background: var(--bg-primary); outline: none; }
.points-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); cursor: pointer; }

/* Mobile top bar */
.mobile-topbar { display: none; position: fixed; top: 0; right: 0; left: 0; height: 56px; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 0 1rem; align-items: center; justify-content: space-between; z-index: 900; }
.mobile-topbar h1 { font-size: 1.2rem; color: var(--gold); font-family: 'Reem Kufi', sans-serif; }
.mobile-nav { display: none; position: fixed; bottom: 0; right: 0; left: 0; height: 60px; background: var(--bg-card); border-top: 1px solid var(--border); z-index: 900; justify-content: space-around; align-items: center; }
.mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 0.15rem; text-decoration: none; color: var(--text-muted); font-size: 0.65rem; padding: 0.3rem; }
.mobile-nav a.active { color: var(--gold); }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .mobile-topbar { display: flex; }
    .mobile-nav { display: flex; }
    .main-content { margin-right: 0; padding: 1rem; padding-top: 70px; padding-bottom: 76px; }
    .code-display { font-size: 2rem; letter-spacing: 0.3rem; }
    .draw-input { font-size: 1.6rem; }
    .revealed-name { font-size: 1.8rem; }
    .modal { width: 95%; padding: 1.5rem; }
    .projector-rank-row { padding: 0.7rem 0.8rem; gap: 0.5rem; }
    .projector-name { font-size: 1rem; }
    .projector-points { font-size: 1.1rem; }
    .projector-position { font-size: 1.1rem; width: 2rem; }
}

@media (max-width: 480px) {
    .draw-card { padding: 1.5rem; }
    .draw-btn { font-size: 1.1rem; }
    .stat-number { font-size: 1.5rem; }
}
