@import url('/static/fonts/fonts.css');

/* =========================================================================
   DESIGN TOKENS — direction "sobre moderne"
   ========================================================================= */

:root {
  /* fond & surfaces */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-alt: #f5f3ef;

  /* texte */
  --text: #1a1a1f;
  --text-2: #5b5b66;
  --text-3: #8a8a96;

  /* bordures & séparateurs */
  --border: #e8e6e0;
  --border-strong: #d6d3cb;

  /* accent fête des mères (rose framboise) */
  --accent: #d83a6c;
  --accent-hover: #b62e58;
  --accent-soft: #fbe7ee;
  --accent-text: #8b1f42;

  /* statuts */
  --success: #1f7a45;
  --success-soft: #e3f4ea;
  --warning: #8a5a00;
  --warning-soft: #fcefd3;
  --danger: #b3261e;
  --danger-soft: #fae3e1;

  /* ombres très subtiles */
  --shadow-1: 0 1px 2px rgba(15, 15, 20, 0.04), 0 1px 3px rgba(15, 15, 20, 0.06);
  --shadow-2: 0 4px 12px rgba(15, 15, 20, 0.06), 0 2px 6px rgba(15, 15, 20, 0.04);
  --shadow-pop: 0 8px 24px rgba(216, 58, 108, 0.18);

  /* radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* typo */
  --font: 'Quicksand', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-cursive: 'Caveat', cursive;
}

[data-theme="father"] {
  --accent: #1e6db5;
  --accent-hover: #134e85;
  --accent-soft: #e1eef9;
  --accent-text: #0f3f6e;
  --shadow-pop: 0 8px 24px rgba(30, 109, 181, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }

/* =========================================================================
   LAYOUTS
   ========================================================================= */

/* Parent — pages publiques (consent, listen, home, gone, not-yet) */
.parent-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}
.parent-container {
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 2;
}

/* ===== fond animé : cœurs qui flottent (parent uniquement) ===== */
.floating-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.floating-bg .h {
  position: absolute;
  bottom: -40px;
  width: 22px;
  height: 22px;
  opacity: 0;
  color: var(--accent);
  animation: floatUp 14s linear infinite;
  will-change: transform, opacity;
}
.floating-bg .h svg { width: 100%; height: 100%; display: block; }

/* positions, tailles, delays variés pour effet aléatoire */
.floating-bg .h:nth-child(1)  { left: 6%;  width: 18px; height: 18px; animation-duration: 16s; animation-delay: 0s; }
.floating-bg .h:nth-child(2)  { left: 14%; width: 14px; height: 14px; animation-duration: 12s; animation-delay: 3s; opacity: .6; }
.floating-bg .h:nth-child(3)  { left: 22%; width: 22px; height: 22px; animation-duration: 18s; animation-delay: 7s; }
.floating-bg .h:nth-child(4)  { left: 32%; width: 12px; height: 12px; animation-duration: 13s; animation-delay: 1.5s; }
.floating-bg .h:nth-child(5)  { left: 44%; width: 20px; height: 20px; animation-duration: 15s; animation-delay: 5s; }
.floating-bg .h:nth-child(6)  { left: 56%; width: 16px; height: 16px; animation-duration: 14s; animation-delay: 9s; }
.floating-bg .h:nth-child(7)  { left: 66%; width: 24px; height: 24px; animation-duration: 17s; animation-delay: 2.5s; }
.floating-bg .h:nth-child(8)  { left: 76%; width: 14px; height: 14px; animation-duration: 13s; animation-delay: 6s; }
.floating-bg .h:nth-child(9)  { left: 86%; width: 20px; height: 20px; animation-duration: 16s; animation-delay: 4s; }
.floating-bg .h:nth-child(10) { left: 94%; width: 16px; height: 16px; animation-duration: 15s; animation-delay: 10s; }

@keyframes floatUp {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.35; }
  50%  { transform: translateY(-50vh) rotate(8deg); opacity: 0.5; }
  90%  { opacity: 0.25; }
  100% { transform: translateY(-110vh) rotate(-6deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .floating-bg { display: none; }
}

/* Admin */
.admin-shell { min-height: 100vh; min-height: 100dvh; }
.admin-content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}
.admin-content.narrow { max-width: 560px; }

