/* ============================================================
   COMPONENTS.CSS — Composants réutilisables
   GP-MFB · Gestionnaire du Patrimoine
   ============================================================ */

/* ══════════════════════════════════════
   CARTES KPI
══════════════════════════════════════ */
.kpi {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 1.2rem 1.4rem;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-trend {
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }
/* Barre colorée en bas de la carte KPI */
.kpi-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  border-radius: 0 0 0 var(--radius-lg);
}

/* ══════════════════════════════════════
   CARTE GÉNÉRIQUE
══════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  overflow: hidden;
}
.card-head {
  padding: 1rem 1.4rem;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-head h3 { font-size: 13.5px; font-weight: 500; }
.card-head .ch-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.card-action {
  font-size: 12px;
  color: var(--blue-act);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  white-space: nowrap;
  transition: background .15s;
}
.card-action:hover {
  background: var(--blue-light);
  text-decoration: none;
}

/* ══════════════════════════════════════
   TABLEAU DE DONNÉES
══════════════════════════════════════ */
.tbl-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: .65rem 1.2rem;
  text-align: left;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 0.5px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 0.5px solid var(--border-soft);
  transition: background .1s;
}
tbody tr:hover { background: #FAFBFD; }
tbody tr:last-child { border-bottom: none; }
td { padding: .75rem 1.2rem; color: var(--text); }

/* Cellule référence monospace */
.td-ref {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
/* Cellule avec icône + texte */
.td-icon-cell {
  display: flex;
  align-items: center;
  gap: 9px;
}
.td-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
/* Variantes de fond pour icônes */
.td-icon.blue   { background: var(--info-bg); }
.td-icon.amber  { background: var(--warn-bg); }
.td-icon.green  { background: var(--success-bg); }
.td-icon.red    { background: var(--danger-bg); }

/* ══════════════════════════════════════
   BADGES DE STATUT
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
/* Pastille de couleur avant le texte */
.badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge-ok   { background: var(--success-bg); color: var(--success); }
.badge-att  { background: var(--warn-bg);    color: var(--warn); }
.badge-ko   { background: var(--danger-bg);  color: var(--danger); }
.badge-info { background: var(--info-bg);    color: var(--info); }

/* ══════════════════════════════════════
   FIL D'ACTIVITÉ
══════════════════════════════════════ */
.feed { padding: .5rem 0; }
.feed-item {
  display: flex;
  gap: 12px;
  padding: .85rem 1.4rem;
  border-bottom: 0.5px solid var(--border-soft);
  transition: background .1s;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: #FAFBFD; }
.feed-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-info { flex: 1; min-width: 0; }
.feed-info p {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 2px;
}
.feed-info p strong { font-weight: 500; }
.feed-time { font-size: 11px; color: var(--muted); }

/* ══════════════════════════════════════
   BARRES DE RÉPARTITION
══════════════════════════════════════ */
.distrib-wrap { padding: 1.4rem; display: flex; flex-direction: column; gap: 12px; }
.distrib-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.distrib-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.distrib-label { font-size: 12.5px; color: var(--text); flex: 1; min-width: 0; }
.distrib-track {
  flex: 1;
  height: 5px;
  background: var(--border-soft);
  border-radius: 3px;
}
.distrib-fill  { height: 100%; border-radius: 3px; }
.distrib-val   { font-size: 12.5px; font-weight: 500; color: var(--text); min-width: 32px; text-align: right; }

/* ══════════════════════════════════════
   MINI CARTES STATS
══════════════════════════════════════ */
.mini-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 14px;
}
.mini-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-label { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.mini-val   { font-size: 20px; font-weight: 500; color: var(--text); }

/* ══════════════════════════════════════
   FORMULAIRES
══════════════════════════════════════ */
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  padding: 0 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-field textarea { height: auto; padding: 10px 14px; resize: vertical; }
.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--hint); }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--blue-act);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(26,74,128,.1);
}
.form-required { color: var(--orange); margin-left: 2px; }

/* ── Boutons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .03em;
  font-family: inherit;
  border: none;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--blue-dark);
  color: #EEF4FF;
  width: 100%;
}
.btn-primary:hover { background: var(--blue-mid); }

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 0.5px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 0.5px solid #F0C0C0;
}
.btn-danger:hover { background: #FCD5D5; }

.btn-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

/* ══════════════════════════════════════
   PAGINATION
══════════════════════════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 1rem 1.4rem;
  border-top: 0.5px solid var(--border);
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--white);
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.page-btn:hover   { background: var(--bg); }
.page-btn.active  { background: var(--blue-dark); color: #EEF4FF; border-color: var(--blue-dark); font-weight: 500; }
.page-btn.disabled{ opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════
   ALERTES / MESSAGES
══════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: .85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 1rem;
  border: 0.5px solid transparent;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #B5DEC6; }
.alert-warn    { background: var(--warn-bg);    color: var(--warn);    border-color: #F6D59A; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: #F5AAAA; }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: #A8C8EE; }

/* ══════════════════════════════════════
   UTILITAIRES
══════════════════════════════════════ */
.text-muted   { color: var(--muted); }
.text-small   { font-size: 12px; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.fw-medium    { font-weight: 500; }
.mt-1  { margin-top: .5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: .5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
