/* ── Variables ──────────────────────────── */
:root {
  --bg-primary:    #0a0e1a;
  --bg-secondary:  #111827;
  --bg-card:       #1a2236;
  --bg-card-hover: #1f2a40;
  --gold:          #c9a84c;
  --gold-light:    #e2c06a;
  --text-primary:  #f0f4ff;
  --text-secondary:#9aa5be;
  --text-muted:    #5a6580;
  --live-red:      #ef4444;
  --live-pulse:    #f87171;
  --green:         #22c55e;
  --border:        #1e2d45;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --transition:    0.2s ease;
}

/* ── Reset ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  direction: rtl;
}

body {
  font-family: 'Segoe UI', 'Noto Sans Arabic', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Scrollbar ──────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Header ─────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10,14,26,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

.header-logo span { font-size: 1.5rem; }

.header-actions { display: flex; gap: 8px; align-items: center; }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: var(--transition);
  color: var(--text-secondary);
}
.btn-icon:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* ── Navigation Tabs ────────────────────── */
.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 16px 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.nav-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: var(--bg-card);
}

/* ── Container ──────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 16px; }

/* ── Cards ──────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
}
.card:hover { border-color: var(--gold); box-shadow: var(--shadow); }

/* ── Match Card ─────────────────────────── */
.match-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: var(--transition);
  cursor: pointer;
}
.match-card:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.match-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.match-status-live {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--live-red);
  font-weight: 600;
  font-size: 0.75rem;
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--live-red);
  border-radius: 50%;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.4); }
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.match-team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  text-align: center;
}

.team-flag {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
}

.team-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.match-score {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gold);
  min-width: 80px;
  justify-content: center;
}

.score-divider {
  color: var(--text-muted);
  font-size: 1.2rem;
  font-weight: 300;
}

.match-time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
}

/* ── Live Badge ─────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-live    { background: rgba(239,68,68,0.15); color: var(--live-red); border: 1px solid rgba(239,68,68,0.3); }
.badge-gold    { background: rgba(201,168,76,0.15); color: var(--gold); border: 1px solid rgba(201,168,76,0.3); }
.badge-green   { background: rgba(34,197,94,0.15); color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.badge-gray    { background: rgba(90,101,128,0.2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Section Title ──────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: block;
  width: 3px;
  height: 18px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── Groups Grid ────────────────────────── */
.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.group-header {
  background: linear-gradient(135deg, var(--gold), #a07830);
  padding: 8px 14px;
  font-weight: 700;
  font-size: 0.875rem;
  color: #0a0e1a;
}

.group-team-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}
.group-team-row:last-child { border-bottom: none; }
.group-team-row:hover { background: var(--bg-card-hover); }

.group-team-flag {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.group-team-name { flex: 1; font-size: 0.875rem; font-weight: 500; }

.group-team-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.group-team-stats span { min-width: 20px; text-align: center; }

.group-stats-header {
  display: flex;
  gap: 12px;
  padding: 6px 14px 6px calc(14px + 28px + 10px);
  font-size: 0.7rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.group-stats-header span { min-width: 20px; text-align: center; }

/* ── Chat Bot ───────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 24px;
  left: 24px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: #0a0e1a;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(201,168,76,0.4);
  z-index: 200;
  transition: var(--transition);
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(201,168,76,0.5); }

.chat-panel {
  position: fixed;
  bottom: 90px;
  left: 16px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-height: 480px;
  transition: var(--transition);
}

.chat-panel.hidden { display: none; }

.chat-header {
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--gold), #a07830);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #0a0e1a;
  font-weight: 700;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.chat-msg {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-bot {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-radius: 4px var(--radius-sm) var(--radius-sm) var(--radius-sm);
}

.chat-msg-user {
  background: linear-gradient(135deg, rgba(201,168,76,0.2), rgba(160,120,48,0.2));
  border: 1px solid rgba(201,168,76,0.3);
  align-self: flex-end;
  border-radius: var(--radius-sm) 4px var(--radius-sm) var(--radius-sm);
  color: var(--gold-light);
}

.chat-msg-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 14px;
}
.chat-msg-typing span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.2s infinite;
}
.chat-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

.chat-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: var(--transition);
}
.chat-input:focus { border-color: var(--gold); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--gold);
  color: #0a0e1a;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-send:hover { background: var(--gold-light); }

/* ── Prediction Card ────────────────────── */
.prediction-card {
  background: linear-gradient(135deg, rgba(201,168,76,0.08), rgba(10,14,26,0));
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.prediction-title {
  font-size: 0.8rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.prediction-scores {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gold);
  text-align: center;
  margin-bottom: 10px;
}

.prob-bars { display: flex; flex-direction: column; gap: 6px; }

.prob-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.prob-label { width: 55px; color: var(--text-secondary); }

.prob-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.prob-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.8s ease;
}

.prob-pct { width: 36px; text-align: left; color: var(--text-muted); }

/* ── Stats Bars ─────────────────────────── */
.stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.stats-label { flex: 1; text-align: right; color: var(--text-secondary); }
.stats-bar-wrap {
  display: flex;
  gap: 3px;
  align-items: center;
  width: 160px;
}
.stats-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.6s ease;
}
.stats-bar.away { background: var(--text-muted); }
.stats-val { width: 30px; font-size: 0.75rem; color: var(--text-muted); }

/* ── Events Timeline ────────────────────── */
.events-list { display: flex; flex-direction: column; gap: 6px; }

.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  font-size: 0.8rem;
}
.event-minute {
  min-width: 32px;
  color: var(--gold);
  font-weight: 700;
  font-size: 0.75rem;
}
.event-icon { font-size: 1rem; }
.event-detail { flex: 1; color: var(--text-secondary); }

/* ── Buttons ─────────────────────────────  */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a07830);
  color: #0a0e1a;
}
.btn-gold:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-outline {
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

/* ── Push Banner ────────────────────────── */
.push-banner {
  background: linear-gradient(135deg, rgba(201,168,76,0.12), rgba(10,14,26,0));
  border: 1px solid rgba(201,168,76,0.25);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.push-banner-text { font-size: 0.875rem; color: var(--text-secondary); }
.push-banner-text strong { color: var(--text-primary); display: block; margin-bottom: 2px; }

/* ── Toast ───────────────────────────────  */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 0.875rem;
  color: var(--text-primary);
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease;
  white-space: nowrap;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error   { border-color: var(--live-red); color: var(--live-red); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Skeleton Loader ────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 600px) {
  .groups-grid { grid-template-columns: 1fr; }
  .chat-panel  { width: calc(100vw - 32px); left: 16px; }
  .match-score { font-size: 1.4rem; }
  .team-flag   { width: 38px; height: 38px; }
  .container   { padding: 10px; }
}

/* ── Tabs Content ───────────────────────── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Empty State ────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ── Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 16px;
  border-top: 1px solid var(--border);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ── Standings Table ────────────────────── */
.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.standings-table th {
  color: var(--text-muted);
  font-weight: 500;
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.standings-table th:first-child { text-align: right; }
.standings-table td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid rgba(30,45,69,0.5);
}
.standings-table td:first-child { text-align: right; }
.standings-table tr:hover td { background: var(--bg-card-hover); }
.standings-table .qualified { color: var(--green); }

/* ── Notification Level Selector ───────── */
.notif-levels {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.notif-level-btn {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: var(--transition);
}
.notif-level-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,168,76,0.1);
}

/* ── Suggestions ────────────────────────── */
.chat-suggestions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.suggestion-chip {
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.suggestion-chip:hover { border-color: var(--gold); color: var(--gold); }