/* ─────────────────────────────────────────────────────────────────────────────
   pronoscore — styles communs.
   Extrait depuis templates/base.html (étape 12 du plan dette technique).
   Variables CSS (couleurs) surchargées par static/themes/<THEME>/theme.css.
   ───────────────────────────────────────────────────────────────────────────── */

* { font-family: 'Inter', sans-serif; }

:root{
  /* ── Couleurs principales ─────────────────────────────────────────── */
  --navy:              #0B2A4A;   /* profond, premium */
  --blue:              #2563EB;   /* bleu principal */
  --blue-soft:         #60A5FA;   /* hover / secondaire */
  --blue-hover:        #007ACC;   /* bouton bleu au survol */
  --blue-shadow:       rgba(0, 153, 255, 0.35); /* ombre bouton bleu */
  --mint:              #22C55E;   /* vert sportif */
  --mint-fluo:         #00FE9D;   /* vert fluo accents */
  --mint-hover:        #00E88D;   /* bouton mint au survol */
  --mint-shadow:       rgba(0, 254, 157, 0.40); /* ombre bouton mint */

  /* ── Fonds ────────────────────────────────────────────────────────── */
  --bg:                #F5F9FF;
  --bg-mint:           #F0FFFE;
  --bg-soft:           #EFF6FF;
  --bg-accent:         #F0FDF4;
  --card:              #FFFFFF;
  --card-hover:        #F9FBFF;
  --light:             #F8FBFF;

  /* ── Bordures / ombres ────────────────────────────────────────────── */
  --border:            #D6EAFF;
  --border2:           #E2E8F0;
  --shadow-navbar:     rgba(0, 58, 112, 0.18);
  --shadow-card:       rgba(0, 58, 112, 0.10);
  --shadow-card-sm:    rgba(0, 58, 112, 0.06);

  /* ── Texte ────────────────────────────────────────────────────────── */
  --text:              #0F172A;
  --text-old:          #1E293B;
  --text-soft:         #334155;
  --muted:             #64748B;
  --disabled:          #94A3B8;

  /* ── Sémantiques ─────────────────────────────────────────────────── */
  --success:           #22C55E;
  --warning:           #F59E0B;
  --live:              #EF4444;
  --info:              #3B82F6;
  --danger:            #DC2626;

  /* ── Résultats pronostics ─────────────────────────────────────────── */
  --prono-win:         #16A34A;   /* score exact ou vainqueur correct */
  --prono-partial:     #D97706;   /* pronostic partiellement correct */

  /* ── Toggle ON (concours paramètres) ─────────────────────────────── */
  --toggle-on-bg:      #ECFDF5;
  --toggle-on-text:    #059669;
  --toggle-on-border:  #6EE7B7;

  /* ── Stats 1X2 ────────────────────────────────────────────────────── */
  --1x2-home:          var(--blue);
  --1x2-draw:          var(--muted);
  --1x2-away:          #EF4444;
}

body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Navbar ── */
.navbar {
  background: var(--blue) !important;
  padding: 10px 0;
  box-shadow: 0 2px 12px var(--shadow-navbar);
}
.navbar-brand {
  padding: 0;
  margin-right: 24px;
}
.navbar-brand .accent { color: var(--mint); }
.nav-link {
  color: rgba(255,255,255,.75) !important;
  font-weight: 500;
  font-size: .9rem;
  padding: 6px 14px !important;
  border-radius: 8px;
  transition: all .15s;
}
.nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,.1);
}

input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}
.nav-link.active {
  color: var(--navy) !important;
  background: var(--mint);
  font-weight: 600;
}
.navbar-toggler { border-color: rgba(255,255,255,.3); }

