/* ===== Dawery EL-Tawqo3at - Design System ===== */
:root {
  --bg-dark: #0B0B0B; --bg-card: #151515; --bg-card-hover: #1f1f1f;
  --bg-sidebar: #0B0B0B; --bg-input: #1a1a1a; --bg-modal: rgba(0,0,0,.85);
  --text-primary: #FFFFFF; --text-secondary: #a3a3a3; --text-muted: #737373;
  --accent: #0F4DB8; --accent-glow: rgba(15,77,184,.25); --accent-dark: #083A8C;
  --gold: #F4D000; --gold-glow: rgba(244,208,0,.2);
  --danger: #ef4444; --danger-glow: rgba(239,68,68,.2);
  --info: #3b82f6; --info-glow: rgba(59,130,246,.2);
  --warning: #F4D000; --purple: #8b5cf6;
  --border: rgba(255,255,255,.08); --border-accent: rgba(15,77,184,.3);
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,.5); --shadow-lg: 0 8px 40px rgba(0,0,0,.6);
  --font: 'Cairo', sans-serif; --transition: .25s ease;
  --sidebar-w: 260px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg-dark); color: var(--text-primary); min-height: 100vh; line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }

/* ===== Loading ===== */
.loading-overlay { position: fixed; inset: 0; background: rgba(11,11,11,.85); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.spinner-wrap { text-align: center; }
.spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
.spinner-text { color: var(--text-secondary); font-size: .9rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toasts ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); color: #fff; font-weight: 600; font-size: .88rem; animation: slideIn .3s ease; box-shadow: var(--shadow); max-width: 360px; }
.toast-success { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); }
.toast-error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.toast-info { background: linear-gradient(135deg, #2563eb, #3b82f6); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== Auth Screen ===== */
.auth-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--bg-dark); }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-header { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 3rem; margin-bottom: 8px; animation: bounce 2s infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.brand-title { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.brand-subtitle-en { font-size: .95rem; color: var(--text-secondary); margin-top: 2px; font-weight: 500; }
.auth-hint { font-size: .82rem; color: var(--text-muted); margin-top: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-info-box { display: flex; gap: 10px; align-items: flex-start; background: var(--info-glow); border: 1px solid rgba(59,130,246,.2); border-radius: var(--radius-sm); padding: 12px; margin-top: 8px; }
.auth-info-box svg { width: 20px; height: 20px; fill: var(--info); flex-shrink: 0; margin-top: 2px; }
.auth-info-box p { font-size: .8rem; color: var(--text-secondary); line-height: 1.4; }

/* ===== Form Elements ===== */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea { background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 10px 14px; color: var(--text-primary); font-size: .9rem; transition: border var(--transition); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-hint { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-checkbox-group { margin-top: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .88rem; color: var(--text-primary); }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius-sm); font-size: .88rem; font-weight: 600; transition: all var(--transition); }
.btn-icon { width: 18px; height: 18px; fill: currentColor; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-danger { background: linear-gradient(135deg, #dc2626, var(--danger)); color: #fff; }
.btn-danger:hover { box-shadow: 0 4px 16px var(--danger-glow); }
.btn-success { background: linear-gradient(135deg, var(--accent-dark), var(--accent)); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #d97706, var(--gold)); color: #fff; }
.btn-info { background: linear-gradient(135deg, #2563eb, var(--info)); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: .78rem; border-radius: var(--radius-xs); }
.btn-xs { padding: 4px 8px; font-size: .72rem; border-radius: 4px; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== Layout ===== */
.main-layout { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar { width: var(--sidebar-w); background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; overflow-y: auto; }
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.sidebar-logo-icon { font-size: 1.6rem; }
.sidebar-brand-ar { display: block; font-size: 1rem; font-weight: 800; color: var(--accent); }
.sidebar-brand-en { display: block; font-size: .7rem; color: var(--text-muted); }
.sidebar-close-mobile { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; }
.user-profile-badge { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.avatar-circle { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-dark), var(--accent)); display: flex; align-items: center; justify-content: center; }
.avatar-circle svg { width: 22px; height: 22px; fill: #fff; }
.user-name { font-weight: 700; font-size: .9rem; display: block; }
.user-role-badge { font-size: .7rem; background: var(--accent-glow); color: var(--accent); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav ul { list-style: none; }
.nav-section-title { display: block; padding: 12px 16px 4px; font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: var(--text-secondary); font-size: .85rem; font-weight: 500; transition: all var(--transition); border-left: 3px solid transparent; }
.nav-link:hover { background: rgba(15,77,184,.06); color: var(--text-primary); }
.nav-link.active { color: var(--accent); background: rgba(15,77,184,.08); border-left-color: var(--accent); font-weight: 700; }
.nav-icon { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

/* ===== Main Content ===== */
.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.top-navbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.navbar-left { display: flex; align-items: center; gap: 12px; }
.navbar-left h2 { font-size: 1.1rem; font-weight: 700; }
.toggle-sidebar-btn { display: none; background: none; border: none; flex-direction: column; gap: 4px; padding: 4px; }
.toggle-sidebar-btn span { display: block; width: 22px; height: 2px; background: var(--text-primary); border-radius: 2px; }
.tournament-pill { display: flex; align-items: center; gap: 8px; background: var(--accent-glow); border: 1px solid var(--border-accent); padding: 6px 14px; border-radius: 20px; font-size: .8rem; font-weight: 600; color: var(--accent); }
.pulse-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.content-container { padding: 24px; flex: 1; }

/* ===== Cards ===== */
.card { background: rgba(17, 24, 39, 0.65); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: var(--radius); padding: 20px; transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); }
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,.3); border-color: rgba(255,255,255,0.15); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 1rem; font-weight: 700; }
.card-grid { display: grid; gap: 16px; }
.card-grid-2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card-grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.card-grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ===== Stat Cards ===== */
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--gold)); }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-card .stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; margin-top: 4px; }
.stat-card .stat-icon { font-size: 1.5rem; margin-bottom: 8px; }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead { background: rgba(15,77,184,.08); }
th { padding: 12px 14px; text-align: left; font-weight: 700; font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover { background: rgba(255,255,255,.02); }
tr:last-child td { border-bottom: none; }

/* ===== Match Cards ===== */
.match-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; transition: all var(--transition); }
.match-card:hover { border-color: var(--border-accent); box-shadow: 0 4px 20px rgba(15,77,184,.15); }
.match-card.bonus-match { border-color: var(--gold); box-shadow: 0 0 12px var(--gold-glow); }
.match-card.important-match { border-color: var(--purple); }
.match-card.super-bonus-match { border-color: var(--gold); border-width: 2px; }
.match-teams { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.match-team { text-align: center; flex: 1; font-weight: 700; font-size: .95rem; }
.match-vs { font-size: .75rem; color: var(--text-muted); font-weight: 800; padding: 4px 8px; background: var(--bg-input); border-radius: 6px; }
.match-score-display { text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.match-meta { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: .75rem; color: var(--text-muted); margin-top: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: .7rem; font-weight: 700; }
.badge-bonus { background: var(--gold-glow); color: var(--gold); }
.badge-important { background: rgba(139,92,246,.15); color: var(--purple); }
.badge-super { background: var(--gold-glow); color: var(--gold); border: 1px solid rgba(245,158,11,.3); }
.badge-pending { background: rgba(59,130,246,.1); color: var(--info); }
.badge-finished { background: rgba(15,77,184,.1); color: var(--accent); }
.badge-locked { background: rgba(239,68,68,.1); color: var(--danger); }
.badge-correct { background: rgba(15,77,184,.15); color: var(--accent); }
.badge-wrong { background: rgba(239,68,68,.1); color: var(--danger); }
.badge-exact { background: var(--gold-glow); color: var(--gold); }
.badge-active { background: rgba(15,77,184,.12); color: var(--accent); }
.badge-inactive { background: rgba(239,68,68,.1); color: var(--danger); }

/* Prediction Form (inline on match card) */
.prediction-form { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.prediction-options { display: flex; gap: 8px; margin-bottom: 8px; }
.prediction-options .pred-btn { flex: 1; padding: 8px; border: 2px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-primary); font-weight: 700; font-size: .82rem; transition: all var(--transition); text-align: center; cursor: pointer; }
.prediction-options .pred-btn:hover { border-color: var(--accent); }
.prediction-options .pred-btn.selected { border-color: var(--accent); background: var(--accent-glow); color: var(--accent); }
.exact-score-inputs { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.exact-score-inputs input { width: 60px; text-align: center; padding: 6px; font-size: .9rem; }
.exact-score-inputs .score-sep { font-weight: 800; color: var(--text-muted); }

/* ===== Leaderboard ===== */
.lb-rank { font-weight: 800; font-size: 1rem; }
.lb-.rank-up { color: var(--accent); }
.rank-down { color: #ef4444; }
.rank-same { color: #64748b; }

/* ===== Premium Effects ===== */
.pulse-glow { animation: pulseGlow 2s infinite; }
@keyframes pulseGlow { 0% { box-shadow: 0 0 0 0 rgba(15,77,184,0.4); } 70% { box-shadow: 0 0 0 10px rgba(15,77,184,0); } 100% { box-shadow: 0 0 0 0 rgba(15,77,184,0); } }

.podium-gold { background: linear-gradient(135deg, rgba(245,158,11,0.2), rgba(245,158,11,0.05)); border: 1px solid rgba(245,158,11,0.5) !important; position: relative; overflow: hidden; }
.podium-gold::after { content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); animation: shine 3s infinite; }
@keyframes shine { to { left: 200%; } }

.match-countdown { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 700; background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.lb-points { font-weight: 800; font-size: 1.1rem; color: var(--accent); }

/* ===== Hall of Fame ===== */
.hof-section { margin-bottom: 24px; }
.hof-section h4 { font-size: .95rem; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.hof-list { display: flex; flex-direction: column; gap: 6px; }
.hof-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--bg-input); border-radius: var(--radius-sm); }
.hof-item .hof-name { font-weight: 600; }
.hof-item .hof-value { font-weight: 800; color: var(--gold); }

/* ===== Adjustments Log ===== */
.adj-positive { color: var(--accent); font-weight: 700; }
.adj-negative { color: var(--danger); font-weight: 700; }

/* ===== Modals ===== */
.modal { position: fixed; inset: 0; background: var(--bg-modal); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-content.modal-wide { max-width: 600px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.close-modal { background: none; border: none; color: var(--text-muted); font-size: 1.5rem; cursor: pointer; transition: color var(--transition); }
.close-modal:hover { color: var(--danger); }
.modal form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border); margin-top: 8px; }
.modal-match-label { font-weight: 700; color: var(--text-secondary); text-align: center; font-size: .9rem; }
.score-input-container { display: flex; align-items: center; justify-content: center; gap: 16px; }
.team-score-input { text-align: center; }
.team-score-input label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.team-score-input input { width: 80px; text-align: center; font-size: 1.3rem; font-weight: 800; padding: 10px; }
.score-divider { font-size: 1.5rem; font-weight: 800; color: var(--text-muted); }

/* ===== Section Headers ===== */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.section-header h3 { font-size: 1.15rem; font-weight: 700; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .9rem; }

/* ===== Player Stats ===== */
.player-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 12px; }
.player-stat-item { background: var(--bg-input); border-radius: var(--radius-sm); padding: 10px; text-align: center; }
.player-stat-item .ps-value { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.player-stat-item .ps-label { font-size: .7rem; color: var(--text-muted); }

/* ===== Intro Animation (Stadium Floodlights) ===== */
.intro-overlay { position: fixed; inset: 0; background: #000; z-index: 100000; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: opacity 0.5s ease; }
.intro-overlay.hidden { opacity: 0; pointer-events: none; }
.beam { position: absolute; top: -20%; width: 150px; height: 150vh; background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%); filter: blur(25px); transform-origin: top center; opacity: 0; mix-blend-mode: screen; }
.beam-1 { left: 15%; animation: sweep1 2s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 0.2s; }
.beam-2 { left: 50%; animation: sweep2 2s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 0.6s; }
.beam-3 { left: 85%; animation: sweep3 2s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 0.4s; }

@keyframes sweep1 { 0% { transform: rotate(-60deg); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(15deg); opacity: 0; } }
@keyframes sweep2 { 0% { transform: rotate(45deg); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(0deg); opacity: 0; } }
@keyframes sweep3 { 0% { transform: rotate(60deg); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(-20deg); opacity: 0; } }

.intro-content { z-index: 2; opacity: 0; transform: scale(0.5); animation: revealLogo 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 1.8s; }
.intro-logo { width: 160px; height: 160px; filter: drop-shadow(0 0 30px var(--gold)); }
@keyframes revealLogo { to { opacity: 1; transform: scale(1); } }

.camera-flash { position: absolute; inset: 0; background: #fff; opacity: 0; z-index: 3; pointer-events: none; animation: flash 0.6s ease-out forwards; animation-delay: 3.2s; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--transition); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-mobile { display: block; }
  .toggle-sidebar-btn { display: flex; }
  .main-content { margin-left: 0; }
  .content-container { padding: 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .card-grid-2, .card-grid-3, .card-grid-4 { grid-template-columns: 1fr; }
  .match-teams { flex-direction: column; gap: 4px; }
  .score-input-container { flex-direction: row; }
  .auth-card { padding: 24px; }
}
@media (max-width: 480px) {
  html { font-size: 14px; }
  .brand-title { font-size: 1.6rem; }
}
