/* =============================================================================
   Reverchon'Digital — Composants réutilisables
   Boutons, cartes, badges, champs, tableaux, stats, avatars, lignes…
   Une classe = une responsabilité visuelle. Réutilisés par toutes les pages.
   ========================================================================== */

/* =============================== BOUTONS ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: var(--fw-semibold);
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--dur-normal) var(--ease-standard),
              border-color var(--dur-normal) var(--ease-standard),
              transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-normal) var(--ease-standard);
}
.btn svg { display: block; flex-shrink: 0; }
.btn:active { transform: scale(.97); }

/* Primaire — brique pleine */
.btn--primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover { background: var(--primary-hover); }
.btn--primary:active { background: var(--primary-active); }

/* Secondaire — surface blanche, bordure */
.btn--ghost {
  background: var(--color-surface);
  color: var(--text-primary);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { background: var(--primary-soft); border-color: var(--brick-200); }

/* Variante brique discrète (texte brique sur blanc) */
.btn--soft {
  background: var(--color-surface);
  color: var(--primary);
  border-color: #E0C4BB;
  box-shadow: 0 4px 12px rgba(119, 23, 10, .08);
}
.btn--soft:hover { background: var(--primary-soft); }

/* Danger discret (déconnexion) */
.btn--danger {
  background: var(--color-surface);
  color: var(--error-strong);
  border-color: var(--brick-200);
}
.btn--danger:hover { background: var(--error-bg); }

/* Tailles */
.btn--sm { padding: 9px 14px; font-size: 13.5px; gap: 7px; border-radius: 11px; }
.btn--block { width: 100%; justify-content: center; }

/* =============================== CARTES ============================== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
}
.card--pad { padding: 26px; }
.card--flush { overflow: hidden; } /* listes internes à bords nets */

/* En-tête de carte (titre + méta) */
.card__head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card__title { margin: 0; font-size: 17px; font-weight: var(--fw-bold); }
.card__meta { font-size: 12.5px; color: var(--text-muted); font-weight: var(--fw-semibold); }

/* Carte ambrée (relances, IA) */
.card--amber {
  background: linear-gradient(155deg, #ffffff, var(--amber-surface));
  border-color: var(--amber-border);
}

/* Carte sombre (créer un document) */
.card--dark {
  background: linear-gradient(150deg, #2a0f08, #5E1206 130%);
  color: #FCEFEA;
  border: none;
  box-shadow: 0 12px 28px rgba(119, 23, 10, .18);
}

/* ============================== BADGES / PILLS ======================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: var(--fw-bold);
  letter-spacing: .02em;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge--warning { background: var(--warning-bg); color: var(--warning-strong); }
.badge--success { background: var(--success-bg); color: var(--success-strong); }
.badge--error   { background: var(--error-bg);   color: var(--error-strong); }
.badge--info    { background: var(--info-bg);    color: var(--info-strong); }
.badge--neutral { background: var(--color-surface-sunken); color: var(--text-secondary); }
.badge--brand   { background: #FBE9DD; color: #A8551F; }

/* ============================== AVATARS ============================== */
.avatar {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-md);
}
.avatar--sm { width: 40px; height: 40px; font-size: 14px; border-radius: 12px; }
.avatar--md { width: 58px; height: 58px; font-size: 19px; border-radius: 17px; }
.avatar--lg { width: 70px; height: 70px; font-size: 24px; border-radius: 19px; }
/* Déclinaisons de teinte (alternance douce) */
.avatar--brick { background: linear-gradient(135deg, #A82C18, #5E1206); color: #FCEFEA; }
.avatar--clay  { background: #FBE9DD; color: #A8551F; }
.avatar--ink   { background: #E7E3DD; color: #57534E; }
.avatar--sand  { background: #EFE6D9; color: #8A6A3F; }

/* =========================== ICÔNE EN PASTILLE ====================== */
.chip-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
}
.chip-icon--sm { width: 30px; height: 30px; }
.chip-icon--md { width: 38px; height: 38px; }
.chip-icon--lg { width: 44px; height: 44px; }
.chip-icon--ink { background: var(--ink-900); color: #FCEFEA; }
.chip-icon--clay { background: #FBE9DD; color: #A8551F; }
.chip-icon--brick { background: var(--primary-soft); color: var(--primary); }
.chip-icon--warning { background: var(--warning-bg); color: var(--warning-strong); }
.chip-icon--info { background: var(--info-bg); color: var(--info-strong); }
.chip-icon--success { background: var(--success-bg); color: var(--success-strong); }

/* ============================== CHAMPS ============================== */
.field { display: block; }
.field__label {
  display: block;
  font-size: 13px;
  font-weight: var(--fw-bold);
  color: var(--text-secondary);
  margin-bottom: 7px;
}
.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #FBFAF8;
  font-size: 14.5px;
  color: var(--text-primary);
  transition: border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--brick-300);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
textarea.input { resize: vertical; min-height: 110px; line-height: 1.5; }

/* Champ de recherche avec icône à gauche */
.search {
  position: relative;
  max-width: 420px;
}
.search__icon {
  position: absolute;
  left: 15px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: inline-flex;
  pointer-events: none;
}
.search .input {
  padding-left: 40px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

/* Grille de champs (formulaires, réglages) */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* =============================== TABLEAU ============================= */
.table-card {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
  overflow-y: hidden;
}
.table {
  width: 100%;
  min-width: 640px;
}
.table__head {
  display: grid;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--divider);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: var(--fw-bold);
}
.table__row {
  display: grid;
  gap: 16px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 16px 24px;
  border-bottom: 1px solid var(--divider-soft);
  background: transparent;
  transition: background var(--dur-fast) var(--ease-standard);
}
.table__row:last-child { border-bottom: none; }
a.table__row:hover, button.table__row:hover { background: #FBF7F1; }
/* Colonnes spécifiques à la liste clients */
.table--clients .table__head,
.table--clients .table__row { grid-template-columns: 2.2fr 2fr 1.3fr 0.9fr; }

.cell-strong { font-size: 15px; font-weight: var(--fw-semibold); color: var(--text-primary); }
.cell-sub    { font-size: 13px; color: var(--text-tertiary); }
.cell-amount { font-size: 15px; font-weight: var(--fw-bold); color: var(--text-primary); }
.cell-right  { text-align: right; }
.truncate    { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ============================ LIGNE LISTE =========================== */
/* Ligne cliquable générique (à traiter, documents…) */
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  padding: 15px 22px;
  border-bottom: 1px solid var(--divider-soft);
  background: transparent;
  transition: background var(--dur-fast) var(--ease-standard);
}
.row:last-child { border-bottom: none; }
a.row:hover, button.row:hover { background: #FBF7F1; }
.row__body { flex: 1; min-width: 0; }
.row__title { display: block; font-size: 14.5px; font-weight: var(--fw-semibold); color: var(--text-primary); }
.row__sub { display: block; font-size: 13px; color: var(--text-tertiary); margin-top: 1px; }

/* =============================== STATS ============================== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}
.stat {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-card);
  padding: 20px 20px 18px;
  box-shadow: var(--shadow-md);
}
.stat__top { display: flex; align-items: center; justify-content: space-between; }
.stat__label {
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: var(--fw-semibold);
}
.stat__value { margin-top: 14px; font-size: var(--text-2xl); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.stat__sub { margin-top: 3px; font-size: 13px; color: var(--text-muted); font-weight: var(--fw-medium); }

/* ============================ PILLS DE STATUT ======================= */
/* Couleurs sémantiques par statut de document. */
.status { font-size: 12px; font-weight: var(--fw-bold); padding: 5px 11px; border-radius: var(--radius-pill); white-space: nowrap; }
.status--brouillon { background: var(--color-surface-sunken); color: var(--text-secondary); }
.status--envoye    { background: var(--info-bg); color: var(--info-strong); }
.status--vu        { background: #EFE6D9; color: #8A6A3F; }
.status--accepte   { background: var(--success-bg); color: var(--success-strong); }
.status--paye      { background: var(--success-bg); color: var(--success-strong); }
.status--partiel   { background: var(--warning-bg); color: var(--warning-strong); }
.status--en_retard { background: var(--error-bg); color: var(--error-strong); }
.status--en_attente{ background: var(--warning-bg); color: var(--warning-strong); }
.status--refuse    { background: var(--error-bg); color: var(--error-strong); }
.status--cloture   { background: var(--color-surface-sunken); color: var(--text-muted); }

/* ============================= ÉTAT VIDE ============================ */
.empty {
  background: var(--color-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  padding: 48px 30px;
  text-align: center;
}
.empty__icon {
  width: 54px; height: 54px;
  margin: 0 auto 16px;
  border-radius: var(--radius-lg);
  background: #F3EDE3;
  color: var(--warning-strong);
  display: flex; align-items: center; justify-content: center;
}
.empty__title { margin: 0 0 6px; font-size: 19px; font-weight: var(--fw-bold); }
.empty__text { margin: 0 auto; max-width: 360px; font-size: 14px; color: var(--text-tertiary); line-height: 1.55; }

/* Encadré pointillé « à venir » / vide léger */
.placeholder-note {
  padding: 20px;
  border: 1px dashed #E0D8CC;
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ============================ BANNIÈRE « À VENIR » ================== */
/* Pour les fonctionnalités réservées aux prochains lancements. */
.soon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: var(--fw-bold);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-sunken);
  color: var(--text-tertiary);
}
