:root {
  /* --- Couleurs de base & Glassmorphism --- */
  --glass-bg: rgba(13, 19, 30, 0.75);
  --glass-br: rgba(255, 255, 255, 0.12);
  --txt: #e8eef7;
  --muted: #94a3b8;
  
  /* --- Palette Palworld --- */
  --accent: #3b82f6;       /* Bleu Pal Sphere */
  --accent-glow: rgba(59, 130, 246, 0.4);
  --success: #10b981;      /* Vert Vie */
  --danger: #ef4444;       /* Rouge Attaque/Ban */
  --warning: #f59e0b;      /* Orange */

  --radius: 16px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  --fast: .2s cubic-bezier(.2, .8, .2, 1);
}

/* --- Reset & Base --- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: 'Inter', system-ui, sans-serif; color: var(--txt); }
.page { min-height: 100vh; display: flex; flex-direction: column; }

body { background: #050910; }

/* Image de fond principale (fixe) */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2;
  background: #0b1220 url('/static/img/palworld.avif') center center / cover no-repeat fixed;
  filter: saturate(1.1) brightness(0.6) blur(3px); /* Assombri et flouté pour lisibilité */
  transform: scale(1.02);
}

/* --- Topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgba(5, 9, 16, 0.85); /* Plus opaque */
  border-bottom: 1px solid var(--glass-br);
  backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.5px; }
.brand-title { font-size: 18px; color: #fff; text-shadow: 0 0 15px rgba(59, 130, 246, 0.6); }

.nav { display: flex; align-items: center; gap: 12px; }
.nav-link {
  color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; 
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px;
  transition: all var(--fast);
}
.nav-link:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.btn-outline {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--glass-br); padding: 8px 14px; border-radius: 8px;
  color: var(--txt); text-decoration: none; font-size: 13px; font-weight: 600;
  background: rgba(0, 0, 0, 0.3); transition: all var(--fast);
}
.btn-outline:hover { border-color: var(--muted); background: rgba(255, 255, 255, 0.1); }

/* --- Layout Général --- */
.container { flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; padding: 30px 24px 60px; }

/* --- KPIs Grid --- */
.kpis {
  display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 24px;
}
.kpi {
  background: var(--glass-bg); border: 1px solid var(--glass-br);
  border-radius: var(--radius); padding: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  backdrop-filter: blur(12px);
  position: relative; overflow: hidden;
}
.kpi-label { 
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; 
  color: var(--muted); display: flex; align-items: center; gap: 6px; 
}
.kpi-value { font-size: 24px; font-weight: 800; margin: 8px 0; display: flex; align-items: center; gap: 8px; }

/* Status Dot */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.dot-ok { background: var(--success); color: var(--success); }
.dot-bad { background: var(--danger); color: var(--danger); }
.status-text { font-size: 16px; font-weight: 600; }

/* Progress Bars */
.meter {
  width: 100%; height: 6px; border-radius: 99px; background: rgba(0, 0, 0, 0.4);
  overflow: hidden; margin-top: 4px;
}
.bar {
  height: 100%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.6s ease;
}

/* --- Main Grid (2 Colonnes) --- */
.grid-two { display: grid; gap: 24px; grid-template-columns: 1fr 2fr; align-items: start; }
/* Swapped: Actions gauche (petit), Joueurs droite (grand) */
.grid-two.swapped { grid-template-columns: 350px 1fr; }
@media (max-width: 1000px) { .grid-two.swapped { grid-template-columns: 1fr; } }

/* --- Cards --- */
.card {
  background: var(--glass-bg); border: 1px solid var(--glass-br);
  border-radius: var(--radius); padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.card-head h2 i { color: var(--accent); }

/* --- Boutons d'Action --- */
.card-actions.large { display: grid; grid-template-columns: 1fr; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; border-radius: 12px;
  font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px;
  cursor: pointer; text-decoration: none; transition: all var(--fast);
  border: 1px solid transparent; user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-neutral { background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255,255,255,0.05); }
.btn-neutral:hover { background: rgba(255, 255, 255, 0.15); }

.btn-start { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.btn-start:hover { background: rgba(16, 185, 129, 0.25); box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); }

.btn-restart { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.btn-restart:hover { background: rgba(245, 158, 11, 0.25); box-shadow: 0 0 20px rgba(245, 158, 11, 0.2); }

.btn-stop { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.btn-stop:hover { background: rgba(239, 68, 68, 0.25); box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }

/* --- Formulaires --- */
.input {
  width: 100%; padding: 12px 16px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid var(--glass-br);
  color: #fff; outline: none; transition: var(--fast);
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }

.row { display: flex; gap: 8px; margin-top: 10px; }
.row .input { flex: 1; }
.row .btn { width: auto; padding: 0 16px; }

/* --- Listes & Tables --- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { 
  display: flex; justify-content: space-between; align-items: center; 
  padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05); 
}
.list li:last-child { border: none; }

.table-wrap { overflow-x: auto; background: rgba(0, 0, 0, 0.25); border-radius: 12px; border: 1px solid var(--glass-br); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.table th { padding: 12px 16px; color: var(--muted); font-weight: 600; background: rgba(255, 255, 255, 0.05); }
.table td { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
.table tr:last-child td { border: none; }
.ta-r { text-align: right; }

.mono { font-family: 'JetBrains Mono', 'Consolas', monospace; color: #a5b4fc; }
.steamid { 
  background: rgba(255, 255, 255, 0.06); padding: 4px 8px; border-radius: 6px; 
  cursor: pointer; transition: background 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.steamid:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.steamid i { font-size: 12px; opacity: 0.7; }

/* --- Chips (Badges) --- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 600; text-decoration: none; color: #fff;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s; cursor: pointer; white-space: nowrap;
}
.chip:hover { transform: translateY(-1px); background: rgba(255, 255, 255, 0.15); }

.chip-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
.chip-danger:hover { background: rgba(239, 68, 68, 0.25); }

/* --- Toasts (Notifications) --- */
#toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  background: #0f172a; border: 1px solid var(--glass-br);
  color: #fff; padding: 12px 20px; border-radius: 10px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: slideIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto; min-width: 280px;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Page Login (FIX CORRIGÉ ICI) --- */
.login-wrap { 
  display: grid; place-items: center; 
  min-height: calc(100vh - 80px); /* Ajusté pour le footer/header */
}

.login-card {
  width: min(900px, 95%); 
  display: grid; 
  grid-template-columns: 1.2fr 1fr; /* Image un peu plus large que le form */
  overflow: hidden; 
  padding: 0; /* Important: reset du padding par défaut des cards */
  background: var(--glass-bg);
  border: 1px solid var(--glass-br);
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-hero { position: relative; background: #000; min-height: 400px; }
.login-hero img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.login-hero-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95), transparent 70%);
}
.login-hero-title { position: absolute; bottom: 0; left: 0; padding: 30px; z-index: 2; }

/* LE FIX : Fond sombre pour le formulaire */
.login-form { 
  padding: 40px; 
  display: flex; flex-direction: column; justify-content: center; gap: 16px; 
  background: rgba(5, 9, 16, 0.85); /* Fond sombre semi-opaque pour la lisibilité */
  backdrop-filter: blur(10px);
}

@media (max-width: 800px) { 
  .login-card { grid-template-columns: 1fr; } 
  .login-hero { min-height: 200px; } 
}

/* --- Footer --- */
.footer {
  text-align: center; padding: 20px; color: var(--muted); font-size: 13px;
  background: rgba(5, 9, 16, 0.9); margin-top: auto;
  border-top: 1px solid var(--glass-br);
}