/* Mêmes variables que admin/src/index.css et public-site/public/style.css — cohérence visuelle
   PicBooth sur toute la plateforme. */
:root {
  --ink: #0b0f1a;
  --ink-raised: #141b2d;
  --accent: #22d3ee;
  --on-accent: #06222b;
  --text: #e8ecf5;
  --muted: #8891a8;
  --border: #232c42;
  --danger: #ef4444;
  --success: #22c55e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.22;
  pointer-events: none;
  z-index: -1;
}
.glow-1 { top: -140px; left: -100px; width: 440px; height: 440px; background: var(--accent); }
.glow-2 { top: 160px; right: -140px; width: 400px; height: 400px; background: #4f6df5; opacity: 0.14; }

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand img { display: block; border-radius: 8px; }
.brand-text { font-family: "Archivo Black", "Inter", sans-serif; font-size: 1.1rem; }

.wrap-narrow { max-width: 420px; margin: 4rem auto; padding: 0 1.5rem; }

/* ---------- Coquille app : sidebar fixe + zone principale (pages dashboard / thèmes IA) ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background: #0a0d16;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1rem;
  z-index: 2;
}
.sidebar .brand { padding: 0 0.4rem 1.3rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-link.active { color: var(--on-accent); background: var(--accent); }
.sidebar-bottom { border-top: 1px solid var(--border); padding-top: 0.7rem; margin-top: 0.7rem; }
.sidebar-bottom form { margin: 0; }
.sidebar-bottom .nav-link { color: var(--muted); width: 100%; background: none; border: none; font-family: inherit; cursor: pointer; text-align: left; }
.sidebar-bottom .nav-link:hover { color: var(--danger); background: rgba(239, 68, 68, 0.08); }

.main { flex: 1; margin-left: 236px; min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.3rem 2rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(11, 15, 26, 0.85);
  backdrop-filter: blur(6px);
  z-index: 1;
}
.topbar h1 { margin: 0; font-size: 1.15rem; }
.topbar .text-muted { margin: 0.15rem 0 0; }
.content { padding: 1.75rem 2rem 3rem; }

/* ---------- Cartes statistiques (remplace l'ancien .kpi-row) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--ink-raised);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.8rem;
}
.stat-icon svg { width: 19px; height: 19px; }
.stat-value { font-family: "Archivo Black", "Inter", sans-serif; font-size: 1.7rem; line-height: 1.1; }
.stat-label { font-size: 0.78rem; color: var(--muted); margin-top: 0.25rem; }

h1 { font-family: "Archivo Black", "Inter", sans-serif; font-size: 1.4rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; }
.subtitle { color: var(--muted); font-size: 0.9rem; margin: 0 0 2rem; }

.card {
  background: var(--ink-raised);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
  margin: 0 0.35rem 0.3rem 0;
  font-size: 0.78rem;
}
.stat-chip strong { color: var(--text); font-size: 0.85rem; }
.stat-chip span { color: var(--muted); }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.15);
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-muted { background: rgba(136, 145, 168, 0.15); color: var(--muted); }

label { display: block; font-size: 0.85rem; margin: 0 0 0.3rem; color: var(--muted); }
input[type="text"], input[type="password"], input[type="date"], input[type="email"], input[type="number"], textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #090d16;
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
  font-family: inherit;
  resize: vertical;
  color-scheme: dark; /* sinon le sélecteur natif de input[type=date] s'affiche en clair, détonnant sur ce thème sombre */
}
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.field { margin-bottom: 0.5rem; }

button, .btn, .btn-primary, .btn-secondary, .btn-danger {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.flash { padding: 0.8rem 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.9rem; }
.flash-error { background: rgba(239, 68, 68, 0.12); border: 1px solid var(--danger); }
.flash-success { background: rgba(34, 197, 94, 0.12); border: 1px solid var(--success); }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; }

.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.text-muted { color: var(--muted); font-size: 0.8rem; }
.flex-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; }
.dot-up { background: var(--success); }
.dot-down { background: var(--danger); }
.container-pill { display: flex; align-items: center; font-size: 0.78rem; color: var(--muted); margin-bottom: 0.3rem; }

