/* القمة | Al-Qimma v2 — Shared design tokens & components for non-game pages.
   Game pages (display/player/admin) keep their own self-contained styles. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
*:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

:root {
  --bg: #0B1426;
  --bg2: #11203A;
  --bg3: #1A2D4F;
  --gold: #D4A853;
  --gold-soft: #F5D78E;
  --red: #EF4444;
  --green: #10B981;
  --blue: #3B82F6;
  --purple: #8B5CF6;
  --orange: #F59E0B;
  --white: #FFFFFF;
  --white80: #C9D1DA;
  --white60: #9BA8B7;
  --white30: #728394;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --glow: 0 0 40px rgba(212, 168, 83, 0.25);
}

html, body {
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(212,168,83,0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(59,130,246,0.12), transparent 60%),
    linear-gradient(180deg, #0B1426 0%, #0F1D35 40%, #11203A 100%);
  background-attachment: fixed;
  color: var(--white);
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.container-sm { max-width: 460px; margin: 0 auto; padding: 24px; }
.container-md { max-width: 720px; margin: 0 auto; padding: 24px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  background: rgba(11, 20, 38, 0.6); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  font-size: 22px; font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.topbar .nav { display: flex; gap: 12px; align-items: center; }
.topbar .user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 14px;
}
.topbar .user-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--green);
}

/* ── Typography ── */

h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 900; line-height: 1.2; }
h2 { font-size: 28px; font-weight: 800; line-height: 1.3; margin-bottom: 12px; }
h3 { font-size: 22px; font-weight: 700; line-height: 1.3; margin-bottom: 8px; }

.gradient-text {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft), var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.muted { color: var(--white60); }
.muted-strong { color: var(--white30); }

/* ── Cards ── */

.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px;
}
.card-hover {
  transition: border-color 0.2s, transform 0.2s;
}
.card-hover:hover {
  border-color: rgba(212, 168, 83, 0.4); transform: translateY(-2px);
}

/* ── Forms ── */

.field { margin-bottom: 14px; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 14px; font-weight: 600; color: var(--white60);
}
.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 14px;
  border-radius: 12px; border: 1.5px solid var(--line-strong);
  background: var(--bg3); color: var(--white);
  font-family: inherit; font-size: 16px; font-weight: 500;
  outline: none; transition: border-color 0.15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); }
.textarea { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--white30); }

.field-error {
  margin-top: 6px; font-size: 13px; color: var(--red);
  display: none;
}
.field-error.show { display: block; }

/* ── Buttons ── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px;
  border-radius: 12px; border: none;
  font-family: inherit; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform 0.1s, opacity 0.15s, background 0.15s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: var(--bg);
}
.btn-primary:hover { text-decoration: none; }
.btn-secondary {
  background: var(--bg3); color: var(--white);
  border: 1.5px solid var(--line-strong);
}
.btn-secondary:hover { border-color: var(--gold); text-decoration: none; }
.btn-ghost {
  background: transparent; color: var(--white60);
  border: 1.5px solid transparent;
}
.btn-ghost:hover { color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-block { width: 100%; }
.btn-sm { height: 38px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 56px; padding: 0 28px; font-size: 18px; }

/* ── Alerts & toasts ── */

.alert {
  padding: 12px 16px; border-radius: 10px;
  font-size: 14px; margin-bottom: 16px;
}
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #FCA5A5; }
.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: #6EE7B7; }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.3); color: #93C5FD; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 20px; border-radius: 12px;
  background: var(--bg2); border: 1px solid var(--gold); color: var(--white);
  font-size: 14px; font-weight: 600; z-index: 1000;
  animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Badges & chips ── */

.badge {
  display: inline-block; padding: 4px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-draft { background: rgba(155, 168, 183, 0.15); color: var(--white60); }
.badge-running { background: rgba(16, 185, 129, 0.15); color: var(--green); }
.badge-ended { background: rgba(59, 130, 246, 0.15); color: var(--blue); }

/* ── Utilities ── */

.hidden { display: none !important; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }

/* ── Loading spinner ── */

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
