/* =========================================================================
   DubaiQuest — Shared Design System
   Premium Dubai aesthetic: deep navy night sky, warm desert sand, gold
   accents. CSS custom properties drive per-location dynamic theming — JS
   overrides --color-primary/--color-secondary/--color-accent on
   :root (or on a themed container) when a neighborhood is chosen so the
   whole UI re-skins without touching this stylesheet.
   ========================================================================= */

:root {
  /* Brand defaults (Downtown Dubai gold/navy — used until a location is
     picked, and as the fallback if a location has no theme data yet). */
  --color-primary: #D4AF37;      /* gold */
  --color-secondary: #0B1E30;    /* deep navy */
  --color-accent: #F2E6C9;       /* warm sand */

  /* Fixed neutrals — do not vary per-location */
  --color-bg: #081422;
  --color-bg-elevated: #0E2338;
  --color-surface: #122A42;
  --color-text: #F5EFE2;
  --color-text-muted: #B9C2CE;
  --color-border: rgba(242, 230, 201, 0.14);
  --color-success: #2AA96C;
  --color-danger: #D64545;
  --color-warning: #E0A25E;

  /* Derived / rgb helpers for translucency (JS may also set these directly
     when it knows the location's hex values, to keep glow effects tinted
     correctly per-location) */
  --color-primary-rgb: 212, 175, 55;
  --color-secondary-rgb: 11, 30, 48;

  --font-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 32px rgba(var(--color-primary-rgb), 0.35);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .dq-display {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

a { color: var(--color-primary); }
a:hover { color: var(--color-accent); }

.dq-text-muted { color: var(--color-text-muted); }

/* =========================================================================
   Hero / landing background
   ========================================================================= */

.dq-hero {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px 16px;
  background:
    radial-gradient(ellipse 90% 60% at 50% 0%, rgba(var(--color-primary-rgb), 0.20), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 100%, rgba(var(--color-primary-rgb), 0.12), transparent 60%),
    linear-gradient(180deg, #0A1B2C 0%, #081422 55%, #050D16 100%);
}

.dq-hero::before {
  /* stylized desert-dune horizon, pure CSS, no imagery */
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -6%;
  height: 42%;
  background: linear-gradient(180deg, transparent 0%, rgba(224, 162, 94, 0.16) 100%);
  clip-path: polygon(0% 60%, 8% 48%, 20% 58%, 34% 40%, 48% 55%, 62% 38%, 76% 52%, 90% 42%, 100% 55%, 100% 100%, 0% 100%);
  pointer-events: none;
}

.dq-hero::after {
  /* faint skyline silhouette + starfield, evoking Dubai at dusk */
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(245,239,226,0.8), transparent),
    radial-gradient(1.5px 1.5px at 78% 12%, rgba(245,239,226,0.6), transparent),
    radial-gradient(1px 1px at 34% 30%, rgba(245,239,226,0.55), transparent),
    radial-gradient(1px 1px at 60% 22%, rgba(245,239,226,0.5), transparent),
    radial-gradient(1.5px 1.5px at 90% 35%, rgba(245,239,226,0.5), transparent),
    linear-gradient(180deg, transparent 55%, rgba(var(--color-secondary-rgb), 0.55) 100%);
  pointer-events: none;
}

.dq-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  text-align: center;
}

.dq-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.dq-brand-mark .dq-brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: var(--color-secondary);
  font-size: 1.4rem;
  box-shadow: var(--shadow-glow);
}

.dq-brand-mark .dq-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--color-text);
}

.dq-brand-mark .dq-brand-name span {
  color: var(--color-primary);
}

.dq-tagline {
  color: var(--color-text-muted);
  margin-bottom: 0;
}

/* =========================================================================
   Modal ("Choose your Dubai neighborhood")
   ========================================================================= */

.dq-modal .modal-content {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--color-text);
  box-shadow: var(--shadow-soft);
}

.dq-modal .modal-header {
  border-bottom: 1px solid var(--color-border);
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 24px 16px;
}

.dq-modal .modal-header .dq-modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: radial-gradient(circle at 30% 30%, var(--color-accent), var(--color-primary));
  color: var(--color-secondary);
  margin-bottom: 14px;
  box-shadow: var(--shadow-glow);
}

.dq-modal .modal-title {
  font-weight: 700;
  font-size: 1.35rem;
}

.dq-modal .modal-subtitle {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin-top: 6px;
  margin-bottom: 0;
}

