/* ============================================================
   COMPONENTS.CSS — Composants réutilisables
   GP-MFB · Gestionnaire du Patrimoine
   Palette : Orange & Vert CI
   ============================================================ */

/* ══════════════════════════════════════
   CARTES KPI
══════════════════════════════════════ */
.kpi {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.3rem 1.5rem 1.1rem;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.kpi:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.07);
  transform: translateY(-1px);
}
.kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 600;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 30px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 7px;
  font-family: var(--font-serif);
}
.kpi-trend {
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }

/* Bande colorée en bas */
.kpi-bar {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
}
/* Variantes couleur */
.kpi-bar.orange { background: linear-gradient(90deg, var(--orange), var(--orange-dark)); }
.kpi-bar.green  { background: linear-gradient(90deg, var(--green-act), var(--green-mid)); }
.kpi-bar.gold   { background: linear-gradient(90deg, var(--gold), #A07828); }
.kpi-bar.danger { background: linear-gradient(90deg, var(--danger), #8B1010); }

/* ══════════════════════════════════════
   CARTE GÉNÉRIQUE
══════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card-head {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
}
.card-head h3 { font-size: 13.5px; font-weight: 600; }
.card-head .ch-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.card-action {
  font-size: 12px;
  color: var(--orange);
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 6px;
  border: 1px solid rgba(217,104,26,.25);
  white-space: nowrap;
  transition: background .15s, box-shadow .15s;
}
.card-action:hover {
  background: var(--orange-light);
  box-shadow: 0 2px 6px rgba(217,104,26,.15);
  text-decoration: none;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: .7rem 1.2rem;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--green-mid);
  text-transform: uppercase;
  letter-spacing: .07em;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s;
}
tbody tr:hover { background: var(--orange-light); }
tbody tr:last-child { border-bottom: none; }
td { padding: .8rem 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: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.td-icon.blue   { background: var(--green-light); }
.td-icon.amber  { background: var(--orange-light); }
.td-icon.green  { background: var(--success-bg); }
.td-icon.red    { background: var(--danger-bg); }
.td-icon.gold   { background: var(--gold-light); }

/* ══════════════════════════════════════
   BADGES DE STATUT
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .02em;
}
.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(--orange-light); color: var(--orange); }
.badge-gold { background: var(--gold-light);   color: #8A6820; }

/* ══════════════════════════════════════
   FIL D'ACTIVITÉ
══════════════════════════════════════ */
.feed { padding: .5rem 0; }
.feed-item {
  display: flex;
  gap: 12px;
  padding: .85rem 1.4rem;
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--surface); }
.feed-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-dot.orange { background: var(--orange-light); color: var(--orange); }
.feed-dot.green  { background: var(--green-light);  color: var(--green-mid); }
.feed-dot.gold   { background: var(--gold-light);   color: var(--gold); }

.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: 600; }
.feed-time { font-size: 11px; color: var(--muted); }

/* ══════════════════════════════════════
   BARRES DE RÉPARTITION
══════════════════════════════════════ */
.distrib-wrap { padding: 1.4rem; display: flex; flex-direction: column; gap: 14px; }
.distrib-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.distrib-color {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.distrib-label { font-size: 12.5px; color: var(--text); flex: 1; min-width: 0; }
.distrib-track {
  flex: 1;
  height: 6px;
  background: var(--border-soft);
  border-radius: 3px;
  overflow: hidden;
}
.distrib-fill  { height: 100%; border-radius: 3px; }
.distrib-fill.orange { background: linear-gradient(90deg, var(--orange), var(--orange-dark)); }
.distrib-fill.green  { background: linear-gradient(90deg, var(--green-act), var(--green-mid)); }
.distrib-fill.gold   { background: var(--gold); }
.distrib-val   { font-size: 12.5px; font-weight: 600; color: var(--text); min-width: 34px; text-align: right; }

/* ══════════════════════════════════════
   MINI CARTES STATS
══════════════════════════════════════ */
.mini-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .2s;
}
.mini-card:hover { box-shadow: 0 3px 12px rgba(0,0,0,.07); }
.mini-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mini-icon.orange { background: var(--orange-light); color: var(--orange); }
.mini-icon.green  { background: var(--green-light);  color: var(--green-mid); }
.mini-icon.gold   { background: var(--gold-light);   color: var(--gold); }
.mini-label { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; font-weight: 500; }
.mini-val   { font-size: 22px; font-weight: 500; color: var(--text); font-family: var(--font-serif); }

/* ══════════════════════════════════════
   FORMULAIRES
══════════════════════════════════════ */
.form-field { margin-bottom: 18px; }
.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  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: 1.5px 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, background .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(--orange);
  background: var(--white);
  box-shadow: 0 0 0 3px var(--orange-glow);
}
.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 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .03em;
  font-family: inherit;
  border: none;
  transition: background .15s, transform .1s, box-shadow .15s;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }

/* Bouton principal — orange ambré (distinct du module #D9681A) */
.btn-primary {
  background: linear-gradient(135deg, #F07C20 0%, #C85A06 100%);
  color: #fff;
  width: 100%;
  box-shadow: 0 3px 10px rgba(200,90,6,.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #E07018 0%, #B84E04 100%);
  box-shadow: 0 4px 14px rgba(200,90,6,.4);
}

/* Bouton connexion — orange CI classique */
.auth-right .btn-primary {
  background: linear-gradient(135deg, #D9681A 0%, #B55412 100%);
  box-shadow: 0 3px 10px rgba(217,104,26,.3);
}
.auth-right .btn-primary:hover {
  background: linear-gradient(135deg, #C05A14 0%, #A04810 100%);
  box-shadow: 0 4px 14px rgba(217,104,26,.42);
}

/* Bouton secondaire — vert */
.btn-secondary {
  background: var(--white);
  color: var(--green-mid);
  border: 1.5px solid var(--green-mid);
}
.btn-secondary:hover {
  background: var(--green-light);
  border-color: var(--green-act);
}

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

/* Bouton neutre */
.btn-neutral {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-neutral:hover { background: var(--border-soft); }

.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: 1px solid var(--border);
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 12.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.page-btn:hover   { background: var(--orange-light); border-color: var(--orange); color: var(--orange); }
.page-btn.active  { background: var(--orange); color: #fff; border-color: var(--orange); font-weight: 600; box-shadow: 0 2px 6px rgba(217,104,26,.3); }
.page-btn.disabled{ opacity: .4; pointer-events: none; }

/* ══════════════════════════════════════
   ALERTES / MESSAGES
══════════════════════════════════════ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: .9rem 1.1rem;
  border-radius: var(--radius-md);
  font-size: 13px;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  line-height: 1.5;
}
.alert-success { background: var(--success-bg); color: var(--success); border-color: #A8D5B8; }
.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(--orange-light); color: var(--orange); border-color: rgba(217,104,26,.25); }

/* ══════════════════════════════════════
   UTILITAIRES
══════════════════════════════════════ */
.text-muted    { color: var(--muted); }
.text-orange   { color: var(--orange); }
.text-green    { color: var(--green-mid); }
.text-gold     { color: var(--gold); }
.text-small    { font-size: 12px; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.fw-medium     { font-weight: 500; }
.fw-bold       { font-weight: 600; }
.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; }