/* ── Boutons ── */
.btn-primary {
  background: var(--blue);
  border: none;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 22px;
  color: white;
  transition: all .2s;
}
.btn-primary:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--blue-shadow);
  color: white;
}
.btn-outline-primary {
  border: 1.5px solid var(--blue);
  color: var(--blue);
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 22px;
  background: transparent;
  transition: all .2s;
}
.btn-outline-primary:hover {
  background: var(--blue);
  color: white;
}
.btn-mint {
  background: var(--mint);
  border: none;
  color: var(--navy);
  font-weight: 700;
  border-radius: 10px;
  padding: 9px 22px;
  transition: all .2s;
}
.btn-mint:hover {
  background: var(--mint-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--mint-shadow);
  color: var(--navy);
}
.btn-sm { padding: 6px 14px !important; font-size: .82rem; border-radius: 8px !important; }
.form-select-sm { padding: 6px 32px 6px 12px !important; font-size: .85rem !important; }


/* ── Grille match ──
   4 colonnes : [badge ctx] [heure] [corps équipes+prono] [action/pts]
   Le corps a 2 lignes : ligne 1 = DOM score EXT alignés, ligne 2 = prono.
── */
.match-grid {
  display: grid;
  grid-template-columns: 42px 52px 1fr auto 64px;
  align-items: stretch;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--border2);
  transition: background .15s;
  text-decoration: none;
  color: inherit;
  column-gap: 8px;
  min-height: 52px;
}
.match-grid:last-child { border-bottom: none; }
.match-grid:hover { background: var(--card-hover); }

/* Colonne 1 : badge contexte (J.31 / Gr.A / phase) */
.match-ctx {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px 0;
}
.match-ctx-badge {
  font-size: .65rem;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: .3px;
  white-space: nowrap;
  background: var(--bg-soft);
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1.4;
}

/* Colonne 2 : heure + date */
.match-heure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px 0;
}
.match-heure-time {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  line-height: 1.2;
}
.match-heure-date {
  font-size: .72rem;
  color: var(--text-soft);
  white-space: nowrap;
  line-height: 1.2;
}

/* Colonne 3 : corps (équipes + prono empilés) */
.match-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 7px 0;
  overflow: hidden;
}

