/* ============================================================
   L'HOMME À L'OEUVRE — Composants & utilitaires partagés (public + admin)
   Surcharges au-dessus de tokens.css. Ces classes absorbent les
   patterns qui étaient jusqu'ici codés en style="..." inline à
   travers les vues (323 occurrences). Une classe = un usage.
   ============================================================ */

/* ---------- ICÔNES (bibliothèque unifiée src/services/icons.js) ---------- */
.icon {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* ---------- LISTE DÉFINITION EN GRILLE (.dl-grid) ----------
   Remplace les <dl> avec dt/dd stylés inline (lead-detail, account).
   Usage :
     <dl class="dl-grid">
       <dt>Téléphone</dt><dd>06 12 34 56 78</dd>
       <dt>Email</dt><dd>…</dd>
     </dl> */
.dl-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-5);
  margin: 0;
}
.dl-grid__dt, .dl-grid > dt {
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  font-size: var(--text-sm);
}
.dl-grid__dd, .dl-grid > dd {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  min-width: 0;
  word-break: break-word;
}
/* Variante labels empilés (label au-dessus de la valeur) */
.dl-grid--stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.dl-grid--stack > div { display: flex; flex-direction: column; gap: var(--space-1); }

/* ---------- EN-TÊTE DE PAGE AVEC RETOUR (.page-back) ----------
   Remplace le pattern lien retour + titre répété dans 5+ pages admin. */
.page-back {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.page-back__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  width: fit-content;
  transition: color var(--duration-fast);
}
.page-back__link:hover { color: var(--brand); }

/* ---------- MÉDIA 4/3 (.media-4x3) ----------
   Carte image au ratio 4/3 — remplace le inline de realisations/services. */
.media-4x3 {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}
.media-4x3 img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Variante carte : coins arrondis uniquement en haut (quand le body suit en dessous) */
.media-4x3--card { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

/* Preview d'image (admin service-edit) : largeur fixe, ratio libre */
.media-preview {
  width: 200px;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: block;
}

/* ---------- MARGES & FILTRES UTILITAIRES (complément de tokens.css) ---------- */
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-5 { margin-top: var(--space-5); }
.filters--start { justify-content: flex-start; margin-bottom: var(--space-5); }

/* ---------- ÉTAPES NUMÉROTÉES DANS UNE ALERTE (tutoriel) ---------- */
.alert__steps {
  display: block;
  margin-top: var(--space-2);
  line-height: 1.6;
}

/* ---------- ONBOARDING (dashboard) ---------- */
.onboarding-card { display: block; text-decoration: none; color: inherit; margin: 0; }
.onboarding-card__head { margin-bottom: var(--space-3); }
.onboarding-card__num {
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
  display: grid; place-items: center;
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}
.onboarding-card__desc { margin: 0; }

/* ---------- LOGIN (page autonome) ---------- */
.login-card__brand { text-align: center; margin-bottom: var(--space-5); }
.login-theme-toggle { position: fixed; top: var(--space-4); right: var(--space-4); z-index: 10; }

/* ---------- DRAG & DROP ROW (sections admin) ---------- */
.drag-handle {
  cursor: grab;
  color: var(--text-tertiary);
  flex-shrink: 0;
  padding: var(--space-2);
  user-select: none;
  display: inline-flex;
  align-items: center;
}
.drag-row {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.sections-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.hint-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Variante avec bordure (vignettes admin) */
.media-thumb {
  width: 64px;
  height: 42px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: block;
}

/* ---------- CELLULES DE TABLEAU ---------- */
.cell-actions { text-align: right; white-space: nowrap; }
.cell-nowrap { white-space: nowrap; }

/* ---------- CHIPS (.chip) ----------
   Petit badge compact pour catégories, tags — remplace les chips
   fabriquées main dans realisations/sections. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  line-height: 1.4;
}
.chip--brand { background: var(--brand-subtle); color: var(--brand); }
.chip--accent { background: var(--accent-subtle); color: var(--accent); }
.chip--danger { background: var(--danger-subtle); color: var(--danger); }
/* Chip-bouton (cliquable, ex : filtre compact, suppression dans une chip) */
.chip-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  padding: var(--space-1) var(--space-3);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  transition: background var(--duration-fast), color var(--duration-fast);
}
.chip-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.chip-btn--danger { color: var(--danger); }
.chip-btn--danger:hover { background: var(--danger-subtle); }

/* ---------- PASTILLES DE STATUT (.status-dot) ----------
   Remplace les emojis 🟡🔵🟢⚫ dans les selects et badges.
   pastille colorée + label, rendu stable cross-platform. */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: currentColor;
  flex-shrink: 0;
}
.status-dot--new { color: var(--warning); }
.status-dot--read { color: var(--info); }
.status-dot--done { color: var(--success); }
.status-dot--archived { color: var(--text-tertiary); }

