/* ============================================================================
 * Module : artisan/styles/pages/factures.css
 * Rôle   : Styles spécifiques à la page Mes Factures.
 *          - Table factures + badges statut (Payée / Attente / Avoir / Annulée)
 *          - Footer "nouvelle facture"
 *          - Modal de création d'avoir
 *
 *          Les classes communes (`.stats-row`, `.stat-card`, `.topbar-search`,
 *          `.advanced-filters`, `.filter-*`, `.table-header`, `.table-tabs`,
 *          `.table-wrap`, `.row-actions`, `.tut-banner`, `.btn-small`,
 *          `.form-feedback`, …) sont désormais dans `dashboard-shell.css`
 *          (D-133/D-134).
 *
 * Dépend de : tokens.css + dashboard-shell.css + date-range-picker.css
 * Utilisé par : /artisan/factures.html
 * ============================================================================ */

.factures-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ─── Table ──────────────────────────────────────────────────── */
.factures-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.factures-table thead th {
  text-align: left;
  font-weight: var(--weight-semibold);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-500);
  padding: 12px 14px;
  border-bottom: 1.5px solid var(--gray-100);
}
.factures-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.factures-table tbody tr:last-child td { border-bottom: none; }
.factures-table tbody tr:hover { background: var(--gray-50); }
.factures-table tbody tr.row-annulee td { opacity: .65; }

/* Cellules métier */
.facture-num {
  font-weight: var(--weight-bold);
  color: var(--brand);
  white-space: nowrap;
}
.facture-num.is-avoir {
  color: #dc2626;
}
.facture-num.is-avoir::after {
  content: ' AVOIR';
  font-size: .68rem;
  font-weight: var(--weight-bold);
  margin-left: 4px;
  color: #dc2626;
  background: #fee2e2;
  padding: 2px 4px;
  border-radius: 3px;
}
.facture-num.is-annulee {
  color: var(--gray-400);
}

.facture-devis-lie {
  font-size: .85rem;
  color: var(--brand);
}

.facture-client {
  font-weight: var(--weight-semibold);
  color: var(--brand-dark);
}

.facture-amount {
  font-weight: var(--weight-bold);
  color: var(--brand-dark);
  white-space: nowrap;
}

.facture-date {
  font-size: .85rem;
  white-space: nowrap;
}

/* ─── Badges statut spécifiques ──────────────────────────────── */
.fact-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: var(--weight-bold);
  white-space: nowrap;
}
.fact-badge-payee   { background: #dcfce7; color: #16a34a; }
.fact-badge-attente { background: #ffedd5; color: #f97316; }
.fact-badge-avoir   { background: #fee2e2; color: #dc2626; }
.fact-badge-annulee { background: #fee2e2; color: #dc2626; }

/* ─── États vide / loading ──────────────────────────────────── */
.factures-loading,
.factures-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}
.factures-empty .empty-sub {
  display: block;
  margin-top: 8px;
  font-size: .82rem;
}
.factures-empty .empty-sub strong { color: var(--brand-dark); }

/* ─── Footer info (création facture) ─────────────────────────── */
.factures-footer {
  padding: 20px;
  background: var(--brand-50);
  border-radius: var(--radius);
  border: 1px solid var(--brand-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
/* Liens hypertextes hint, mais PAS les boutons (.btn override le color: white). */
.factures-footer a:not(.btn) { color: var(--brand); text-decoration: underline; }
.footer-title {
  font-size: .88rem;
  color: var(--brand);
  font-weight: var(--weight-semibold);
  margin: 0;
}
.footer-hint {
  font-size: .82rem;
  color: var(--gray-500);
  margin: 4px 0 0;
  line-height: 1.55;
}
.btn-new-invoice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
  text-decoration: none;
  padding: 10px 20px;
  white-space: nowrap;
}

/* ─── Modal avoir ────────────────────────────────────────────── */
.avoir-modal-hint {
  font-size: .88rem;
  color: var(--gray-600);
  line-height: 1.55;
  margin: 0 0 16px;
}
.avoir-modal-hint strong { color: var(--brand-dark); }

.field-hint {
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 4px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ─── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .factures-footer { flex-direction: column; align-items: stretch; }
}
