/* ═══════════════════════════════════════════════════════════════
   factures.css — Styles spécifiques à la page factures récurrentes
   Chargé après global.css
═══════════════════════════════════════════════════════════════ */

body {
  max-width: 520px;
  margin: 0 auto;
  padding-bottom: 40px;
  min-height: 100vh;
  -webkit-color-scheme: light;
}

/* ── EN-TÊTE ── */
.header {
  padding: 40px 20px 56px;
}

.header-top {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 20px; position: relative; z-index: 1;
}

.header-title { font-family: var(--font-display); font-size: 20px; font-weight: 900; color: white; }
.header-sub   { color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 2px; }

/* Mobile-first : valeurs petits écrans par défaut, élargies ≥ 401px */
.header-stats {
  display: flex; gap: 4px;
  position: relative; z-index: 1;
}

.stat-chip {
  flex: 1;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border-radius: 14px; padding: 8px 4px;
  text-align: center;
}

.stat-chip-label { color: rgba(255,255,255,0.8); font-size: 8px; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 4px; }
.stat-chip-value { font-family: var(--font-display); font-size: 13px; font-weight: 900; color: white; }

/* ── ONGLETS ── */
.tabs-wrap {
  background: var(--white);
  margin: -24px 16px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative; z-index: 10;
  padding: 6px; overflow-x: auto;
  scrollbar-width: none;
}
.tabs-wrap::-webkit-scrollbar { display: none; }

.tabs { display: flex; gap: 4px; min-width: max-content; }

.tab {
  flex-shrink: 0;
  border: none; cursor: pointer;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 700;
  color: var(--muted);
  padding: 9px 14px;
  border-radius: 12px;
  transition: all 0.25s;
  white-space: nowrap;
}

.tab.active {
  background: linear-gradient(135deg, var(--orange), var(--orange2));
  color: white;
  box-shadow: 0 4px 12px rgba(255,107,44,0.35);
}

/* ── PAGES ── */
.page { display: none; padding: 20px 16px 0; }
.page.active { display: block; }

/* ── RECAP HERO ── */
.recap-hero {
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.recap-hero-label  { color: rgba(255,255,255,0.85); font-size: 13px; margin-bottom: 8px; }
.recap-hero-amount {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 900;
  color: white; line-height: 1;
  margin-bottom: 8px;
}
.recap-hero-sub { color: rgba(255,255,255,0.75); font-size: 12px; }

/* ── RECAP GRID ── */
.recap-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 10px; margin-bottom: 16px;
}

.recap-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
}

.recap-weekly     { border-color: var(--green); }
.recap-monthly    { border-color: var(--orange); }
.recap-quarterly  { border-color: var(--blue); }
.recap-semestrial { border-color: var(--purple); }
.recap-yearly     { border-color: var(--teal); }

.recap-card-icon   { font-size: 22px; margin-bottom: 8px; }
.recap-card-label  { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.recap-card-count  { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.recap-card-amount { font-family: var(--font-display); font-size: 16px; font-weight: 900; color: var(--text); }

/* ── PROGRESS CARD ── */
.progress-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.progress-item { margin-bottom: 14px; }
.progress-item:last-child { margin-bottom: 0; }
.progress-info { display: flex; justify-content: space-between; margin-bottom: 6px; }
.progress-name { font-size: 13px; font-weight: 600; }
.progress-pct  { font-size: 13px; font-weight: 700; }
.progress-bar  { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 8px; transition: width 0.6s ease; }

.progress-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}

.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.legend-dot  { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* ── SECTION TITLE ── */
.section-title-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-title      { font-family: var(--font-display); font-size: 16px; font-weight: 800; flex: 1; }

.badge-count {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; font-weight: 700;
  color: var(--muted);
}

/* ── ADD FORM ── */
.add-form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.add-form-title { font-family: var(--font-display); font-size: 15px; font-weight: 800; margin-bottom: 16px; color: var(--text); }

.form-row   { display: grid; grid-template-columns: 1fr; gap: 10px; }
.form-group { margin-bottom: 12px; }

.form-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted); margin-bottom: 6px; display: block;
}

