/* ═══════════════════════════════════════════════════════════════════════════
   SPACE MONOPOLY — Global Styles
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:          #050510;
  --bg2:         #0a0a1e;
  --bg3:         #0d1230;
  --surface:     #111827;
  --surface2:    #1a2035;
  --border:      #1e3a5f;
  --border2:     #243b60;
  --text:        #e0e8f0;
  --text-dim:    #7a9ab5;
  --text-muted:  #3a5070;
  --accent:      #00d4ff;
  --accent2:     #0099cc;
  --accent-glow: rgba(0,212,255,0.3);
  --orange:      #ff6b35;
  --gold:        #ffd700;
  --green:       #22c55e;
  --red:         #ef4444;
  --purple:      #a855f7;
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono:   'Courier New', monospace;
  --radius:      8px;
  --radius-lg:   14px;
  --shadow:      0 4px 24px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(0,212,255,0.2);
  --transition:  0.2s ease;
}

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

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

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

/* ═══════════════════════════════════════════════════════════════════════════
   STARFIELD
   ═══════════════════════════════════════════════════════════════════════════ */
.stars, .stars2, .stars3 {
  position: fixed; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  width: 2px; height: 2px;
  animation: twinkle 3s infinite alternate;
}
.stars2 .star { width: 3px; height: 3px; opacity: 0.6; animation-duration: 4s; }
.stars3 .star { width: 4px; height: 4px; opacity: 0.4; animation-duration: 5s; }

@keyframes twinkle {
  from { opacity: 0.2; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.2); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border: none; border-radius: var(--radius);
  font: 600 14px var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative; overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.06); }
.btn:active       { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000;
  box-shadow: 0 0 15px rgba(0,212,255,0.3);
}
.btn-primary:hover { box-shadow: 0 0 25px rgba(0,212,255,0.5); color: #000; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #cc0000; }

.btn-full  { width: 100%; justify-content: center; }
.btn-sm    { padding: 6px 14px; font-size: 13px; }
.btn-xs    { padding: 4px 10px; font-size: 12px; }
.btn-icon  { font-size: 16px; }
.disabled  { opacity: 0.5; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select.select-input,
textarea {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  font: 14px var(--font);
  padding: 10px 14px;
  outline: none;
  transition: var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.15);
}

input[type="color"] {
  width: 48px; height: 38px;
  padding: 4px;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-icon { font-size: 18px; }
.alert-error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.alert-info    { background: rgba(0,212,255,0.1); border: 1px solid rgba(0,212,255,0.3); color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-active  { background: rgba(34,197,94,0.15);  color: var(--green); border: 1px solid rgba(34,197,94,0.3); }
.badge-waiting { background: rgba(255,215,0,0.1);   color: var(--gold);  border: 1px solid rgba(255,215,0,0.3); }
.badge-paused  { background: rgba(168,85,247,0.1);  color: var(--purple);border: 1px solid rgba(168,85,247,0.3);}
.badge-finished{ background: rgba(100,116,139,0.2); color: #94a3b8;      border: 1px solid rgba(100,116,139,0.3);}
.badge-inactive{ background: rgba(239,68,68,0.1);   color: #f87171;      border: 1px solid rgba(239,68,68,0.3); }
.badge-alert   { background: var(--orange); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
   ═══════════════════════════════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); }
.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 480px;
  width: 90%;
  z-index: 1;
  box-shadow: var(--shadow), var(--shadow-glow);
  animation: modal-in 0.2s ease;
}
.modal-box--wide { max-width: 700px; }
.modal-box--win  { max-width: 540px; text-align: center; }
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text-dim);
  font-size: 18px; cursor: pointer;
  transition: var(--transition);
}
.modal-close:hover { color: var(--text); }
.modal-title { font-size: 20px; font-weight: 700; margin-bottom: 16px; color: var(--accent); }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(-10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAV
   ═══════════════════════════════════════════════════════════════════════════ */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: rgba(5,5,16,0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: 0.05em; }
.nav-logo  { font-size: 22px; }
.nav-user  { display: flex; align-items: center; gap: 12px; }
.nav-username { font-size: 14px; color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}

.login-container { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 20px; }

.login-card {
  background: rgba(13,18,48,0.95);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow), 0 0 60px rgba(0,212,255,0.1);
}

.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 32px; font-weight: 900;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, var(--accent), #7b4fff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
  margin: 16px 0 6px;
}
.login-logo h1 span { display: block; }
.login-sub { color: var(--text-dim); font-size: 14px; letter-spacing: 0.1em; }

