/* CrashX - Main Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #7c3aed;
  --primary-light: #8b5cf6;
  --primary-dark: #6d28d9;
  --primary-bg: rgba(124,58,237,0.08);
  --bg: #ffffff;
  --bg-secondary: #f8f7ff;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-secondary: #141428;
  --bg-card: #1a1a2e;
  --border: #2d2d4e;
  --border-light: #252540;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
  --primary-bg: rgba(124,58,237,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-secondary);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

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

/* ── Typography ── */
h1,h2,h3,h4 { font-weight: 700; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ── Navbar ── */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 900;
  color: var(--text);
  text-decoration: none;
}
.navbar-brand .logo-icon { font-size: 26px; }
.navbar-brand span { color: var(--primary); }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: all .2s;
}
.navbar-nav a:hover, .navbar-nav a.active {
  color: var(--primary);
  background: var(--primary-bg);
}
.navbar-nav a svg { width: 16px; height: 16px; }
.navbar-actions { display: flex; align-items: center; gap: 10px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .2s;
  border: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.4); }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius); }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
  background: var(--bg-card);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control.has-icon-left { padding-left: 40px; }
.input-wrapper { position: relative; }
.input-icon-left, .input-icon-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-icon-left { left: 12px; }
.input-icon-right { right: 12px; }
.input-toggle { pointer-events: all; cursor: pointer; }
.input-toggle:hover { color: var(--primary); }

/* ── Alert ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger   { background: var(--danger-bg);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning  { background: var(--warning-bg); color: #92400e; border: 1px solid #fcd34d; }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ── Crash Chips (history) ── */
.crash-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}
.crash-chip.very-high { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.crash-chip.high      { background: #dcfce7; color: #166534; border-color: #86efac; }
.crash-chip.med       { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.crash-chip.low       { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }

/* ── Layout ── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.page-content { padding: 24px 0; }

/* ── Game Layout ── */
.game-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Login panel (left side) ── */
.auth-panel .card-body { padding: 28px; }
.auth-panel h2 { font-size: 22px; margin-bottom: 4px; }
.auth-panel .subtitle { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 24px; }
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.how-to-play { margin-top: 24px; }
.how-to-play h4 { font-size: 14px; margin-bottom: 14px; }
.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
}
.step-num {
  width: 24px;
  height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.rocket-illustration {
  text-align: center;
  padding: 16px 0 0;
  opacity: 0.15;
  font-size: 80px;
}

/* ── Game panel (right side) ── */
.game-panel {}

/* ── Game top bar ── */
.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 8px;
}
.history-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}
.live-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ── Crash Chart ── */
.crash-chart-area {
  position: relative;
  height: 320px;
  overflow: hidden;
  padding: 20px;
  background: linear-gradient(160deg, #fafaff 0%, #f0f0ff 100%);
}
[data-theme="dark"] .crash-chart-area {
  background: linear-gradient(160deg, #12122a 0%, #0f0f1e 100%);
}
#crashCanvas { width: 100%; height: 100%; }

.multiplier-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  text-align: center;
  pointer-events: none;
  transition: color 0.3s;
}
.multiplier-overlay .mult-value {
  font-size: 68px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -3px;
  color: var(--primary);
  transition: color 0.3s;
}
.multiplier-overlay .mult-value.crashed { color: var(--danger); }
.multiplier-overlay .mult-value.moon { color: var(--warning); }
.multiplier-overlay .mult-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 4px;
}
.multiplier-overlay .mult-label.crashed { color: var(--danger); }

.players-online {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
.players-online svg { color: var(--primary); }

/* ── Bet controls ── */
.bet-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  gap: 16px;
  align-items: end;
  padding: 20px;
  border-top: 1px solid var(--border-light);
}
.bet-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.bet-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s;
}
.bet-input-wrapper:focus-within { border-color: var(--primary); }
.bet-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  width: 80px;
  min-width: 0;
}
.bet-currency {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.bet-quick-btns {
  display: flex;
  gap: 0;
  border-left: 1px solid var(--border);
}
.bet-quick-btn {
  padding: 4px 10px;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Inter', sans-serif;
}
.bet-quick-btn:first-child { border-left: none; }
.bet-quick-btn:hover { background: var(--primary-bg); color: var(--primary); }
.mult-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0 12px;
  cursor: pointer;
  font-size: 16px;
  transition: color .2s;
}
.mult-clear-btn:hover { color: var(--danger); }

