@import url('https://fonts.googleapis.com/css2?family=Exo+2:wght@400;500;600;700;800&family=Orbitron:wght@400;500;600;700&display=swap');

:root {
  /* Core palette - Dark casino theme */
  --bg-primary: #0a0e17;
  --bg-secondary: #0f1422;
  --bg-tertiary: #141a2a;
  --bg-card: #161d2f;
  --bg-card-hover: #1c2540;
  
  /* Accent colors - Neon glow */
  --accent-primary: #00ff88;
  --accent-primary-dim: #00cc6a;
  --accent-secondary: #00d4ff;
  --accent-tertiary: #7c3aed;
  --accent-gold: #ffd700;
  --accent-orange: #ff6b35;
  
  /* Status colors */
  --success: #00ff88;
  --error: #ff4757;
  --warning: #ffa502;
  --info: #00d4ff;
  
  /* Text colors */
  --text-primary: #ffffff;
  --text-secondary: #a0aec0;
  --text-muted: #64748b;
  
  /* Borders & shadows */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(0, 255, 136, 0.3);
  --glow-green: 0 0 20px rgba(0, 255, 136, 0.3), 0 0 40px rgba(0, 255, 136, 0.1);
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.3), 0 0 40px rgba(0, 212, 255, 0.1);
  --glow-gold: 0 0 20px rgba(255, 215, 0, 0.3), 0 0 40px rgba(255, 215, 0, 0.1);
  
  /* Card shadows */
  --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-card-hover: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg-primary);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 255, 136, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 212, 255, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(124, 58, 237, 0.05) 0%, transparent 40%);
  color: var(--text-primary);
  font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animated background grid */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(0, 255, 136, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 136, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

/* ========================================
   AUTH BAR - Sticky top navigation
   ======================================== */
.auth-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  opacity: 0.5;
}

.auth-bar__right {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Balance display in auth bar */
.auth-bar .balance-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'Orbitron', monospace;
  font-weight: 600;
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.auth-bar .balance-display::before {
  content: '💰';
  font-size: 16px;
}

/* ========================================
   PAGE CONTAINER
   ======================================== */
.page {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.page__title {
  font-family: 'Orbitron', sans-serif;
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 50%, var(--accent-primary) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  animation: shimmer 3s ease-in-out infinite;
  letter-spacing: 2px;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 200% center; }
}

.section-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 2px;
}

/* ========================================
   CONTROLS PANEL - Main action area
   ======================================== */
.controls {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.controls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.control-group .row {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ========================================
   FORM INPUTS
   ======================================== */
input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
#jwt-input,
#amount-input {
  width: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 2px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'Exo 2', sans-serif;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: all 0.3s ease;
}

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1), var(--glow-green);
}

input::placeholder {
  color: var(--text-muted);
}

/* Number input arrows styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

/* Checkbox styling */
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-family: 'Exo 2', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-primary-dim) 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-green);
}

.btn:hover::before {
  left: 100%;
}

.btn:active {
  transform: translateY(0);
}

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

.btn--muted {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn--muted:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  box-shadow: none;
  border-color: var(--accent-secondary);
}

.btn--small {
  padding: 10px 16px;
  font-size: 12px;
}

.btn--danger {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
}

.btn--danger:hover {
  box-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
}

.btn--gold {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #b8860b 100%);
  color: #1a1a1a;
}

.btn--gold:hover {
  box-shadow: var(--glow-gold);
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ========================================
   TABLES - Game listings
   ======================================== */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

thead {
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-card) 100%);
}

thead th {
  padding: 16px 20px;
  font-family: 'Orbitron', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

tbody tr {
  background: var(--bg-card);
  transition: all 0.3s ease;
}

tbody tr:nth-child(even) {
  background: rgba(20, 26, 42, 0.5);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

/* Own games - highlighted */
tbody tr.me,
tbody tr.row-mine {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 215, 0, 0.02) 100%);
  border-left: 3px solid var(--accent-gold);
}

tbody tr.me:hover,
tbody tr.row-mine:hover {
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.12) 0%, rgba(255, 215, 0, 0.04) 100%);
}

/* Win/Loss highlighting */
tbody tr.row-win {
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.12) 0%, rgba(0, 255, 136, 0.02) 100%) !important;
  border-left: 3px solid var(--success);
}

tbody tr.row-loss {
  background: linear-gradient(90deg, rgba(255, 71, 87, 0.12) 0%, rgba(255, 71, 87, 0.02) 100%) !important;
  border-left: 3px solid var(--error);
}