.dq-modal .modal-body { padding: 22px 26px 8px; }
.dq-modal .modal-footer {
  border-top: 1px solid var(--color-border);
  padding: 16px 26px 24px;
  justify-content: center;
}

.dq-modal .form-select,
.dq-modal .form-control {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.dq-modal .form-select:focus,
.dq-modal .form-control:focus {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 0.2rem rgba(var(--color-primary-rgb), 0.25);
}

.dq-modal .form-select option { color: #111; }

.dq-modal .form-check-label a { text-decoration: underline; }

.dq-location-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* Nav tabs (Login / Register) */
.dq-modal .nav-tabs {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 18px;
}

.dq-modal .nav-tabs .nav-link {
  color: var(--color-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  padding: 10px 4px;
  margin-right: 20px;
  background: transparent;
}

.dq-modal .nav-tabs .nav-link.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: transparent;
}

.btn-dq-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border: none;
  color: var(--color-secondary);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn-dq-primary:hover,
.btn-dq-primary:focus {
  filter: brightness(1.08);
  color: var(--color-secondary);
}

.btn-dq-primary:disabled {
  opacity: 0.55;
}

.btn-dq-link {
  background: transparent;
  border: none;
  color: var(--color-primary);
  font-size: 0.88rem;
  padding: 0;
}
.btn-dq-link:hover { color: var(--color-accent); text-decoration: underline; }

.dq-footer-links {
  position: fixed;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

.dq-footer-links a { color: var(--color-text-muted); text-decoration: none; }
.dq-footer-links a:hover { color: var(--color-primary); }
.dq-footer-links .dq-sep { margin: 0 8px; opacity: 0.5; }

/* =========================================================================
   Static content pages (privacy / terms)
   ========================================================================= */

.dq-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

.dq-page .dq-page-header { margin-bottom: 32px; }

.dq-page section { margin-bottom: 28px; }

.dq-page .card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.dq-navbar {
  background: rgba(8, 20, 34, 0.85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}

.dq-navbar .navbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-text) !important;
}
.dq-navbar .navbar-brand span { color: var(--color-primary); }

/* =========================================================================
   Play shell / HUD overlay
   ========================================================================= */

.dq-play-body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--color-secondary);
}

#game-root {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(var(--color-primary-rgb), 0.10), transparent 60%), var(--color-secondary);
}

#game-canvas-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#game-canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

#hud-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--color-secondary);
  color: var(--color-text-muted);
  z-index: 20;
  transition: opacity 0.4s ease;
}

#hud-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none; /* children re-enable as needed */
  font-family: var(--font-body);
}

#hud-overlay .hud-pane,
#hud-overlay .btn {
  pointer-events: auto;
}

.hud-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 10px;
}

.hud-pane {
  background: rgba(8, 20, 34, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
}

.hud-points-pane {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  box-shadow: var(--shadow-glow);
}

.hud-points-pane .hud-coin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--color-accent), var(--color-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--color-secondary);
  font-weight: 800;
}

#hud-points {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.hud-points-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  display: block;
}

.hud-controls-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 20, 34, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 1.1rem;
}

.hud-icon-btn:hover,
.hud-icon-btn:focus {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.hud-icon-btn.is-active {
  color: var(--color-secondary);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
}

.hud-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 10px;
}

.hud-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: rgba(245, 239, 226, 0.55);
  border: 1px solid rgba(8, 20, 34, 0.6);
  z-index: 9;
}

.hud-location-chip {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  padding: 8px 14px;
}

.hud-location-chip strong { color: var(--color-primary); }

#hud-toast-zone {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

/* Leaderboard offcanvas */
.offcanvas.dq-leaderboard {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  border-left: 1px solid var(--color-border);
  max-width: 380px;
}

.dq-leaderboard-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-border);
}

.dq-leaderboard-row .dq-rank {
  width: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.dq-leaderboard-row.is-you {
  background: rgba(var(--color-primary-rgb), 0.10);
  border-radius: var(--radius-sm);
}

/* Help modal shortcut keys */
.dq-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  font-family: var(--font-display);
  font-size: 0.82rem;
  margin-right: 6px;
}

@media (max-width: 576px) {
  .dq-hero-inner { max-width: 100%; }
  .dq-modal .modal-body { padding: 18px 18px 4px; }
  .hud-top-bar, .hud-bottom-bar { padding: 10px; }
  .hud-controls-group { gap: 6px; }
  .hud-icon-btn { width: 40px; height: 40px; font-size: 1rem; }
  #hud-points { font-size: 1.05rem; }
}
