/*
 * LAME — Composants réutilisables
 * Importer après design-system.css
 */

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Texture de bruit subtile */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

/* ══════════════════════════════════════════
   TOPBAR — barre de navigation en haut
══════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(12, 18, 32, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 20;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.08em;
  color: var(--gold);
  flex: 1;
}

/* ══════════════════════════════════════════
   BOUTONS
══════════════════════════════════════════ */
.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  padding: 5px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.back-btn:hover { border-color: var(--border-gold); color: var(--gold); }

.btn-primary, .btn-gold {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #0c1220;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 0.06em;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: opacity var(--t-fast), transform 100ms;
}
.btn-primary:active, .btn-gold:active { transform: scale(.98); opacity: .9; }
.btn-primary:disabled, .btn-gold:disabled { opacity: .4; cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border-gold);
  color: var(--gold);
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background var(--t-fast);
}
.btn-secondary:hover { background: var(--gold-pale); }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.btn-outline:hover { border-color: var(--border-gold); color: var(--gold); }
.btn-outline.active { border-color: var(--border-gold); color: var(--gold); background: var(--gold-pale); }

.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 5px; }

/* ══════════════════════════════════════════
   CHAMPS DE FORMULAIRE
══════════════════════════════════════════ */
.field-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 5px;
  display: block;
}

.field-input, .field-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
}
.field-input:focus, .field-select:focus {
  outline: none;
  border-color: var(--border-gold);
}
.field-input::placeholder { color: var(--text-faint); }
.field-select option { background: var(--surface2); }

.field-group { margin-bottom: 12px; }

/* ══════════════════════════════════════════
   MESSAGES DE STATUT / API
══════════════════════════════════════════ */
.status-msg, .api-status {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-size: 12px;
  margin-bottom: 10px;
}
.status-wait, .api-wait {
  background: var(--gold-pale);
  color: var(--gold);
  border: 1px solid var(--border-gold);
}
.status-ok, .api-ok {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid var(--green-b);
}
.status-err, .api-err {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid var(--red-b);
}

/* ══════════════════════════════════════════
   TAGS / BADGES
══════════════════════════════════════════ */
.tag {
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
  font-weight: 500;
}
.tag-blue   { background: var(--blue-dim);   color: var(--blue);  border: 1px solid var(--blue-b); }
.tag-gold   { background: var(--gold-pale);  color: var(--gold);  border: 1px solid var(--border-gold); }
.tag-green  { background: var(--green-dim);  color: var(--green); border: 1px solid var(--green-b); }
.tag-red    { background: var(--red-dim);    color: var(--red);   border: 1px solid var(--red-b); }
.tag-muted  { background: var(--surface3);   color: var(--text-faint); border: 1px solid var(--border); }

.badge-available {
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill); font-weight: 500;
  background: var(--green-dim); color: var(--green); border: 1px solid var(--green-b);
}
.badge-soon {
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 8px; border-radius: var(--r-pill); font-weight: 500;
  background: var(--surface3); color: var(--text-faint); border: 1px solid var(--border);
}

/* ══════════════════════════════════════════
   SECTION LABEL / TITRE DE SECTION
══════════════════════════════════════════ */
.section-label {
  font-size: 9px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.section-title {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 500;
  margin-bottom: 10px;
}

/* ══════════════════════════════════════════
   CARTE MÉTRIQUE (KPI)
══════════════════════════════════════════ */
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px;
}
.metric-val {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--gold);
  line-height: 1;
}
.metric-label {
  font-size: 10px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* ══════════════════════════════════════════
   TABLEAU .table-lame
══════════════════════════════════════════ */
.table-lame {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.table-lame th {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  position: sticky;
  top: 0;
}
.table-lame th:first-child { text-align: left; }
.table-lame td {
  padding: 8px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
.table-lame td:first-child { text-align: left; color: var(--text-dim); }
.table-lame tr:hover td { background: var(--surface2); }
.table-lame tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.table-lame tr.total-row td {
  border-top: 1px solid var(--border-gold);
  color: var(--gold);
  font-weight: 500;
  padding-top: 8px;
  border-bottom: none;
}

/* ══════════════════════════════════════════
   BARRE DE PROGRESSION
══════════════════════════════════════════ */
.progress-bar {
  height: 3px;
  background: var(--surface3);
  position: relative;
  border-radius: var(--r-pill);
  overflow: hidden;
}
.bar-a {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--blue);
  transition: width .4s ease;
  border-radius: var(--r-pill);
}
.bar-b {
  position: absolute; right: 0; top: 0; height: 100%;
  background: var(--red);
  transition: width .4s ease;
  border-radius: var(--r-pill);
}

/* ══════════════════════════════════════════
   AVATAR INITIALES
══════════════════════════════════════════ */
.avatar-initiales {
  width: 32px; height: 32px;
  border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════
   CARTE GÉNÉRIQUE .card
══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: var(--sp-lg);
}
.card--hover {
  transition: transform var(--t-spring), box-shadow var(--t-base), border-color var(--t-base);
  cursor: pointer;
}
.card--hover:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.16);
  box-shadow: var(--sh-md);
}
.card--hover:active { transform: scale(.978); }

/* ══════════════════════════════════════════
   SECTION CARD (dans modules)
══════════════════════════════════════════ */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════
   GRILLES
══════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ══════════════════════════════════════════
   AFFICHAGE SCORE (grand format)
══════════════════════════════════════════ */
.score-display {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
  line-height: 1;
  letter-spacing: 0.04em;
}
.score-display.a { color: var(--blue); }
.score-display.b { color: var(--red); }

/* ══════════════════════════════════════════
   LAME — BOUTON RETOUR ACCUEIL
══════════════════════════════════════════ */
.lame-home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border-gold);
  border-radius: var(--r-sm);
  gap: 6px;
  transition: background var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}
.lame-home:hover { background: var(--gold-pale); }
.lame-home-text {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--gold);
}

/* ══════════════════════════════════════════
   BANDE TRICOLORE (accent en haut de page)
══════════════════════════════════════════ */
.tricolor-band {
  height: 3px;
  background: linear-gradient(90deg, var(--france-blue) 33.3%, #FFFFFF 33.3%, #FFFFFF 66.6%, var(--france-red) 66.6%);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  opacity: 0.7;
}

/* ══════════════════════════════════════════
   ICÔNES SVG INLINE
══════════════════════════════════════════ */
.icon-wrap {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform var(--t-base);
}
.icon-wrap svg { width: 26px; height: 26px; }
.icon-blue  { background: var(--blue-dim);  border: 1px solid var(--blue-b); }
.icon-gold  { background: var(--gold-pale); border: 1px solid var(--border-gold); }
.icon-green { background: var(--green-dim); border: 1px solid var(--green-b); }
.icon-grey  { background: var(--surface3);  border: 1px solid var(--border); }

/* ══════════════════════════════════════════
   NUM CHIFFRES (mono)
══════════════════════════════════════════ */
.num-big {
  font-family: var(--font-display);
  font-size: 16px;
}
.num-mono {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}

/* ══════════════════════════════════════════
   COULEURS POSITIF / NÉGATIF
══════════════════════════════════════════ */
.pos, .diff-plus { color: var(--green); }
.neg-touch, .diff-minus { color: var(--red); }
.diff-zero { color: var(--text-faint); }