td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

td:first-child {
  font-weight: 600;
  color: var(--accent-secondary);
}

td.is-numeric,
th.is-numeric {
  text-align: right;
  font-family: 'Orbitron', monospace;
}

td strong {
  color: var(--accent-primary);
  font-weight: 700;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  padding: 16px 20px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-subtle);
}

/* Responsive table scroll */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========================================
   PLAYER DISPLAY
   ======================================== */
.player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 160px;
}

.player__avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  image-rendering: pixelated;
  border: 2px solid var(--accent-secondary);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.player__name {
  color: var(--accent-secondary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
}

.player__name:hover {
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* ========================================
   BADGES & DISCLAIMER
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 20px;
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-secondary);
  border: 1px solid rgba(0, 212, 255, 0.2);
}

.disclaimer {
  margin-top: 12px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid var(--accent-secondary);
}

/* ========================================
   OVERLAY / LOADING MODAL
   ======================================== */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 23, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
}

.overlay.is-active {
  display: flex;
}

.overlay__box {
  background: var(--bg-card);
  border: 1px solid var(--border-active);
  border-radius: 20px;
  padding: 32px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: var(--glow-green), var(--shadow-card-hover);
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.overlay__text {
  font-family: 'Orbitron', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(0, 255, 136, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toasts {
  position: fixed;
  top: 80px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  font-weight: 600;
  color: var(--text-primary);
  box-shadow: var(--shadow-card-hover);
  animation: toastIn 0.4s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast::before {
  content: '';
  width: 8px;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 12px 0 0 12px;
}

.toast--success {
  border-color: rgba(0, 255, 136, 0.3);
  background: linear-gradient(90deg, rgba(0, 255, 136, 0.1) 0%, var(--bg-card) 100%);
}

.toast--success::before {
  background: var(--success);
}

.toast--error {
  border-color: rgba(255, 71, 87, 0.3);
  background: linear-gradient(90deg, rgba(255, 71, 87, 0.1) 0%, var(--bg-card) 100%);
}

.toast--error::before {
  background: var(--error);
}

.toast--info {
  border-color: rgba(0, 212, 255, 0.3);
  background: linear-gradient(90deg, rgba(0, 212, 255, 0.1) 0%, var(--bg-card) 100%);
}

.toast--info::before {
  background: var(--info);
}

/* ========================================
   UTILITY COLORS
   ======================================== */
.teal { color: var(--accent-secondary); }
.red { color: var(--error); }
.green { color: var(--success); }
.gold { color: var(--accent-gold); }

/* ========================================
   COIN FLIP ANIMATION (bonus effect)
   ======================================== */
@keyframes coinFlip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(900deg); }
  100% { transform: rotateY(1800deg); }
}

.coin-animating {
  animation: coinFlip 1.5s ease-in-out;
}

/* ========================================
   LIVE INDICATOR
   ======================================== */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.live-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { 
    opacity: 1; 
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
  }
  50% { 
    opacity: 0.7; 
    box-shadow: 0 0 0 10px rgba(0, 255, 136, 0);
  }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  .page {
    padding: 20px 16px 40px;
  }
  
  .page__title {
    font-size: 24px;
  }
  
  .controls {
    padding: 20px 16px;
  }
  
  .control-group .row {
    flex-direction: column;
  }
  
  .control-group .row .btn {
    width: 100%;
  }
  
  .auth-bar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
  }
  
  .auth-bar__right {
    flex-wrap: wrap;
  }
  
  .btn {
    padding: 12px 20px;
  }
  
  table {
    min-width: 500px;
  }
  
  td, th {
    padding: 12px 14px;
  }
  
  .toasts {
    left: 16px;
    right: 16px;
  }
  
  .toast {
    min-width: auto;
    max-width: none;
  }
}

@media (max-width: 480px) {
  .page__title {
    font-size: 20px;
    letter-spacing: 1px;
  }
  
  .section-title {
    font-size: 16px;
  }
  
  .btn-row {
    flex-direction: column;
  }
  
  .btn-row .btn {
    width: 100%;
  }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* ========================================
   SELECTION STYLING
   ======================================== */
::selection {
  background: var(--accent-primary);
  color: var(--bg-primary);
}

::-moz-selection {
  background: var(--accent-primary);
  color: var(--bg-primary);
}
