/* ============================================
   ALLIN TIMER — Design System
   Ambiance : Salle de jeu underground, feutre vert, or et néon
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ── TOKENS ── */
:root {
  --noir:        #0a0a0f;
  --noir-soft:   #111118;
  --bleu-nuit:   #1a1a2e;
  --bleu-fonce:  #16213e;
  --or:          #c9a84c;
  --or-light:    #e8c96a;
  --or-dark:     #8a6f28;
  --vert:        #2ecc71;
  --vert-feutre: #1a4a2e;
  --rouge:       #e74c3c;
  --rouge-dark:  #c0392b;
  --blanc:       #f0ead6;
  --gris:        #6b7280;
  --gris-light:  #9ca3af;

  --font-display: 'Bebas Neue', sans-serif;
  --font-ui:      'Rajdhani', sans-serif;
  --font-mono:    'Share Tech Mono', monospace;

  --radius:     8px;
  --radius-lg:  16px;
  --shadow:     0 4px 24px rgba(0,0,0,0.5);
  --shadow-or:  0 0 20px rgba(201,168,76,0.3);
  --transition: 0.2s ease;

  /* Thème dynamique (overridable via JS) */
  --theme-bg:      var(--noir);
  --theme-surface: var(--bleu-nuit);
  --theme-accent:  var(--or);
  --theme-text:    var(--blanc);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--theme-bg);
  color: var(--theme-text);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(26,74,46,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.08) 0%, transparent 50%);
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--noir-soft); }
::-webkit-scrollbar-thumb { background: var(--or-dark); border-radius: 3px; }

/* ── TYPO ── */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: 2px; color: var(--or); }
h1 { font-size: 3rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.4rem; }
p, label, span { font-weight: 500; }

/* ── LAYOUT APP ── */
#app {
  display: grid;
  grid-template-rows: 60px 1fr;
  grid-template-columns: 220px 1fr;
  grid-template-areas: "header header" "sidebar main";
  min-height: 100vh;
}

/* ── HEADER ── */
#header {
  grid-area: header;
  background: var(--noir-soft);
  border-bottom: 1px solid var(--or-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,0.6);
}

#header .logo {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--or);
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(201,168,76,0.5);
}

#header .logo span { color: var(--blanc); }

#header .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

#header .user-info {
  font-size: 0.9rem;
  color: var(--gris-light);
}

#header .user-info strong { color: var(--or); }

/* ── SIDEBAR ── */
#sidebar {
  grid-area: sidebar;
  background: var(--noir-soft);
  border-right: 1px solid rgba(201,168,76,0.15);
  padding: 24px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 16px;
  margin-bottom: 8px;
}

.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--gris);
  text-transform: uppercase;
  padding: 12px 8px 6px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  color: var(--gris-light);
  font-size: 0.95rem;
  font-weight: 600;
  user-select: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(201,168,76,0.08);
  color: var(--blanc);
  border-color: rgba(201,168,76,0.2);
}

.nav-item.active {
  background: rgba(201,168,76,0.12);
  color: var(--or);
  border-color: rgba(201,168,76,0.3);
}

.nav-item .icon { font-size: 1.1rem; width: 20px; text-align: center; }

/* ── MAIN CONTENT ── */
#main {
  grid-area: main;
  overflow-y: auto;
  padding: 32px;
}

/* ── PAGES (sections) ── */
.page { display: none; }
.page.active { display: block; }

/* ── CARDS ── */
.card {
  background: var(--bleu-nuit);
  border: 1px solid rgba(201,168,76,0.15);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--or);
  letter-spacing: 2px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
}

/* ── BOUTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--or), var(--or-dark));
  color: var(--noir);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--or-light), var(--or)); box-shadow: var(--shadow-or); }

.btn-success {
  background: linear-gradient(135deg, var(--vert), #27ae60);
  color: var(--noir);
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
  background: linear-gradient(135deg, var(--rouge), var(--rouge-dark));
  color: var(--blanc);
}
.btn-danger:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--gris-light);
  border: 1px solid rgba(255,255,255,0.1);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--blanc); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── INPUTS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gris-light);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(201,168,76,0.2);
  border-radius: var(--radius);
  color: var(--blanc);
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 10px 14px;
  transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

.form-select option { background: var(--bleu-nuit); }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead tr {
  border-bottom: 2px solid var(--or-dark);
}

th {
  font-family: var(--font-display);
  letter-spacing: 1.5px;
  color: var(--or);
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
}

td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: var(--blanc);
}

tr:hover td { background: rgba(201,168,76,0.04); }

/* ── BADGES ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.badge-admin   { background: rgba(231,76,60,0.2);  color: var(--rouge); border: 1px solid rgba(231,76,60,0.3); }
.badge-croupier{ background: rgba(201,168,76,0.2); color: var(--or);    border: 1px solid rgba(201,168,76,0.3); }
.badge-joueur  { background: rgba(46,204,113,0.2); color: var(--vert);  border: 1px solid rgba(46,204,113,0.3); }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.9rem;
}
.alert-error   { background: rgba(231,76,60,0.15);  border: 1px solid rgba(231,76,60,0.3);  color: #ff6b6b; }
.alert-success { background: rgba(46,204,113,0.15); border: 1px solid rgba(46,204,113,0.3); color: var(--vert); }
.alert-info    { background: rgba(201,168,76,0.1);  border: 1px solid rgba(201,168,76,0.2); color: var(--or); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bleu-nuit);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 90%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), var(--shadow-or);
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--or);
  letter-spacing: 2px;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ── DRAG & DROP ── */
.draggable { cursor: grab; }
.draggable:active { cursor: grabbing; }
.drag-over { border: 2px dashed var(--or) !important; background: rgba(201,168,76,0.05); }
.dragging { opacity: 0.4; }

/* ── UTILS ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.text-or     { color: var(--or); }
.text-gris   { color: var(--gris-light); }
.text-rouge  { color: var(--rouge); }
.text-vert   { color: var(--vert); }
.text-center { text-align: center; }
.text-small  { font-size: 0.85rem; }
.bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── SÉPARATEUR OR ── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--or-dark), transparent);
  margin: 24px 0;
}

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── TOAST NOTIFICATIONS ── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  min-width: 220px;
}
.toast-success { background: rgba(46,204,113,0.9);  color: #000; }
.toast-error   { background: rgba(231,76,60,0.9);   color: #fff; }
.toast-info    { background: rgba(201,168,76,0.9);  color: #000; }

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

/* ── LOGIN PAGE ── */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--noir);
  background-image:
    radial-gradient(ellipse at 30% 40%, rgba(26,74,46,0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 60%, rgba(201,168,76,0.1) 0%, transparent 50%);
}

.login-box {
  width: 400px;
  background: var(--bleu-nuit);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), var(--shadow-or);
  text-align: center;
}

.login-logo {
  font-family: var(--font-display);
  font-size: 3rem;
  color: var(--or);
  letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(201,168,76,0.5);
  margin-bottom: 4px;
}

.login-logo span { color: var(--blanc); }
.login-subtitle {
  color: var(--gris);
  font-size: 0.85rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

.login-suits {
  font-size: 1.5rem;
  margin-bottom: 32px;
  opacity: 0.4;
  letter-spacing: 8px;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  #app { grid-template-columns: 1fr; grid-template-areas: "header" "main"; }
  #sidebar { display: none; }
  #main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
