/* ===================================================================
   BetLab — Premium Dark Dashboard
   Design: Inter + JetBrains Mono · Violet #6c5ce7 · Dark SaaS
   =================================================================== */

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

/* --- Tokens --- */
:root {
  /* Backgrounds */
  --bg-primary:    #0d0f14;
  --bg-secondary:  #161923;
  --bg-card:       #1c1f2e;
  --bg-card-hover: #242838;
  --bg-sidebar:    #111320;
  --bg-input:      #1a1d2a;

  /* Text */
  --text-primary:   #f0f1f5;
  --text-secondary: #8a8fa3;
  --text-muted:     #5c6178;

  /* Accents */
  --accent-primary: #6c5ce7;
  --accent-green:   #00d68f;
  --accent-red:     #ff6b6b;
  --accent-orange:  #f0a500;
  --accent-blue:    #4fc3f7;

  /* Border */
  --border-color: rgba(255, 255, 255, 0.06);

  /* Radius */
  --border-radius-sm: 8px;
  --border-radius-md: 12px;
  --border-radius-lg: 16px;

  /* Typography */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shadows */
  --shadow-card:     0 4px 24px rgba(0, 0, 0, 0.25);
  --shadow-elevated: 0 8px 40px rgba(0, 0, 0, 0.4);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;

  /* Layout */
  --sidebar-width: 240px;
}

/* --- Base --- */
html, body {
  height: 100%;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: #8a7ef4; text-decoration: none; }

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* ═══════════════════════════════
   LAYOUT
   ═══════════════════════════════ */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ═══════════════════════════════
   SIDEBAR
   ═══════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 8px;
  letter-spacing: -0.5px;
}

.logo span { color: var(--accent-primary); }

/* Logo icon variant (base.html) */
.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent-primary), #5046d4);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.35);
  flex-shrink: 0;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.logo-text span { color: var(--accent-primary); }

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 12px 6px;
  margin-top: 8px;
}

nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--border-radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: all var(--transition-fast);
}

nav a .nav-icon { width: 20px; text-align: center; font-size: 15px; flex-shrink: 0; }

nav a:hover {
  background: rgba(108, 92, 231, 0.08);
  color: var(--text-primary);
}

nav a.active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--accent-primary);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

/* ═══════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════ */
.main, main {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px;
}

/* ═══════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════ */
h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 32px 0 16px;
}

/* ═══════════════════════════════
   KPI CARDS
   ═══════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  transition: all var(--transition-normal);
  animation: fadeInUp 0.4s ease both;
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.stat-card:nth-child(1) { animation-delay: 0.00s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.10s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.20s; }
.stat-card:nth-child(6) { animation-delay: 0.25s; }
.stat-card:nth-child(7) { animation-delay: 0.30s; }
.stat-card:nth-child(8) { animation-delay: 0.35s; }

.stat-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-card .value.accent { color: var(--accent-primary); }
.stat-card .value.green  { color: var(--accent-green); }
.stat-card .value.red    { color: var(--accent-red); }
.stat-card .value.orange { color: var(--accent-orange); }

/* ═══════════════════════════════
   BADGES
   ═══════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-green  { background: rgba(0, 214, 143, 0.12);  color: var(--accent-green); }
.badge-red    { background: rgba(255, 107, 107, 0.12); color: var(--accent-red); }
.badge-orange { background: rgba(240, 165, 0, 0.12);   color: var(--accent-orange); }
.badge-blue   { background: rgba(79, 195, 247, 0.12);  color: var(--accent-blue); }
.badge-purple { background: rgba(108, 92, 231, 0.12);  color: var(--accent-primary); }
.badge-dim    { background: rgba(92, 97, 120, 0.15);   color: var(--text-secondary); }

/* ═══════════════════════════════
   TABLEAUX
   ═══════════════════════════════ */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 24px;
  animation: fadeInUp 0.4s ease both;
}

.table-wrap h2 {
  margin: 0;
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: rgba(108, 92, 231, 0.04); }

td strong, td .value {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

td .green, .ev-positive {
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ═══════════════════════════════
   BOUTONS
   ═══════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
  text-decoration: none;
}

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

.btn-primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}
.btn-primary:hover {
  background: #7c6cf0;
  border-color: #7c6cf0;
  color: #fff;
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.35);
}

