/* ==========================================================================
   Studio (admin) — statistiques, tableaux, import, réglages
   ========================================================================== */

/* En-têtes de page admin (générés en .row.between) */
.main > .row.between {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.main > .row.between h1 + p,
.main > h1 + p { margin-top: var(--space-2); }

/* ---------- Statistiques ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin: var(--space-8) 0 var(--space-4);
}

.stat {
  position: relative;
  padding: var(--space-5) var(--space-6);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

/* Première carte mise en avant, comme le tableau de bord Kentra Gestion */
.stat:first-child {
  border-color: #1465c9;
  background: var(--gradient-feature);
}

.stat:first-child p,
.stat:first-child .small { color: #c6d8f0 !important; }
.stat:first-child strong { color: #fff; }

.stat p { font-size: var(--text-sm); font-weight: 550; }

.stat strong {
  display: block;
  margin: var(--space-2) 0 var(--space-1);
  color: var(--ink);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat .small { font-size: var(--text-xs); }

/* ---------- Tableaux ---------- */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: var(--subtle);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

tbody tr { transition: background var(--fast); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

td strong { color: var(--ink); }
td p.small { margin-top: 2px; }

td .btn { min-height: 36px; padding: 7px 14px; font-size: var(--text-xs); box-shadow: none; }

td img { display: inline-block; margin-right: var(--space-3); border-radius: 6px; vertical-align: middle; }
td input { min-height: 38px; min-width: 160px; padding: 7px 12px; font-size: var(--text-sm); }

.settings .table-wrap { box-shadow: none; }

/* ---------- Zone d'import ---------- */
.dropzone {
  display: grid;
  justify-items: center;
  margin: var(--space-6) 0;
  padding: var(--space-16) var(--space-6);
  border: 2px dashed var(--blue-line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% 0%, rgba(18, 101, 216, 0.08), transparent 60%),
    var(--surface);
  text-align: center;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}

.dropzone > svg {
  width: 60px;
  height: 60px;
  padding: 16px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
}

.dropzone h2 { margin: var(--space-4) 0 var(--space-1); }

.dropzone.drag {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: scale(1.01);
}

.upload-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  animation: rise-in 0.25s var(--ease);
}

.upload-row img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); }
.upload-row .progress { flex: 1; min-width: 0; }
.upload-row strong { display: block; overflow: hidden; color: var(--ink); font-size: var(--text-sm); text-overflow: ellipsis; white-space: nowrap; }

.progress-bar {
  height: 6px;
  margin-top: var(--space-2);
  overflow: hidden;
  border-radius: var(--radius-full);
  background: var(--border);
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.3s var(--ease);
}

/* ---------- Réglages (interrupteurs) ---------- */
.settings > label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
}

.settings > label:last-child { border-bottom: 0; }

/* Interrupteur iOS à partir d'une case à cocher */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px !important;
  height: 26px !important;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--border-strong);
  cursor: pointer;
  transition: background var(--fast);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s var(--ease);
}

.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { box-shadow: var(--ring); outline: none; }

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

@media (max-width: 580px) {
  .stats { gap: var(--space-3); margin-top: var(--space-6); }
  .stat { padding: var(--space-4); }
  .stat strong { font-size: 1.6rem; }
  .main > .row.between > .btn { width: 100%; }
  .dropzone { padding: var(--space-10) var(--space-4); }
  th, td { padding: var(--space-3) var(--space-4); }
}