/* ── Crash Button ── */
.btn-crash {
  width: 100%;
  height: 64px;
  font-size: 16px;
  font-weight: 800;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.btn-crash.start-state {
  background: var(--primary);
  color: #fff;
}
.btn-crash.start-state:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124,58,237,0.4);
}
.btn-crash.cashout-state {
  background: var(--success);
  color: #fff;
  animation: cash-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes cash-pulse {
  from { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  to   { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}
.btn-crash.wait-state {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1.5px dashed var(--border);
  cursor: not-allowed;
}
.btn-crash.crashed-state {
  background: var(--danger);
  color: #fff;
  cursor: not-allowed;
}
.btn-crash-sub { font-size: 11px; font-weight: 400; opacity: 0.85; }

/* ── Recent Crashes section ── */
.recent-crashes {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
}
.recent-crashes h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
}
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Leaderboard table ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg-secondary); }

/* ── User logged in top nav ── */
.user-balance-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--primary-bg);
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  border: 1px solid rgba(124,58,237,0.2);
}

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  transform: translateY(20px);
  transition: transform .25s;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 18px; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--bg-secondary); }
.modal-body { padding: 20px 24px 24px; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slide-toast .3s ease;
  max-width: 320px;
}
@keyframes slide-toast {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast-success { background: var(--success); color: #fff; }
.toast-error   { background: var(--danger);  color: #fff; }
.toast-info    { background: var(--primary); color: #fff; }

/* ── Deposit / Withdraw pages ── */
.payment-page { max-width: 820px; margin: 0 auto; }
.method-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.method-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  background: var(--bg-card);
}
.method-card:hover, .method-card.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.method-card .method-icon { font-size: 28px; margin-bottom: 8px; }
.method-card .method-name { font-size: 13px; font-weight: 600; }
.method-card .method-status { font-size: 11px; color: var(--success); margin-top: 2px; }
.method-card .method-status.soon { color: var(--warning); }

/* ── Admin ── */
.admin-sidebar {
  width: 240px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  padding: 20px 0;
  z-index: 50;
}
.admin-brand {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 900;
  color: var(--primary);
}
.admin-brand small { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.admin-nav-item:hover, .admin-nav-item.active {
  color: var(--primary);
  background: var(--primary-bg);
  border-left-color: var(--primary);
}
.admin-content { margin-left: 240px; padding: 24px; min-height: 100vh; background: var(--bg-secondary); }
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }

/* ── Footer ── */
.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); font-size: 12.5px; }
.footer-links a:hover { color: var(--primary); }
.provably-fair { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .game-layout { grid-template-columns: 1fr; }
  .auth-panel { max-width: 100%; }
  .bet-controls { grid-template-columns: 1fr 1fr; }
  .btn-crash { grid-column: span 2; }
}
@media (max-width: 768px) {
  .navbar { padding: 0 12px; }
  .navbar-nav { display: none; }
  .bet-controls { grid-template-columns: 1fr; gap: 12px; }
  .btn-crash { grid-column: span 1; }
  .admin-sidebar { display: none; }
  .admin-content { margin-left: 0; }
  .multiplier-overlay .mult-value { font-size: 48px; }
  .crash-chart-area { height: 240px; }
}
@media (max-width: 480px) {
  .page-content { padding: 12px 0; }
  .card-body { padding: 16px; }
  .auth-panel .card-body { padding: 20px; }
}