/* ---------- Sections avec en-tête (titre + sous-titre séparés du contenu) ---------- */
.card-header { border-bottom: 1px solid var(--border); padding-bottom: 0.9rem; margin-bottom: 1.1rem; }
.card-header h2 { margin: 0; }
.card-header .text-muted { margin-top: 0.2rem; }

/* ---------- Tableaux : lignes plus respirées, survol discret ---------- */
td { padding-top: 0.85rem; padding-bottom: 0.85rem; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.stat-chip { margin-bottom: 0.3rem; }

/* ---------- Colonne "Abonnement" / actions client : blocs nets au lieu d'un mur de contrôles ---------- */
.sub-status { margin-bottom: 0.6rem; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input { margin: 0; padding: 0.4rem 0.6rem; font-size: 0.78rem; width: auto; }
.inline-form input[name="plan"] { width: 108px; }
.inline-form input[type="date"] { width: 140px; }
.inline-form input[type="email"] { width: 170px; }
.inline-form input[type="number"] { width: 80px; }
.inline-form button { padding: 0.4rem 0.7rem; font-size: 0.78rem; white-space: nowrap; }
.action-stack { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; }
.action-stack form { margin: 0; }
.action-stack .btn-primary, .action-stack .btn-secondary { padding: 0.4rem 0.9rem; font-size: 0.8rem; width: 100%; }
.danger-zone {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}
.danger-zone .inline-form { justify-content: flex-end; }
.danger-zone input[name="confirmSlug"] { width: 104px; }
.danger-zone .btn-danger { padding: 0.4rem 0.7rem; font-size: 0.78rem; }

/* ---------- Bornes par client : diagramme orbital (centre + satellites reliés) ---------- */
/* Hauteur ET largeur fixées en px (pas aspect-ratio) : les enfants en position absolute avec
   top/left en % se basent sur la hauteur du conteneur AU MOMENT du layout — avec aspect-ratio,
   certains moteurs (constaté sur Firefox) résolvent encore cette hauteur de façon instable à
   ce moment-là, ce qui disperse les nœuds n'importe où. Des px fixes des deux côtés évitent
   complètement ce calcul. */
.orbit-wrap { position: relative; width: 420px; height: 420px; margin: 0.5rem auto 0; }
/* Page détail client : jusqu'à 6 conteneurs, besoin de plus de place qu'avec 2-3 clients. */
.orbit-wrap-lg { width: 560px; height: 560px; }
.orbit-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.orbit-line { stroke: var(--border); stroke-width: 1.4; }
.orbit-line-up { stroke: var(--accent); opacity: 0.55; stroke-dasharray: 4 3; animation: orbit-dash 2.4s linear infinite; }
.orbit-line-down { opacity: 0.4; }
@keyframes orbit-dash { to { stroke-dashoffset: -28; } }

.orbit-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: var(--ink-raised);
  border: 1px solid var(--border);
  box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.06), 0 0 0 12px rgba(34, 211, 238, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.orbit-center-value { font-family: "Archivo Black", "Inter", sans-serif; font-size: 1.9rem; color: var(--accent); line-height: 1.1; }
.orbit-center-label { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 0.15rem; }
.orbit-center-sub { font-size: 0.68rem; color: var(--muted); margin-top: 0.3rem; }

.orbit-node-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.4rem;
}
.orbit-node-icon svg { width: 15px; height: 15px; }
.orbit-node .orbit-node-caption .dot { display: inline-block; width: 6px; height: 6px; margin: 0 0.3rem 0 0; vertical-align: middle; }

.orbit-node {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 128px;
  background: var(--ink-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}
.orbit-node:hover { border-color: var(--accent); }
.orbit-node .dot { display: block; width: 7px; height: 7px; margin: 0 auto 0.4rem; }
.orbit-node-slug { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.78rem; font-weight: 600; }
.orbit-node-count { font-family: "Archivo Black", "Inter", sans-serif; font-size: 1rem; margin-top: 0.2rem; }
.orbit-node-caption { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }

/* ---------- Thèmes IA globaux ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.theme-card { background: #0d1324; border: 1px solid var(--border); border-radius: 12px; padding: 1rem; }
.theme-preview { width: 100%; height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 0.9rem; display: block; background: #090d16; }
.theme-preview-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.8rem; }