.form-input {
  width: 100%; padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 14px; color: var(--text);
  outline: none; transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus { border-color: var(--orange); background: var(--white); }
.form-input::placeholder { color: #C4A882; }
select.form-input { cursor: pointer; }

/* Statut formulaire */
.status-toggle { display: flex; gap: 8px; }

.status-btn {
  flex: 1; padding: 9px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: none; cursor: pointer;
  font-family: var(--font-body);
  font-size: 12px; font-weight: 700;
  color: var(--muted); transition: all 0.2s;
}

.status-btn.status-active { border-color: var(--green);  background: var(--green-light);  color: #15803d; }
.status-btn.status-pause  { border-color: var(--yellow); background: var(--yellow-light); color: #854d0e; }

/* Bouton ajouter */
.add-btn {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: white; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 15px; font-weight: 800;
  box-shadow: 0 4px 16px rgba(255,107,44,0.30);
  transition: transform 0.2s; margin-top: 4px;
}
.add-btn:active { transform: scale(0.98); }

/* ── BILL CARDS ── */
.bills-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }

.bill-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  animation: fadeIn 0.3s ease;
  transition: opacity 0.2s;
}

.bill-card.paused { opacity: 0.55; }

.bill-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  display: flex; align-items: center;
  justify-content: center; font-size: 22px;
  flex-shrink: 0;
}

.bill-info { flex: 1; min-width: 0; }
.bill-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-meta { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.bill-badge { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.bill-badge.active { background: var(--green-light); color: #15803d; }
.bill-badge.pause  { background: var(--yellow-light); color: #854d0e; }

.bill-right          { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }
.bill-amount         { font-family: var(--font-display); font-size: 17px; font-weight: 900; color: var(--orange); }
.bill-monthly-equiv  { font-size: 10px; color: var(--muted); text-align: right; }
.bill-actions        { display: flex; gap: 6px; }

.bill-btn { background: none; border: none; cursor: pointer; font-size: 15px; padding: 2px; color: #DDD; transition: color 0.2s; }
.bill-btn.pause-btn:hover  { color: var(--yellow); }
.bill-btn.delete-btn:hover { color: var(--red); }

/* ── VIDE ── */
.empty-state {
  text-align: center; padding: 32px 20px;
  color: var(--muted); background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}
.empty-icon { font-size: 36px; margin-bottom: 10px; }
.empty-text { font-size: 13px; line-height: 1.6; }

/* ── CHIPS HEADER ────────────────────────────────────────────── */
.stat-chip-revenu .stat-chip-value  { color: #86efac; }
.stat-chip-depense .stat-chip-value { color: #fca5a5; }
.stat-value-green { color: #86efac !important; }
.stat-value-red   { color: #fca5a5 !important; }

/* ── SECTIONS PAR TYPE ──────────────────────────────────────── */
.section-revenus {
  padding-bottom: 8px;
}
.section-depenses {
  border-top: 2px dashed #FFE4B5;
  padding-top: 18px;
  margin-top: 6px;
}
.section-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-label.rev { color: #15803d; }
.section-label.dep { color: #c2410c; }

/* ── FORMULAIRE REVENUS ─────────────────────────────────────── */
.add-form-card-revenu {
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.add-form-title-revenu {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: #15803d;
  margin-bottom: 16px;
}

.add-form-card-revenu .form-input:focus { border-color: #22C55E; }

/* Bouton ajout revenu */
.add-btn-revenu {
  width: 100%; padding: 14px;
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white; border: none; cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 15px; font-weight: 800;
  box-shadow: 0 4px 16px rgba(34,197,94,0.30);
  transition: transform 0.2s; margin-top: 4px;
}
.add-btn-revenu:active { transform: scale(0.98); }

/* ── CARTE REVENU ───────────────────────────────────────────── */
.bill-card.revenu {
  border-left: 4px solid #22C55E;
}

.bill-amount.revenu { color: #15803d; }

/* ── BADGES SENS ────────────────────────────────────────────── */
.badge-revenu {
  background: #DCFCE7;
  color: #15803d;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.badge-depense {
  background: #FFF0E8;
  color: #c2410c;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

/* ── Mobile-first : élargissement ≥ 401px ── */
@media (min-width: 401px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .recap-grid { grid-template-columns: 1fr 1fr; }
  .recap-hero-amount { font-size: 48px; }
  .header-stats { gap: 8px; }
  .stat-chip { padding: 10px 8px; }
  .stat-chip-label { font-size: 9px; }
  .stat-chip-value { font-size: 16px; }
}
