/* Cabinet Admin — Dashboard metrics
 * Chargé uniquement sur la page /admin/cabinet
 */

/* ── Grille de cartes ── */
.cab-admin-dashboard {
  padding: 1.5rem 2rem;
}

.cab-dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Carte de base ── */
.cab-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 16px 18px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.cab-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px -14px rgba(59, 130, 246, 0.2);
}

/* ── Structure interne ── */
.cab-metric__inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cab-metric__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.cab-metric__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.cab-metric__icon i {
  font-size: 13px;
  color: #fff;
}

.cab-metric__label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.cab-metric__value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1;
}

.cab-metric__sub {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.3;
}

.cab-metric__empty {
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 12px 0;
}

/* ── Graphique en barres ── */
.cab-metric__chart {
  margin-top: 6px;
}

.cab-bar-chart {
  display: block;
  overflow: visible;
}

/* ── Couleurs par type de métrique ── */
.cab-m--clients      .cab-metric__icon { background: #4338ca; }
.cab-m--upcoming     .cab-metric__icon { background: #0284c7; }
.cab-m--completed    .cab-metric__icon { background: #059669; }
.cab-m--cancelled    .cab-metric__icon { background: #dc2626; }
.cab-m--active       .cab-metric__icon { background: #16a34a; }
.cab-m--dormant      .cab-metric__icon { background: #94a3b8; }
.cab-m--week         .cab-metric__icon { background: #7c3aed; }
.cab-m--month        .cab-metric__icon { background: #0ea5e9; }
.cab-m--chart        .cab-metric__icon { background: #1d4ed8; }
.cab-m--loyalty      .cab-metric__icon { background: #ec4899; }

/* Licence */
.cab-m--tier         .cab-metric__icon { background: #6366f1; }
.cab-m--quota        .cab-metric__icon { background: #f59e0b; }
.cab-m--credits      .cab-metric__icon { background: #14b8a6; }
.cab-m--readonly     .cab-metric__icon { background: #64748b; }

/* Financier */
.cab-m--ca-month     .cab-metric__icon { background: #10b981; }
.cab-m--ca-total     .cab-metric__icon { background: #0891b2; }
.cab-m--unpaid       .cab-metric__icon { background: #f97316; }
.cab-m--basket       .cab-metric__icon { background: #8b5cf6; }
.cab-m--invoices     .cab-metric__icon { background: #3b82f6; }
.cab-m--top-services .cab-metric__icon { background: #eab308; }

/* Packs */
.cab-m--packs-actifs   .cab-metric__icon { background: #2563eb; }
.cab-m--packs-sessions .cab-metric__icon { background: #6366f1; }
.cab-m--packs-offertes .cab-metric__icon { background: #ec4899; }
.cab-m--packs-alert    .cab-metric__icon { background: #f59e0b; }

/* Communication / ops */
.cab-m--sms       .cab-metric__icon { background: #06b6d4; }
.cab-m--email     .cab-metric__icon { background: #6366f1; }
.cab-m--fail      .cab-metric__icon { background: #dc2626; }
.cab-m--worked    .cab-metric__icon { background: #0f766e; }
.cab-m--peak      .cab-metric__icon { background: #f97316; }
.cab-m--discount  .cab-metric__icon { background: #db2777; }
.cab-m--breakdown .cab-metric__icon { background: #6366f1; }

/* La carte graphique occupe toute la largeur */
.cab-dashboard-cards:has(.cab-m--chart),
.cab-dashboard-cards:has(.cab-m--breakdown) {
  grid-template-columns: 1fr;
}

/* ── Sections ── */
.cab-section {
  margin-bottom: 28px;
}

.cab-section__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.cab-section__title i {
  color: #3b8ad9;
}

.cab-section__hint {
  font-size: 11px;
  font-weight: 500;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
  margin-left: auto;
}

/* ── Texte pleine valeur (pour libellés non numériques) ── */
.cab-metric__value--text {
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.cab-metric__suffix {
  font-size: 1rem;
  font-weight: 500;
  color: #94a3b8;
}

/* ── Badges tier ── */
.cab-tier--community .cab-metric__icon { background: #94a3b8; }
.cab-tier--solo      .cab-metric__icon { background: #2563eb; }
.cab-tier--pro       .cab-metric__icon { background: #7c3aed; }
.cab-tier--inactive  .cab-metric__icon { background: #ef4444; }

/* ── Barre de progression (quota) ── */
.cab-progress {
  height: 8px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  margin: 4px 0 2px;
}

.cab-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.cab-progress--warn   .cab-progress__bar { background: linear-gradient(90deg, #f59e0b, #f97316); }
.cab-progress--danger .cab-progress__bar { background: linear-gradient(90deg, #ef4444, #dc2626); }

/* ── Trend (variation) ── */
.cab-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.cab-trend--up   { background: rgba(16, 185, 129, 0.12); color: #059669; }
.cab-trend--down { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }

/* ── Top-list (top services) ── */
.cab-toplist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cab-toplist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(248, 250, 252, 0.7);
  border-radius: 6px;
  font-size: 12px;
}

.cab-toplist__rank {
  font-weight: 700;
  color: #94a3b8;
  flex-shrink: 0;
  width: 18px;
}

.cab-toplist__label {
  flex: 1;
  color: #334155;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cab-toplist__value {
  font-weight: 700;
  color: #1e293b;
}

/* ── Liste d'alertes (packs proches fin) ── */
.cab-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cab-alert-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(254, 243, 199, 0.4);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
}

.cab-alert-list li strong {
  color: #1e293b;
}

.cab-pill {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.cab-pill--warn {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

/* ── Breakdown horizontal (répartition prestations) ── */
.cab-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.cab-breakdown__row {
  display: grid;
  grid-template-columns: 140px 1fr 48px;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.cab-breakdown__label {
  color: #475569;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cab-breakdown__track {
  height: 12px;
  background: rgba(148, 163, 184, 0.15);
  border-radius: 6px;
  overflow: hidden;
}

.cab-breakdown__bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #3b82f6);
  border-radius: 6px;
}

.cab-breakdown__value {
  text-align: right;
  font-weight: 700;
  color: #1e293b;
}

.cab-breakdown__pct {
  color: #94a3b8;
  font-weight: 500;
  font-size: 11px;
  margin-left: 2px;
}

.cab-breakdown__label i {
  width: 16px;
  color: #6366f1;
  margin-right: 4px;
}

@media (max-width: 560px) {
  .cab-breakdown__row {
    grid-template-columns: 110px 1fr 70px;
  }
}

/* ── Grille 3 colonnes (top praticiens) ── */
.cab-dashboard-cards.cab-cards--3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* ── Badges tier (table + toplist) ── */
.cab-tier-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 4px;
}

.cab-tier-badge--inactive  { background: rgba(239, 68, 68, 0.15);  color: #b91c1c; }
.cab-tier-badge--community { background: rgba(148, 163, 184, 0.2); color: #475569; }
.cab-tier-badge--solo      { background: rgba(37, 99, 235, 0.15);  color: #1d4ed8; }
.cab-tier-badge--pro       { background: rgba(124, 58, 237, 0.18); color: #6d28d9; }

/* ── Pills status (quota) ── */
.cab-pill--ok     { background: rgba(16, 185, 129, 0.15); color: #047857; }
.cab-pill--danger { background: rgba(239, 68, 68, 0.18);  color: #b91c1c; }

/* ── Table praticiens ── */
.cab-table-wrap {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  overflow-x: auto;
}

.cab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 920px;
}

.cab-table thead th {
  background: rgba(248, 250, 252, 0.95);
  color: #475569;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  position: sticky;
  top: 0;
}

.cab-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  color: #334155;
  vertical-align: middle;
}

.cab-table tbody tr:hover {
  background: rgba(241, 245, 249, 0.6);
}

.cab-table tbody tr:last-child td {
  border-bottom: none;
}

.cab-table .cab-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cab-table strong {
  color: #1e293b;
}

.cab-table__sub {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ── Pied de page statistiques ── */
.cab-stats-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 10px 14px;
  background: rgba(248, 250, 252, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  font-size: 12px;
  color: #64748b;
}

.cab-stats-footer strong {
  color: #1e293b;
  font-weight: 600;
}

.cab-stats-sep {
  color: #cbd5e1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .cab-admin-dashboard {
    padding: 1rem;
  }

  .cab-dashboard-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .cab-metric__value {
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .cab-dashboard-cards {
    grid-template-columns: 1fr;
  }
}

/* Changelog button in plugin blueprint (fix .form-tabs.subtle override) */
.form-tabs.subtle a.button.cab-changelog-btn,
.form-tabs.subtle a.button.cab-changelog-btn:visited,
.form-tabs.subtle a.button.cab-changelog-btn:focus {
  color: #ffffff !important;
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
}

.form-tabs.subtle a.button.cab-changelog-btn:hover,
.form-tabs.subtle a.button.cab-changelog-btn:active {
  color: #ffffff !important;
  background: #7dd3fc !important;
  border-color: #7dd3fc !important;
}
