/* ── Nujum Theme — Color tokens, typography, responsive ── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  /* Space — DL v2: deep indigo, not black (§3 L0) */
  --bg-deep: #0a0724;
  --bg-surface: rgba(255,255,255,0.05);
  --bg-surface-hover: rgba(255,255,255,0.08);
  --bg-surface-active: rgba(255,255,255,0.12);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);

  /* DL v2 surface hierarchy (§4) — hero illuminated, quiet default, inset sub-blocks */
  --gold-glow: rgba(255,212,112,0.06);
  /* WS-7 element palette — transparent by default (no glow) until the flag
     sets a per-element color. Keeps the wheel unchanged when gated off. */
  --wheel-glow: transparent;
  --surface-hero-fill: rgba(255,255,255,0.05);
  --surface-hero-border: rgba(255,212,112,0.5);   /* soft gold gradient, ≤.5 alpha */
  --surface-quiet-fill: rgba(255,255,255,0.04);
  --surface-quiet-border: rgba(255,255,255,0.06);
  --surface-inset-fill: rgba(255,255,255,0.03);

  /* Text */
  --text-primary: rgba(255,255,255,0.92);
  --text-secondary: rgba(255,255,255,0.60);
  --text-muted: rgba(255,255,255,0.35);

  /* Accent gradient stops */
  --gold: #ffd470;
  --orange: #ff9d50;
  --pink: #ff6eb0;
  --purple: #b06eff;
  --blue: #6eb0ff;
  --teal: #6effd4;

  /* Semantic */
  --planet-color: #ffd470;
  --house-color: #6eb0ff;
  --transit-color: #ff9d50;
  --favorable: #6effd4;
  --unfavorable: #ff6eb0;
  --neutral: #ffd470;

  /* Aspect colors */
  --aspect-trine: #6eb0ff;
  --aspect-sextile: #6eb0ff;
  --aspect-square: #ff6eb0;
  --aspect-opposition: #ff6eb0;
  --aspect-conjunction: #6effd4;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Radius — DL v2 scale (§4): hero 24 / quiet 16 / inset 12 / chip 999 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --radius-hero: 24px;
  --radius-quiet: 16px;
  --radius-inset: 12px;

  /* Typography */
  --font-en: 'Nunito', sans-serif;
  --font-ar: 'Noto Naskh Arabic', serif;
  /* DL v2 §5: AR display face (Noto Kufi) for mansion names, verdict words,
     screen titles, hero numerals. Latin falls through to Nunito. Naskh never
     sets a hero word; this face never sets body prose. */
  --font-ar-display: 'Noto Kufi Arabic', 'Nunito', sans-serif;
  --font-body: var(--font-en);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;

  /* Transition */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 200ms;

  /* Z-index layers */
  --z-bg: -1;
  --z-base: 0;
  --z-nav: 100;
  --z-modal: 200;
  --z-toast: 300;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.rtl {
  font-family: var(--font-ar);
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}
a:hover { color: var(--orange); }

img { max-width: 100%; display: block; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ── Gradient text ───────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, var(--gold), var(--orange), var(--pink), var(--purple), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: var(--text-base);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  color: #08061a;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255,157,80,0.3);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text-primary); }

.btn-sm {
  padding: 8px 16px;
  font-size: var(--text-sm);
}

.btn-lg {
  padding: 16px 32px;
  font-size: var(--text-lg);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Inputs ──────────────────────────────────────── */
.input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color var(--duration) var(--ease);
  backdrop-filter: blur(10px);
}
.input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255,212,112,0.1);
}
.input::placeholder {
  color: var(--text-muted);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.input-group label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: 600;
}
.dob-selects {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 8px;
}
.dob-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='rgba(255,255,255,0.4)' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-inline-end: 28px;
  cursor: pointer;
}
[dir="rtl"] .dob-select {
  background-position: left 10px center;
}
select.input option {
  background: #1a1530;
  color: #fff;
}

/* ── Layout ──────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-wide {
  max-width: 960px;
}

.section {
  padding: var(--space-2xl) 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.text-center { text-align: center; }

.hidden { display: none !important; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* ── Responsive ──────────────────────────────────── */
@media (min-width: 640px) {
  .container { max-width: 560px; }
  .container-wide { max-width: 960px; }
}

@media (min-width: 768px) {
  .container { max-width: 640px; }
}

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

/* ── Toast ───────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  font-size: var(--text-sm);
  color: var(--text-primary);
  animation: toastIn 0.3s var(--ease), toastOut 0.3s var(--ease) 2.7s forwards;
  pointer-events: auto;
  white-space: nowrap;
}
.toast.error { border-color: var(--unfavorable); }
.toast.success { border-color: var(--favorable); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