.btn-green {
  background: rgba(0, 214, 143, 0.15);
  border-color: rgba(0, 214, 143, 0.3);
  color: var(--accent-green);
}
.btn-green:hover { background: rgba(0, 214, 143, 0.25); color: var(--accent-green); }

.btn-red {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--accent-red);
}
.btn-red:hover { background: rgba(255, 107, 107, 0.25); color: var(--accent-red); }

.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }

/* Dashboard action buttons */
.main form { display: inline-block; margin-right: 8px; margin-top: 16px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* ═══════════════════════════════
   SIGNAL CARDS
   ═══════════════════════════════ */
.signal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: all var(--transition-normal);
  animation: fadeInUp 0.4s ease both;
}

.signal-card:hover {
  border-color: rgba(108, 92, 231, 0.2);
  box-shadow: var(--shadow-card);
}

.signal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.signal-match {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-left: 8px;
}

.signal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 24px;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
}

.signal-meta .item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.signal-meta .item .lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.signal-meta strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Edge bar */
.edge-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.edge-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
  border-radius: 4px;
  transition: width 0.6s ease;
}

.signal-actions { display: flex; gap: 8px; }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.filters .btn.active { background: var(--accent-primary); color: #fff; border-color: var(--accent-primary); }

/* Jessy block */
.jessy-block {
  background: rgba(108, 92, 231, 0.06);
  border: 1px solid rgba(108, 92, 231, 0.18);
  border-radius: var(--border-radius-sm);
  padding: 14px 18px;
  margin-top: 12px;
}

.jessy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.jessy-header strong { color: #a89af0; font-size: 13px; }
.jessy-comment { font-size: 13px; color: var(--text-secondary); line-height: 1.6; font-style: italic; }

/* ═══════════════════════════════
   FORMULAIRES
   ═══════════════════════════════ */
input, select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 8px 12px;
  transition: border-color var(--transition-fast);
  outline: none;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.form-group { margin-bottom: 16px; }

hr { border: none; border-top: 1px solid var(--border-color); margin: 32px 0; }

/* Settings card */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 24px 28px;
  margin-bottom: 20px;
}

.settings-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

/* ═══════════════════════════════
   FLASH MESSAGES
   ═══════════════════════════════ */
.flash {
  padding: 12px 18px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
}

.flash-success { background: rgba(0, 214, 143, 0.1);  color: var(--accent-green); border-color: rgba(0, 214, 143, 0.25); }
.flash-error   { background: rgba(255, 107, 107, 0.1); color: var(--accent-red);   border-color: rgba(255, 107, 107, 0.25); }
.flash-info    { background: rgba(108, 92, 231, 0.1);  color: var(--accent-primary); border-color: rgba(108, 92, 231, 0.25); }

/* ═══════════════════════════════
   EMPTY STATE
   ═══════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 52px; margin-bottom: 16px; display: block; opacity: 0.5; }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto; color: var(--text-secondary); }

/* ═══════════════════════════════
   SYSTEM STATUS (dashboard)
   ═══════════════════════════════ */
.system-status { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; }

/* Dot animé */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

.dot-live {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  animation: pulse-dot 2s infinite;
  margin-right: 5px;
}

/* ═══════════════════════════════
   MICRO-ANIMATIONS
   ═══════════════════════════════ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.signal-card:nth-child(1) { animation-delay: 0.00s; }
.signal-card:nth-child(2) { animation-delay: 0.05s; }
.signal-card:nth-child(3) { animation-delay: 0.10s; }
.signal-card:nth-child(4) { animation-delay: 0.15s; }
.signal-card:nth-child(5) { animation-delay: 0.20s; }

/* ═══════════════════════════════
   RESPONSIVE
   ═══════════════════════════════ */
@media (max-width: 768px) {
  .sidebar {
    position: relative;
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    gap: 12px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  nav { flex-direction: row; gap: 4px; }
  nav a { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .nav-label { display: none; }

  .main, main { margin-left: 0; padding: 20px 16px; }
  .stats-grid  { grid-template-columns: repeat(2, 1fr); }
  .signal-meta { grid-template-columns: 1fr 1fr; }
  .table-wrap  { overflow-x: auto; }
  h1 { font-size: 22px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
