/* ===== VARIABLES & RESET ===== */
:root {
  --bg: #0f0e1a;
  --bg2: #1c1a30;
  --bg3: #252340;
  --card: #1e1c35;
  --border: #3a3660;

  --purple: #7c3aed;
  --purple-light: #a855f7;
  --purple-glow: rgba(124, 58, 237, 0.4);

  --yellow: #ffd60a;
  --yellow-glow: rgba(255, 214, 10, 0.35);

  --green: #06d6a0;
  --green-glow: rgba(6, 214, 160, 0.35);

  --red: #ef233c;
  --red-glow: rgba(239, 35, 60, 0.35);

  --orange: #ff6b35;

  --text: #e8e6f0;
  --text-muted: #8b87a8;

  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* ===== TYPOGRAPHIE ===== */
h1 { font-size: 2rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }

/* ===== COMPOSANTS COMMUNS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: white;
  box-shadow: 0 4px 16px var(--purple-glow);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 24px var(--purple-glow);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #059669, var(--green));
  color: white;
  box-shadow: 0 4px 16px var(--green-glow);
}

.btn-danger {
  background: linear-gradient(135deg, #c0152d, var(--red));
  color: white;
  box-shadow: 0 4px 16px var(--red-glow);
}

.btn-yellow {
  background: linear-gradient(135deg, #e6b800, var(--yellow));
  color: #1a0533;
  box-shadow: 0 4px 16px var(--yellow-glow);
}

.btn-ghost {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg2);
  border-color: var(--purple);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg3);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-glow);
}
.input::placeholder { color: var(--text-muted); }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-purple { background: var(--purple-glow); color: var(--purple-light); border: 1px solid var(--purple); }
.badge-green  { background: var(--green-glow);  color: var(--green);         border: 1px solid var(--green); }
.badge-yellow { background: var(--yellow-glow); color: var(--yellow);        border: 1px solid var(--yellow); }
.badge-red    { background: var(--red-glow);    color: var(--red);           border: 1px solid var(--red); }

/* ===== HEADER ===== */
.app-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-header .logo {
  font-size: 1.5rem;
}

.app-header h1 {
  font-size: 1.3rem;
  background: linear-gradient(90deg, var(--purple-light), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== TOAST NOTIFICATIONS ===== */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  animation: toastIn 0.3s ease;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.toast-info    { background: rgba(124, 58, 237, 0.9); color: white; }
.toast-success { background: rgba(6, 214, 160, 0.9);  color: #0f2a22; }
.toast-error   { background: rgba(239, 35, 60, 0.9);  color: white; }

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

/* ===== ANIMATIONS GLOBALES ===== */
@keyframes pulse-ring {
  0%   { transform: scale(1);    opacity: 1; }
  100% { transform: scale(1.6);  opacity: 0; }
}

@keyframes bounce-in {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

@keyframes flash-bg {
  0%, 100% { background-color: var(--bg); }
  50%       { background-color: rgba(255, 214, 10, 0.08); }
}

@keyframes score-bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); color: var(--yellow); }
  100% { transform: scale(1); }
}

/* ===== RESPONSIVE BASE ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== MODALES ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 26, 0.88);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: bounce-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.modal-header h2 { font-size: 1.3rem; }

.btn-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.btn-close:hover { background: var(--red); border-color: var(--red); }

.modal-body { padding: 24px; }

/* Sections réglages */
.reglages-section { margin-bottom: 28px; }
.reglages-section:last-child { margin-bottom: 0; }
.reglages-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}
.toggle-row span { font-weight: 600; font-size: 0.95rem; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: 0.25s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.25s;
}
.toggle input:checked + .toggle-slider { background: var(--purple); border-color: var(--purple); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); background: white; }

.reglage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Liste des salles admin */
.salles-admin-liste { display: flex; flex-direction: column; gap: 8px; }
.salle-admin-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.salle-admin-code {
  font-family: 'Courier New', monospace;
  font-weight: 900;
  color: var(--purple-light);
  font-size: 1rem;
}
.salle-admin-titre { font-size: 0.82rem; color: var(--text-muted); margin-top: 2px; }
.salle-admin-equipes { font-size: 0.8rem; color: var(--text-muted); }

/* Podium modal */
.modal-podium-content { max-width: 460px; }
.podium-modal-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.podium-modal-actions .btn { flex: 1; }

/* Podium ranking list dans la modale */
.podium-liste-anim { display: flex; flex-direction: column; gap: 8px; }
.podium-anim-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  gap: 12px;
  animation: bounce-in 0.4s ease;
}
.podium-anim-item:nth-child(1) { border-color: #ffd700; background: rgba(255, 215, 0, 0.08); }
.podium-anim-item:nth-child(2) { border-color: #c0c0c0; background: rgba(192,192,192,0.06); }
.podium-anim-item:nth-child(3) { border-color: #cd7f32; background: rgba(205,127,50,0.06); }
.podium-anim-rang { font-size: 1.5rem; width: 36px; text-align: center; }
.podium-anim-nom { flex: 1; font-weight: 700; font-size: 1rem; }
.podium-anim-score { font-weight: 900; font-size: 1.3rem; color: var(--yellow); }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