/* Ligne 1 du corps : DOM | score | EXT sur la même ligne */
.match-equipes {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

/* Ligne 2 du corps : pronostic saisi (centré sous le score) */
.match-prono {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Équipe domicile : nom + drapeau alignés à droite */
.match-domicile {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  overflow: hidden;
}

/* Score / VS / pronostic prédit : zone centrale fixe */
.match-centre {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 3px;
  white-space: nowrap;
  min-width: 72px;
}
.match-vs {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 500;
}

/* Équipe extérieur : drapeau + nom alignés à gauche */
.match-exterieur {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  overflow: hidden;
}

/* Colonne 4 : points / action */
.match-action {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  flex-shrink: 0;
  padding: 8px 0;
}
.match-pts {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.match-pts-label {
  font-size: .62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Pronostic coloré sous le score réel */
.prono-sous-score {
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.prono-vert   { color: var(--prono-win); }
.prono-orange { color: var(--prono-partial); }
.prono-rouge  { color: var(--danger); }

/* ── Col 4 : stats 1X2 ── */
.match-1x2-col {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 8px 0;
}
.match-1x2 {
  display: flex;
  gap: 5px;
}
.badge-1x2 {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 7px 4px;
  border-radius: 7px;
  border: 1.5px solid;
  min-width: 38px;
  line-height: 1.2;
}
.badge-1x2-label {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .5px;
}
.badge-1x2-pct {
  font-size: .65rem;
  font-weight: 600;
  opacity: .85;
}
.badge-1x2.b1 {
  color: var(--1x2-home);
  border-color: color-mix(in srgb, var(--1x2-home) 30%, transparent);
  background: color-mix(in srgb, var(--1x2-home) 8%, transparent);
}
.badge-1x2.bx {
  color: var(--1x2-draw);
  border-color: color-mix(in srgb, var(--1x2-draw) 30%, transparent);
  background: color-mix(in srgb, var(--1x2-draw) 8%, transparent);
}
.badge-1x2.b2 {
  color: var(--1x2-away);
  border-color: color-mix(in srgb, var(--1x2-away) 30%, transparent);
  background: color-mix(in srgb, var(--1x2-away) 8%, transparent);
}

.flag-img {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  flex-shrink: 0;
}

/* ── Cartes ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 4px var(--shadow-card-sm);
  transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 6px 20px var(--shadow-card); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  color: var(--navy);
  border-radius: 16px 16px 0 0 !important;
}
.card-body { padding: 20px; }

/* ── Badge groupe ── */
.badge-groupe {
  background: var(--bg);
  color: var(--blue);
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ── Badge points ── */
.badge-points {
  background: var(--mint);
  color: var(--navy);
  font-size: .78rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 700;
}

/* ── Score ── */
.score-final {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.score-live {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--live);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.live-dot {
  width: 6px;
  height: 6px;
  background: var(--live);
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
  animation: blink-live 1.6s ease-in-out infinite;
}
@keyframes blink-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(1.4); }
}

/* Score pronostiqué (prediction) */
.score-prono {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--blue);
  font-family: 'Inter', sans-serif;
  letter-spacing: 1.5px;
  font-variant-numeric: tabular-nums;
}
/* Separateur court et epais dans la liste */
.score-sep {
  display: inline-block;
  width: 5px;
  height: 3px;
  background: var(--border2);
  border-radius: 2px;
  flex-shrink: 0;
}
/* Séparateur court et épais dans le formulaire */
.form-score-sep {
  display: inline-block;
  width: 14px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 16px;
}
.score-input {
  width: 68px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--navy);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 8px 4px;
  transition: all .2s;
}
.score-input:focus {
  border-color: var(--blue);
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,153,255,.15);
}

/* ── Tables ── */
.table { color: var(--text); }
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
}
.table td {
  border-bottom: 1px solid #F1F5F9;
  padding: 12px 16px;
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--light); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Classement rang ── */
.rank-badge {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 700;
}
.rank-1 { background: #FEF3C7; color: #D97706; }
.rank-2 { background: #F1F5F9; color: #64748B; }
.rank-3 { background: #FEE2E2; color: #C2410C; }
.rank-n { background: var(--bg); color: var(--muted); }

/* ── Formulaires ── */
.form-control, .form-select {
  background: var(--light);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  transition: all .2s;
}
.form-control:focus, .form-select:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,153,255,.12);
  color: var(--text);
}
.form-label {
  font-weight: 500;
  font-size: .88rem;
  color: var(--muted);
  margin-bottom: 6px;
}

/* ── Toasts flottants ── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.pronoscore-toast {
  pointer-events: all;
  width: 340px;
  min-height: 80px;
  padding: 16px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(11,42,74,.18), 0 2px 8px rgba(0,0,0,.10);
  animation: toastIn .22s cubic-bezier(.4,0,.2,1);
  transition: opacity .35s, transform .35s;
  background: #1845C8;
  color: #fff;
}
.pronoscore-toast.toast-error   { background: #991B1B; }
.pronoscore-toast.toast-warning { background: #92400E; }
.pronoscore-toast.toast-info    { background: #1845C8; }
.pronoscore-toast.toast-success { background: #1845C8; }
.pronoscore-toast-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pronoscore-toast-text {
  flex: 1;
  font-size: .88rem;
  font-weight: 500;
  line-height: 1.45;
}
.pronoscore-toast-close {
  flex-shrink: 0;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.7); font-size: 1.1rem; line-height: 1;
  padding: 0; transition: color .15s;
}
.pronoscore-toast-close:hover { color: #fff; }
.pronoscore-toast.toast-hide {
  opacity: 0;
  transform: translateX(20px);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0);    }
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #005299 100%);
  border-radius: 20px;
  color: white;
  padding: 52px 44px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(0,254,157,.15) 0%, transparent 70%);
  border-radius: 50%;
}
.hero h1 { font-weight: 700; font-size: 2.2rem; letter-spacing: -.5px; }
.hero p { opacity: .85; font-size: 1.05rem; }
.hero .highlight { color: var(--mint); font-weight: 700; }

/* ── Match row ── */
.match-row {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #F1F5F9;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}
.match-row:last-child { border-bottom: none; }
.match-row:hover { background: var(--light); }

.equipe-nom { font-weight: 700; font-family: 'Inter', "Roboto", sans-serif; font-size: .95rem; }
.match-meta { font-size: .78rem; color: var(--muted); margin-top: 2px; }

/* ── Avatar utilisateur ── */
.user-avatar {
  background: var(--mint);
  color: var(--navy);
  border-radius: 50%;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  margin-right: 6px;
  flex-shrink: 0;
}
/* Quand le lien profil est actif (fond mint), l'avatar passe en blanc */
.nav-link.active .user-avatar {
  background: rgba(255, 255, 255, 0.90);
  color: var(--hiblue);
}

/* ── Stat card ── */
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
}
.stat-label { font-size: .82rem; color: var(--muted); margin-top: 4px; }

/* ── Séparateur ── */
.divider { border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
  margin-top: 48px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE MOBILE  (< 576px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 575.98px) {

  .container { padding-left: 12px; padding-right: 12px; }

  .match-grid {
    grid-template-columns: 34px 44px 1fr 52px;
    padding: 0 10px 0 12px;
    column-gap: 6px;
    min-height: 48px;
  }
  .match-1x2-col { display: none !important; }

  .match-ctx-badge {
    font-size: .58rem;
    padding: 2px 4px;
    letter-spacing: 0;
  }

  .match-heure-time { font-size: .76rem; }
  .match-heure-date { font-size: .65rem; }

  .equipe-nom {
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .match-centre { min-width: 54px; gap: 2px; }
  .score-final, .score-live { font-size: .9rem; }
  .score-prono { font-size: 1rem; }

  .match-pts { font-size: 1rem; }

  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  .hero { padding: 28px 20px; border-radius: 14px; margin-bottom: 20px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p  { font-size: .88rem; }

  .btn-primary, .btn-outline-primary, .btn-mint {
    padding: 8px 16px;
    border-radius: 8px;
  }

  .table th, .table td { padding: 10px 10px; font-size: .82rem; }

  .score-input { width: 56px; font-size: 1.3rem; padding: 6px 2px; }
}

/* ── Toast : max-width adaptatif ── */
@media (max-width: 400px) {
  .pronoscore-toast {
    width: calc(100vw - 24px);
    min-height: auto;
    padding: 12px 14px;
  }
  #toast-container { right: 12px; left: 12px; }
}

/* ═══════════════════════════════════════════════════════════
   ÉTATS DE CHARGEMENT (progress bar, spinner bouton, pulse match)
   ═══════════════════════════════════════════════════════════ */

/* ── Barre de progression de navigation (sous la navbar) ── */
#nprogress {
  pointer-events: none;
  position: fixed;
  /* top sera calculé en JS une fois la navbar mesurée */
  top: 56px;
  left: 0;
  right: 0;
  z-index: 99999;
}
#nprogress-bar {
  background: var(--mint-fluo);
  height: 3px;
  width: 0%;
  transition: width .2s ease, opacity .4s ease;
  opacity: 0;
  box-shadow: 0 0 8px var(--mint-fluo), 0 0 4px var(--mint-fluo);
}
#nprogress-bar.active {
  opacity: 1;
}

/* ── Match en cours de chargement (effet pulse sur la ligne) ── */
.match-loading {
  pointer-events: none;
  animation: match-pulse 1s ease-in-out infinite;
}
@keyframes match-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ── Spinner inline sur les boutons ── */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .65s linear infinite;
}
/* Pour les boutons avec texte sombre (btn-mint, outline, etc.) */
.btn-loading.btn-mint::after,
.btn-loading.btn-outline-primary::after {
  border-color: rgba(11,42,74,.25);
  border-top-color: var(--navy);
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}