/* ---------- SWATCHS THÈME (.swatch) ----------
   Pour les presets de couleur dans theme.ejs. */
.swatch-grid {
  display: flex;
  justify-content: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}
.swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

/* ---------- CARTE DE CHAMP SUBTLE (.field-card) ----------
   Conteneur discret pour regrouper des champs (form-builder). */
.field-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--bg-subtle);
}

/* ---------- AVATARS (.avatar) ----------
   Initiales en fallback CSS (remplace ui-avatars.com).
   Usage : <span class="avatar">AB</span> ou <img class="avatar"> */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--brand);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  overflow: hidden;
  flex-shrink: 0;
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar--lg { width: 100px; height: 100px; font-size: var(--text-2xl); border: 3px solid var(--accent-subtle); }
.avatar--brand-soft { background: var(--brand-soft); }

/* ---------- LISTE À PUCES COHÉRENTE (.check-list, .bullet-list) ---------- */
.check-list, .bullet-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.check-list li,
.bullet-list li {
  position: relative;
  padding-left: var(--space-6);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  width: 18px;
  height: 18px;
  background: var(--accent-subtle);
  border-radius: var(--radius-full);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23C2683F' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.bullet-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--accent);
}

/* ---------- BLOC DE CODE (.code-block) ---------- */
.code-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: pre;
  color: var(--text-secondary);
  margin: 0;
}

/* ---------- TEXTE COLORE SÉMANTIQUE (raccourcis) ---------- */
.text-accent { color: var(--accent); }
.text-brand { color: var(--brand); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-md { font-size: var(--text-md); }
.text-right { text-align: right; }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold { font-weight: var(--fw-bold); }
.fw-normal { font-weight: var(--fw-regular); }

/* ---------- CONTENEUR D'ICÔNE 24x24 (réseaux sociaux, etc.) ---------- */
.icon-24 {
  display: inline-flex;
  width: 24px; height: 24px;
  align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-24 svg { width: 24px; height: 24px; }

/* ---------- SÉPARATEUR DISCRET (entre blocs, ex: options de champ select) ---------- */
.divider-block {
  padding-bottom: var(--space-5);
  border-bottom: 1px dashed var(--border-subtle);
}
.divider-block:last-child { border-bottom: none; padding-bottom: 0; }

/* ---------- FORM À LARGEUR LIMITÉE (account, etc.) ---------- */
.form-narrow { max-width: 480px; }

/* ---------- ÉTAT VIDE / EMPTY STATE ----------
   Remplace les emojis dans les empty states (📭🔍🌿…). */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}
.empty-state__icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-tertiary);
  margin-bottom: var(--space-4);
}
.empty-state__icon svg { width: 26px; height: 26px; }
.empty-state h3 { font-size: var(--text-md); margin-bottom: var(--space-1); color: var(--text-secondary); }
.empty-state p { font-size: var(--text-sm); margin: 0; }

/* ---------- CARTE AVANT / APRÈS (admin) ---------- */
.ba-card { display: flex; flex-direction: column; height: 100%; }
.ba-card__pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.ba-card__img-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
}
.ba-card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-card__tag {
  position: absolute;
  top: var(--space-1);
  left: var(--space-1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: #fff;
}
.ba-card__tag--before { background: rgba(0, 0, 0, 0.6); }
.ba-card__tag--after { background: var(--accent); }
.ba-card__title { font-size: var(--text-md); margin: 0 0 var(--space-1); }
.ba-card__location { margin: 0 0 var(--space-3); }
.ba-card__actions { display: flex; gap: var(--space-2); margin-top: auto; }

/* ---------- ONGLETS DES CARTES (admin cards.ejs) ---------- */
.card-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}
.card-tabs__link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.card-tabs__link:hover { color: var(--text-primary); background: var(--bg-subtle); }
.card-tabs__link.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: var(--fw-semibold);
}

/* ---------- CARTE GÉNÉRIQUE (admin cards.ejs — aperçu) ---------- */
.acard {
  background: var(--bg-elevated, var(--surface, #fff));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.acard__media {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
}
.acard__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acard__icon {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-subtle);
  color: var(--accent);
}
.acard__icon svg { width: 20px; height: 20px; }
.acard__title { font-size: var(--text-md); margin: 0; }
.acard__desc { font-size: var(--text-sm); color: var(--text-tertiary); margin: 0; }
.acard__actions { display: flex; gap: var(--space-2); margin-top: var(--space-2); }


/* ---------- LIEN D'ACTION COMPACT (.action-link) ---------- */
.action-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  transition: color var(--duration-fast);
}
.action-link:hover { color: var(--accent-hover); }

/* ---------- FORM TOGGLE INLINE (.form-inline) ----------
   Pour les mini-forms de toggle (visibility, etc.) dans les tables. */
.form-inline { display: inline; }

/* ---------- HINT DE CHAMP (.field-hint-block) ---------- */
.field-hint-block {
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