/* Planet icon (CSS only) */
.planet-icon { position: relative; display: inline-block; width: 64px; height: 64px; margin: 0 auto; }
.planet-body {
  width: 48px; height: 48px;
  background: radial-gradient(circle at 35% 35%, #3b5bdb, #0a0a4e);
  border-radius: 50%;
  position: absolute; top: 8px; left: 8px;
  box-shadow: 0 0 20px rgba(0,212,255,0.4);
  animation: planet-spin 8s linear infinite;
}
.planet-ring {
  position: absolute; top: 22px; left: -2px;
  width: 68px; height: 22px;
  border: 3px solid rgba(0,212,255,0.5);
  border-radius: 50%;
  transform: rotateX(75deg);
  box-shadow: 0 0 10px rgba(0,212,255,0.3);
}
@keyframes planet-spin {
  from { box-shadow: inset -6px -6px 0 rgba(0,0,0,0.4), 0 0 20px rgba(0,212,255,0.4); }
  to   { box-shadow: inset -6px -6px 0 rgba(0,0,0,0.4), 0 0 30px rgba(0,212,255,0.6); }
}

.login-form { display: flex; flex-direction: column; gap: 4px; }
.login-footer { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 24px; line-height: 1.6; }

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.dashboard-page { min-height: 100vh; }
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  gap: 24px;
  position: relative; z-index: 1;
}

.stats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  height: fit-content;
  position: sticky;
  top: 84px;
}
.stats-avatar {
  width: 72px; height: 72px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 800;
  margin: 0 auto 14px;
  background: var(--bg3);
  box-shadow: 0 0 20px rgba(0,212,255,0.3);
}
.stats-panel h2 { font-size: 18px; margin-bottom: 4px; }
.rank-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 20px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.stat-item {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px 8px;
  border: 1px solid var(--border);
}
.stat-value { font-size: 20px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.dashboard-main { min-width: 0; }

.section { margin-bottom: 28px; }
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}
.section-icon { font-size: 20px; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.game-card:hover { border-color: var(--border2); box-shadow: var(--shadow-glow); transform: translateY(-2px); }
.game-card--my-turn {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0,212,255,0.2);
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0%,100% { box-shadow: 0 0 15px rgba(0,212,255,0.2); }
  50%      { box-shadow: 0 0 30px rgba(0,212,255,0.4); }
}

.turn-badge {
  position: absolute; top: -1px; right: -1px;
  background: var(--accent);
  color: #000;
  font-size: 10px; font-weight: 800;
  padding: 4px 10px;
  border-radius: 0 var(--radius-lg) 0 var(--radius);
  letter-spacing: 0.05em;
  animation: turn-pulse 1.5s infinite;
}
@keyframes turn-pulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.7; }
}

.game-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.game-token { font-size: 28px; filter: drop-shadow(0 0 8px currentColor); }
.game-name  { font-weight: 700; font-size: 15px; }
.game-meta  { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.game-status { margin-left: auto; }

.game-card-body { padding: 14px 16px; }
.game-credits { display: flex; justify-content: space-between; align-items: center; }
.credits-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; }
.credits-value { font-size: 20px; font-weight: 800; color: var(--gold); font-family: var(--font-mono); }

.game-card-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.history-item--win { border-color: rgba(255,215,0,0.3); }
.history-token  { font-size: 20px; }
.history-name   { flex: 1; font-weight: 600; }
.history-date   { color: var(--text-dim); }
.history-result { font-weight: 700; min-width: 90px; }
.result-win  { color: var(--gold); }
.result-loss { color: var(--text-muted); }

/* status colors */
.game-status.status-active  { color: var(--green); }
.game-status.status-waiting { color: var(--gold); }
.game-status.status-paused  { color: var(--purple); }
.game-status.status-finished{ color: var(--text-dim); }