/* =========================================================================
   TOPBAR (admin)
   ========================================================================= */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }
.topbar-brand .logo-dot {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 8px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: white;
}
.topbar-brand .logo-dot svg { width: 16px; height: 16px; }
.topbar-brand .name-domain { display: none; }

.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.topbar-nav a {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.topbar-nav a:hover { background: var(--surface-alt); text-decoration: none; color: var(--text); }
.topbar-nav a.is-active { color: var(--text); background: var(--surface-alt); }
.topbar-nav a .count {
  background: var(--accent);
  color: white;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}

.topbar-spacer { flex: 1; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-user .who { display: none; color: var(--text-2); font-size: 13px; font-weight: 600; }
.topbar-user form { margin: 0; }

@media (min-width: 720px) {
  .topbar-brand .name-domain { display: inline; }
  .topbar-user .who { display: inline; }
  .topbar-nav a { padding: 7px 14px; font-size: 14px; }
}

/* =========================================================================
   TYPO
   ========================================================================= */

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.25;
}
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.tiny { font-size: 11px; }

.cursive {
  font-family: var(--font-cursive);
  font-weight: 700;
  font-size: 1.5em;
  vertical-align: -0.08em;
  color: var(--accent);
}

/* =========================================================================
   CARDS
   ========================================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 16px; }
.card-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title { font-size: 16px; font-weight: 800; }

/* =========================================================================
   FORMULAIRES
   ========================================================================= */

.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label,
.field > .label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="number"],
.field select,
.field textarea {
  appearance: none;
  width: 100%;
  font: inherit;
  font-size: 15px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field .hint { font-size: 12px; color: var(--text-2); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex-shrink: 0; }

/* =========================================================================
   BOUTONS
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { display: flex; width: 100%; }

.link-button {
  background: none; border: 0; padding: 0;
  color: var(--accent);
  text-decoration: underline;
  font: inherit; font-weight: 700;
  cursor: pointer;
}
.link-button.danger { color: var(--danger); }
.link-button.muted { color: var(--text-2); font-weight: 600; font-size: 13px; }

/* =========================================================================
   ALERTS
   ========================================================================= */

.alert {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
}
.alert + * { margin-top: 14px; }
.alert-error   { background: var(--danger-soft); color: #8a1f17; border-color: #f0c2bd; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #b8e0c4; }
.alert-info    { background: var(--accent-soft); color: var(--accent-text); border-color: #f4cdda; }

/* =========================================================================
   BADGES / STATUTS
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.badge-live    { background: var(--success-soft); color: var(--success); }
.badge-live::before    { background: var(--success); }
.badge-draft   { background: var(--warning-soft); color: var(--warning); }
.badge-draft::before   { background: var(--warning); }

/* =========================================================================
   PAGE HEADER (admin)
   ========================================================================= */

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 22px; display: inline-flex; align-items: center; gap: 10px; }
.page-head .back {
  display: inline-block;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  text-decoration: none;
}
.page-head .back:hover { color: var(--text); }
.page-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================================
   STATS (KPIs)
   ========================================================================= */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
@media (min-width: 720px) {
  .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; }
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}
.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-value {
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  line-height: 1.15;
  color: var(--text);
}
.stat-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; font-weight: 600; }
.stat-sub a { color: var(--accent); font-weight: 700; }

/* =========================================================================
   EVENT CARDS (dashboard)
   ========================================================================= */

.event-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) { .event-grid { grid-template-columns: 1fr 1fr; gap: 14px; } }
@media (min-width: 920px) { .event-grid { grid-template-columns: 1fr 1fr 1fr; } }

.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  position: relative;
  box-shadow: var(--shadow-1);
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.event-card:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
  color: inherit;
}
.event-card .ec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.event-card h3 { font-size: 16px; line-height: 1.3; }
.event-card .ec-meta { font-size: 12px; color: var(--text-2); font-weight: 600; }
.event-card .ec-progress {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.event-card .ec-progress span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot.green  { background: #2eb872; }
.dot.yellow { background: #f0b22d; }
.dot.red    { background: #e0524a; }

/* carte "+ Nouvel" */
.add-card {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-2);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: border-color .12s, color .12s, background .12s;
}
.add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}
.add-card svg { width: 22px; height: 22px; stroke-width: 2; }

/* =========================================================================
   ACTIONS ROW
   ========================================================================= */

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  align-items: center;
}
.actions-row .spacer { flex: 1; }

/* =========================================================================
   CHILDREN GRID
   ========================================================================= */

.children-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 600px) { .children-grid { grid-template-columns: 1fr 1fr; gap: 14px; } }
@media (min-width: 900px) { .children-grid { grid-template-columns: 1fr 1fr 1fr; } }

