/*
 * assets/css/app.css
 * Défi Flash FCFA — Styles globaux
 * Tailwind CSS via CDN + variables personnalisées
 */

/* ─── Variables couleurs ─────────────────────────────────── */
:root {
  --color-primary:   #7C3AED;   /* violet */
  --color-secondary: #F59E0B;   /* ambre / or */
  --color-success:   #10B981;
  --color-danger:    #EF4444;
  --color-dark:      #111827;
  --color-card:      #1F2937;
  --color-border:    #374151;
  --color-text:      #F3F4F6;
  --color-muted:     #9CA3AF;

  /* Ligues */
  --bronze: #CD7F32;
  --argent: #C0C0C0;
  --or:     #FFD700;
  --vip:    #8B008B;
}

/* ─── Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--color-dark);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar personnalisée ────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #111827; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

/* ─── Typographie ────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.25rem;
}

.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.25);
}

/* ─── Boutons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: 0.625rem;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, #7C3AED, #5B21B6);
  color: white;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #6D28D9, #4C1D95);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.5);
  transform: translateY(-1px);
}

.btn-gold {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #1F2937;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); }

.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
}
.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--color-border);
}
.btn-lg { padding: 0.875rem 2rem; font-size: 1.05rem; border-radius: 0.75rem; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn-full { width: 100%; }

/* ─── Inputs ─────────────────────────────────────────────── */
.input {
  width: 100%;
  background: #111827;
  border: 1.5px solid var(--color-border);
  border-radius: 0.625rem;
  padding: 0.7rem 1rem;
  color: var(--color-text);
  font-size: 0.95rem;
  transition: border-color 0.2s;
  outline: none;
}
.input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.2); }
.input::placeholder { color: var(--color-muted); }
.input-error { border-color: var(--color-danger) !important; }

/* ─── Labels ─────────────────────────────────────────────── */
.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Badges ligue ───────────────────────────────────────── */
.badge-league {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-bronze { background: rgba(205,127,50,0.2);  color: var(--bronze); border: 1px solid var(--bronze); }
.badge-argent { background: rgba(192,192,192,0.2); color: var(--argent); border: 1px solid var(--argent); }
.badge-or     { background: rgba(255,215,0,0.2);   color: var(--or);     border: 1px solid var(--or); }
.badge-vip    { background: rgba(139,0,139,0.2);   color: #DA70D6;       border: 1px solid #DA70D6; }

/* ─── Alertes / Flash messages ───────────────────────────── */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: 0.625rem;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}
.alert-success { background: rgba(16,185,129,0.12); border-color: #10B981; color: #6EE7B7; }
.alert-error   { background: rgba(239,68,68,0.12);  border-color: #EF4444; color: #FCA5A5; }
.alert-warning { background: rgba(245,158,11,0.12); border-color: #F59E0B; color: #FCD34D; }
.alert-info    { background: rgba(124,58,237,0.12); border-color: #7C3AED; color: #C4B5FD; }

/* ─── Wallet card ────────────────────────────────────────── */
.wallet-card {
  background: linear-gradient(135deg, #7C3AED 0%, #4C1D95 50%, #1F2937 100%);
  border-radius: 1.25rem;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.wallet-card::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 150px; height: 150px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}
.wallet-amount {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ─── Challenge card ─────────────────────────────────────── */
.challenge-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.challenge-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.05), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.challenge-card:hover::after { opacity: 1; }
.challenge-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(124,58,237,0.2);
}
.challenge-card.full {
  opacity: 0.6;
  cursor: not-allowed;
}
.challenge-card.full:hover { transform: none; box-shadow: none; }

/* ─── Timer ──────────────────────────────────────────────── */
.timer-ring {
  transform: rotate(-90deg);
  transform-origin: center;
}
.timer-circle-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 6;
}
.timer-circle-progress {
  fill: none;
  stroke: var(--color-secondary);
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.95s linear, stroke 0.3s;
}
.timer-circle-progress.danger { stroke: var(--color-danger); }
.timer-value {
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.timer-value.danger { color: var(--color-danger); }

/* ─── Leaderboard ────────────────────────────────────────── */
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: 0.625rem;
  transition: background 0.15s;
}
.leaderboard-row:hover { background: rgba(255,255,255,0.04); }
.leaderboard-row.me { background: rgba(124,58,237,0.15); border: 1px solid rgba(124,58,237,0.3); }
.rank-1 { color: #FFD700; font-size: 1.25rem; }
.rank-2 { color: #C0C0C0; font-size: 1.1rem; }
.rank-3 { color: #CD7F32; font-size: 1rem; }

/* ─── Progress bar cagnotte ──────────────────────────────── */
.prize-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}
.prize-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #7C3AED, #F59E0B);
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* ─── OTP Input ──────────────────────────────────────────── */
.otp-inputs { display: flex; gap: 0.5rem; justify-content: center; }
.otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: #111827;
  border: 2px solid var(--color-border);
  border-radius: 0.625rem;
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: var(--color-primary);
}
.otp-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.25);
}
.otp-input.filled { border-color: var(--color-success); }
.otp-input.error  { border-color: var(--color-danger); animation: shake 0.4s; }

/* ─── Skeleton loading ───────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #1F2937 25%, #374151 50%, #1F2937 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Animations ─────────────────────────────────────────── */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124,58,237,0.4); }
  50%       { box-shadow: 0 0 0 12px rgba(124,58,237,0); }
}
.animate-fadeinup { animation: fadeInUp 0.4s ease forwards; }
.animate-pulse-glow { animation: pulse-glow 2s infinite; }

/* ─── Nav mobile bottom bar ──────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #1F2937;
  border-top: 1px solid var(--color-border);
  display: flex;
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0.625rem 0.25rem;
  color: var(--color-muted);
  font-size: 0.7rem;
  text-decoration: none;
  transition: color 0.15s;
}
.bottom-nav-item.active { color: var(--color-primary); }
.bottom-nav-item svg { width: 22px; height: 22px; }

/* ─── Toast notifications ────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 320px;
}
.toast {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: fadeInUp 0.3s ease;
  border-left: 4px solid;
}
.toast-success { border-left-color: #10B981; }
.toast-error   { border-left-color: #EF4444; }
.toast-info    { border-left-color: #7C3AED; }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .wallet-amount { font-size: 1.75rem; }
  .card { border-radius: 0.875rem; }
}

/* ─── Correction Tailwind CDN (dark mode forcé) ──────────── */
/* Tailwind CDN ne compile pas en dark mode par défaut */
.bg-gray-900 { background-color: #111827; }
.bg-gray-800 { background-color: #1F2937; }
.bg-gray-700 { background-color: #374151; }