/* ============================================================
   COMPONENTS — boutons, cartes, formulaires, tableaux, badges
   ============================================================ */

/* ── Boutons ── */
.btn, .pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--s1), var(--s2));
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
  white-space: nowrap;
}

.btn:hover, .pill-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(98,168,255,.28);
  background: linear-gradient(180deg, rgba(98,168,255,.18), rgba(98,168,255,.08));
  box-shadow: var(--shadow-s);
}

.btn:active, .pill-btn:active { transform: translateY(0) scale(.985); }

.btn-primary {
  background: linear-gradient(180deg, #66afff, #2f73e8);
  border-color: rgba(255,255,255,.12);
  color: #fff;
  box-shadow: 0 8px 24px rgba(72,129,255,.24);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #7ab9ff, #3b7df0);
  border-color: rgba(255,255,255,.18);
}

.btn-danger {
  background: linear-gradient(180deg, rgba(255,107,107,.20), rgba(255,107,107,.10));
  border-color: rgba(255,107,107,.28);
  color: #ffb8b8;
}
.btn-danger:hover {
  background: linear-gradient(180deg, rgba(255,107,107,.30), rgba(255,107,107,.16));
}

.btn-sm, .mini-btn {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
}

/* ── Cartes ── */
.card, .section-card, .hero-card,
.user-card, .nav-card, .stats-card,
.import-card, .toolbar-card {
  background: linear-gradient(180deg, var(--s1), var(--s2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.card         { padding: 22px; }
.section-card { padding: 20px; }
.hero-card    { padding: 24px; margin-bottom: 18px; }
.stats-card   { padding: 18px; }
.import-card  { padding: 16px; }
.toolbar-card { padding: 16px; margin-bottom: 14px; }

.card h2, .card h3,
.section-card h2, .section-card h3 { margin-top: 0; }

/* Hero */
.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hero-title { font-size: 20px; font-weight: 800; margin: 0; }
.hero-sub   { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stats-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stats-value { font-size: 30px; font-weight: 800; }
.stats-sub   { margin-top: 5px; font-size: 12px; color: var(--muted); }

/* ── Formulaires ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label, .field > span {
  font-size: 13px;
  font-weight: 600;
  color: #d9e6ff;
}

.field.full { grid-column: 1 / -1; }

.input, .select, textarea {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10) !important;
  background: rgba(2,10,24,.56) !important;
  color: var(--text) !important;
  padding: 0 14px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

textarea {
  min-height: 100px;
  padding: 13px 14px;
  resize: vertical;
}

input[type="file"].input { padding: 12px 14px; }

.input::placeholder, textarea::placeholder {
  color: rgba(235,242,255,.38);
}

.input:focus, .select:focus, textarea:focus {
  border-color: rgba(98,168,255,.55) !important;
  box-shadow: 0 0 0 4px rgba(98,168,255,.10);
}

/* ── Tableaux ── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.02);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th, .table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,.06);
  vertical-align: top;
}

.table th {
  font-size: 13px;
  font-weight: 600;
  color: #d6e5ff;
  background: rgba(255,255,255,.03);
  white-space: nowrap;
}

.table td { color: #f3f7ff; }
.table tr:last-child td { border-bottom: none; }

/* ── Badges de statut ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  width: max-content;
}

.status-new      { border-color: rgba(255,255,255,.14); }
.status-paid     { border-color: rgba(57,217,138,.30); background: rgba(57,217,138,.10); color: #9dffd4; }
.status-progress { border-color: rgba(98,168,255,.30); background: rgba(98,168,255,.10); color: #b8d8ff; }
.status-done     { border-color: rgba(255,207,107,.30); background: rgba(255,207,107,.10); color: #ffe9b0; }
.status-error    { border-color: rgba(255,107,107,.30); background: rgba(255,107,107,.10); color: #ffb8b8; }

/* ── Messages et boîtes ── */
.info-box {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(98,168,255,.20);
  background: rgba(98,168,255,.08);
  color: #dfeeff;
  font-size: 13px;
}

.success-box {
  border-color: rgba(57,217,138,.25);
  background: rgba(57,217,138,.08);
  color: #9dffda;
}

.error-box {
  border-color: rgba(255,107,107,.25);
  background: rgba(255,107,107,.08);
  color: #ffb8b8;
}

.muted-box {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ── Wizard ── */
.wizard-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.wizard-badge {
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  color: #e8f1ff;
  font-size: 13px;
  opacity: .6;
  transition: opacity .2s, border-color .2s, background .2s;
}

.wizard-badge.active {
  opacity: 1;
  border-color: rgba(98,168,255,.55);
  background: linear-gradient(180deg, rgba(98,168,255,.20), rgba(98,168,255,.08));
}

.wizard-step-title {
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 18px;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ── Option cards (checkboxes) ── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  cursor: pointer;
  transition: border-color .18s, background .18s;
  min-height: 52px;
}

.option-card:has(input:checked) {
  border-color: rgba(98,168,255,.45);
  background: rgba(98,168,255,.10);
}

.option-card input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--blue);
  flex-shrink: 0;
  min-height: unset;
  border-radius: 0;
}

/* ── Summary ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
}

.summary-box {
  background: rgba(255,255,255,.04);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}

.summary-box h3 { margin: 0 0 12px; font-size: 15px; }

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,.07);
  font-size: 14px;
}

.summary-row:last-child { border-bottom: none; }
.summary-row span       { color: var(--muted); }

.summary-total {
  font-size: 22px;
  font-weight: 800;
  margin-top: 12px;
}

.summary-strike { opacity: .6; text-decoration: line-through; }

/* ── Chips ── */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
}

.chip.active {
  background: linear-gradient(180deg, rgba(98,168,255,.22), rgba(98,168,255,.10));
  border-color: rgba(98,168,255,.38);
}

.chip.ok   { border-color: rgba(57,217,138,.28); background: rgba(57,217,138,.10); color: #9dffd4; }
.chip.warn { border-color: rgba(255,207,107,.28); background: rgba(255,207,107,.10); color: #ffe9b0; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2,8,20,.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}
.modal-backdrop.open { display: flex; }

.modal-card {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,32,58,.97), rgba(8,18,34,.97));
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.modal-head h3 { margin: 0 0 4px; font-size: 22px; }
.modal-sub     { margin: 0; color: var(--muted); font-size: 13px; }

.modal-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.modal-group {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
}

.modal-group h4 { margin: 0 0 10px; font-size: 14px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Grilles utilitaires ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }

.hidden   { display: none !important; }
.nowrap   { white-space: nowrap; }
.muted    { color: var(--muted); }
.small    { font-size: 12px; color: var(--muted); }
.money    { font-size: 17px; font-weight: 700; }
.ok-text  { color: #8af0b4; }
.warn-text{ color: #ffdba2; }
.err-text { color: #ffb0b0; }

/* ── Responsive components ── */
@media (max-width: 1100px) {
  .stats-grid          { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid           { grid-template-columns: 1fr; }
  .summary-grid        { grid-template-columns: 1fr; }
  .option-grid         { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .modal-groups        { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .stats-grid          { grid-template-columns: 1fr; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .option-grid         { grid-template-columns: 1fr; }
}