.child-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-1);
}
.child-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.child-name { font-weight: 800; font-size: 14px; line-height: 1.2; }
.child-meta { font-size: 11px; color: var(--text-2); font-weight: 600; }

.status-list { display: flex; flex-direction: column; gap: 6px; }
.status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.child-qr-thumb {
  width: 92px; height: 92px;
  margin: 0 auto;
  background: var(--surface-alt);
  border-radius: var(--r-sm);
  padding: 6px;
}
.child-url {
  display: block;
  font-size: 10.5px;
  word-break: break-all;
  color: var(--text-2);
  background: var(--surface-alt);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-weight: 500;
  line-height: 1.4;
}

.file-drop {
  display: block;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-alt);
}
.file-drop:hover { border-color: var(--accent); color: var(--accent); }
.file-drop strong { display: block; color: var(--text); font-weight: 800; margin-bottom: 2px; font-size: 13px; }
.file-drop input { display: block; margin: 6px auto 0; max-width: 100%; font-size: 11px; }

.child-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 2px;
}

/* =========================================================================
   PARENT — pages publiques
   ========================================================================= */

.parent-hero {
  text-align: center;
  margin-bottom: 18px;
}
.parent-hero .heart {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: block;
}

.parent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 22px;
  box-shadow: var(--shadow-2);
}

.parent-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.parent-card .subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 22px;
  font-weight: 600;
}

.parent-greeting {
  background: var(--accent-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  text-align: center;
  margin-bottom: 18px;
}
.parent-greeting .label {
  font-size: 12px;
  color: var(--accent-text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.parent-greeting .name {
  font-family: var(--font-cursive);
  font-size: 38px;
  color: var(--accent);
  line-height: 1;
  display: block;
  margin-top: 4px;
}

details.rgpd {
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
details.rgpd > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
details.rgpd > summary::-webkit-details-marker { display: none; }
details.rgpd > summary::after {
  content: '+';
  margin-left: auto;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center; justify-content: center;
  font-weight: 800;
  color: var(--text-2);
}
details.rgpd[open] > summary::after { content: '−'; }
details.rgpd .rgpd-body { padding: 0 14px 14px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
details.rgpd ul { margin: 6px 0 0 0; padding-left: 18px; }
details.rgpd li { margin-bottom: 4px; }
details.rgpd strong { color: var(--text); }

/* listen page : audio block */
.audio-block {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  margin: 16px 0;
}
.audio-block .ear { display: block; margin: 0 auto 6px; }
.audio-block .audio-title {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.audio-block audio { width: 100%; max-width: 360px; }

.delete-block {
  border-top: 1px solid var(--border);
  margin-top: 22px;
  padding-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
}
.delete-block strong { color: var(--text); }
.delete-block form { display: inline-block; margin-top: 8px; }
.delete-block.pending {
  background: var(--success-soft);
  border: 1px solid #b8e0c4;
  border-radius: var(--r-md);
  padding: 12px 14px;
  color: var(--success);
  margin-top: 18px;
}
.delete-block.pending strong { color: var(--success); }

/* =========================================================================
   DELETION REQUESTS
   ========================================================================= */

.request-list { display: flex; flex-direction: column; gap: 10px; }
.request-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-1);
}
.request-row .req-main { flex: 1; min-width: 220px; }
.request-row .req-title { font-weight: 800; font-size: 14px; }
.request-row .req-meta { font-size: 12px; color: var(--text-2); margin-top: 3px; font-weight: 600; }
.request-row .req-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* =========================================================================
   EMPTY STATE
   ========================================================================= */

.empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
}
.empty strong { color: var(--text); }

/* =========================================================================
   FOOTER
   ========================================================================= */

.parent-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-3);
}

/* =========================================================================
   ACCESSIBILITÉ
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
