/* =========================================================
   DocRDV — design system
   ========================================================= */

/* ── Variables / thème ──────────────────────────────────── */
:root {
  --font: 'Public Sans', ui-sans-serif, system-ui, sans-serif;
  --r-ctl:  10px;
  --r-card: 16px;
}

html.theme-light {
  --bg:              oklch(0.984 0.004 240);
  --surface:         #ffffff;
  --surface-2:       oklch(0.972 0.005 240);
  --bd:              oklch(0.912 0.008 245);
  --bd-strong:       oklch(0.855 0.012 245);
  --text:            oklch(0.27  0.025 252);
  --muted:           oklch(0.52  0.02  250);
  --faint:           oklch(0.63  0.016 250);
  --primary:         oklch(0.55  0.135 248);
  --primary-press:   oklch(0.485 0.14  248);
  --primary-soft:    oklch(0.962 0.022 248);
  --primary-soft-bd: oklch(0.9   0.045 248);
  --primary-fg:      #ffffff;
  --ok:              oklch(0.58  0.11  162);
  --ok-soft:         oklch(0.955 0.038 162);
  --warn:            oklch(0.66  0.13   62);
  --warn-soft:       oklch(0.962 0.05   78);
  --violet:          oklch(0.56  0.13  292);
  --violet-soft:     oklch(0.96  0.03  292);
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 2px 6px -2px rgba(16,24,40,.06);
  --shadow-lg: 0 18px 44px -12px rgba(16,30,54,.22);
  --header-bg:      rgba(255,255,255,0.88);
  --header-border:  oklch(0.895 0.012 245);
  --header-shadow:  0 1px 0 oklch(0.895 0.012 245), 0 2px 8px rgba(16,30,80,.07);
  color-scheme: light;
}

html.theme-dark {
  --bg:              oklch(0.155 0.018 260);
  --surface:         oklch(0.247 0.02  252);
  --surface-2:       oklch(0.292 0.021 252);
  --bd:              oklch(0.345 0.02  252);
  --bd-strong:       oklch(0.42  0.022 252);
  --text:            oklch(0.96  0.008 250);
  --muted:           oklch(0.735 0.018 250);
  --faint:           oklch(0.6   0.018 250);
  --primary:         oklch(0.71  0.13  250);
  --primary-press:   oklch(0.65  0.13  250);
  --primary-soft:    oklch(0.33  0.06  250);
  --primary-soft-bd: oklch(0.44  0.07  250);
  --primary-fg:      oklch(0.17  0.02  252);
  --ok:              oklch(0.75  0.12  162);
  --ok-soft:         oklch(0.33  0.05  162);
  --warn:            oklch(0.8   0.12   78);
  --warn-soft:       oklch(0.35  0.05   78);
  --violet:          oklch(0.74  0.12  292);
  --violet-soft:     oklch(0.34  0.05  292);
  --shadow:    0 1px 2px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 44px -12px rgba(0,0,0,.6);
  --header-bg:      rgba(24,30,54,0.82);
  --header-border:  oklch(0.32 0.025 252);
  --header-shadow:  0 1px 0 oklch(0.32 0.025 252), 0 2px 16px rgba(0,0,0,.35);
  color-scheme: dark;
}

/* ── Light mode : fond blanc cassé + orbs CSS ───────────── */
html.theme-light body {
  background: linear-gradient(160deg,
    oklch(0.995 0.002 240) 0%,
    oklch(0.982 0.008 245) 50%,
    oklch(0.968 0.012 248) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ── Dark mode : fond dégradé bleu nuit ─────────────────── */
html.theme-dark { background: oklch(0.09 0.01 262); }
html.theme-dark body {
  background: linear-gradient(167deg,
    oklch(0.27 0.052 256) 0%,
    oklch(0.2  0.034 258) 38%,
    oklch(0.135 0.018 260) 72%,
    oklch(0.075 0.008 262) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* ════════════════════════════════════════════════
   ORBS LIQUIDES — fond animé (CSS pur)
   ════════════════════════════════════════════════ */

/* Conteneur : couvre tout l'écran, derrière le contenu */
#liquid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

/* Base commune à toutes les orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform, border-radius;
  pointer-events: none;
}

/* Stéthoscope décoratif — par-dessus les orbs, derrière le contenu.
   Image grise détourée : teintée en noir (clair) / blanc (sombre) via filter,
   à très faible opacité pour rester discret. */
/* Objets médicaux flottants — petits icônes line-art qui dérivent doucement. */
.float-icon {
  position: absolute;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}
html.theme-light .float-icon { opacity: 0.08; filter: brightness(0); }
html.theme-dark  .float-icon { opacity: 0.24; filter: brightness(0) invert(1); }

.fi-virus-1 { width: 76px; height: 76px; background-image: url('/assets/virus-line.png'); top: 11%; left: 12%; animation: float-a 16s ease-in-out infinite; }
.fi-virus-2 { width: 54px; height: 54px; background-image: url('/assets/virus-line.png'); top: 64%; left: 8%;  animation: float-b 20s ease-in-out infinite; }
.fi-virus-3 { width: 64px; height: 64px; background-image: url('/assets/virus-line.png'); top: 22%; right: 10%; animation: float-c 18s ease-in-out infinite; }
.fi-pill-1  { width: 70px; height: 70px; background-image: url('/assets/pill-line.png');  top: 72%; right: 12%; animation: float-a 21s ease-in-out infinite; }
.fi-pill-2  { width: 50px; height: 50px; background-image: url('/assets/pill-line.png');  top: 40%; left: 6%;   animation: float-c 15s ease-in-out infinite; }
.fi-pill-3  { width: 58px; height: 58px; background-image: url('/assets/pill-line.png');  top: 50%; right: 7%;  animation: float-b 17s ease-in-out infinite; }
.fi-syringe-1 { width: 64px; height: 94px; background-image: url('/assets/syringe-line.png'); top: 30%; left: 30%; animation: float-c 19s ease-in-out infinite; }
.fi-syringe-2 { width: 52px; height: 76px; background-image: url('/assets/syringe-line.png'); top: 78%; left: 42%; animation: float-a 23s ease-in-out infinite; }
.fi-steth-1 { width: 78px; height: 78px; background-image: url('/assets/stethoscope-bg.png'); top: 18%; left: 46%; animation: float-b 22s ease-in-out infinite; }
.fi-steth-2 { width: 60px; height: 60px; background-image: url('/assets/stethoscope-bg.png'); top: 60%; right: 30%; animation: float-c 26s ease-in-out infinite; }

@keyframes float-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(48px, -60px) rotate(28deg); }
  66%      { transform: translate(-30px, -28px) rotate(-14deg); }
}
@keyframes float-b {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(-56px, -40px) rotate(-26deg); }
  66%      { transform: translate(22px, -52px) rotate(20deg); }
}
@keyframes float-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33%      { transform: translate(40px, 54px) rotate(22deg); }
  66%      { transform: translate(52px, -24px) rotate(-18deg); }
}
@media (prefers-reduced-motion: reduce) {
  .float-icon { animation: none !important; }
}

/* ── Orbs thème CLAIR ───────────────────────────────────── */

/* Orb 1 — bleu santé, coin haut-droit */
html.theme-light .orb-1 {
  width: 680px;
  height: 520px;
  top: -140px;
  right: -80px;
  background: radial-gradient(ellipse at center,
    oklch(0.72 0.11 248 / 0.42) 0%,
    oklch(0.82 0.07 248 / 0.18) 55%,
    transparent 80%);
  animation: orb-drift-1 22s ease-in-out infinite;
}

/* Orb 2 — rose/violet doux, coin bas-gauche */
html.theme-light .orb-2 {
  width: 560px;
  height: 480px;
  bottom: -100px;
  left: -60px;
  background: radial-gradient(ellipse at center,
    oklch(0.74 0.10 340 / 0.32) 0%,
    oklch(0.82 0.07 330 / 0.14) 55%,
    transparent 80%);
  animation: orb-drift-2 28s ease-in-out infinite;
}

/* Orb 3 — violet/indigo, milieu-haut-gauche */
html.theme-light .orb-3 {
  width: 440px;
  height: 380px;
  top: 15%;
  left: 8%;
  background: radial-gradient(ellipse at center,
    oklch(0.68 0.10 292 / 0.20) 0%,
    oklch(0.78 0.07 280 / 0.09) 55%,
    transparent 80%);
  animation: orb-drift-3 34s ease-in-out infinite;
}

/* Orb 4 — bleu clair, milieu-bas-droite */
html.theme-light .orb-4 {
  width: 500px;
  height: 420px;
  bottom: 10%;
  right: 5%;
  background: radial-gradient(ellipse at center,
    oklch(0.76 0.09 220 / 0.22) 0%,
    oklch(0.84 0.06 230 / 0.10) 55%,
    transparent 80%);
  animation: orb-drift-4 26s ease-in-out infinite;
}

/* ── Orbs thème SOMBRE (plus discrètes) ─────────────────── */

html.theme-dark .orb-1 {
  width: 820px;
  height: 600px;
  top: -180px;
  right: -120px;
  background: radial-gradient(ellipse at center,
    oklch(0.62 0.14 248 / 0.50) 0%,
    oklch(0.48 0.10 256 / 0.24) 55%,
    transparent 80%);
  animation: orb-drift-1 24s ease-in-out infinite;
}

html.theme-dark .orb-2 {
  width: 640px;
  height: 500px;
  bottom: -120px;
  left: -80px;
  background: radial-gradient(ellipse at center,
    oklch(0.56 0.13 292 / 0.42) 0%,
    oklch(0.42 0.09 280 / 0.18) 55%,
    transparent 80%);
  animation: orb-drift-2 30s ease-in-out infinite;
}

html.theme-dark .orb-3 {
  width: 480px;
  height: 400px;
  top: 20%;
  left: 5%;
  background: radial-gradient(ellipse at center,
    oklch(0.58 0.11 270 / 0.30) 0%,
    oklch(0.44 0.08 265 / 0.14) 55%,
    transparent 80%);
  animation: orb-drift-3 38s ease-in-out infinite;
}

html.theme-dark .orb-4 {
  width: 560px;
  height: 440px;
  bottom: 5%;
  right: 8%;
  background: radial-gradient(ellipse at center,
    oklch(0.60 0.12 240 / 0.32) 0%,
    oklch(0.46 0.09 250 / 0.15) 55%,
    transparent 80%);
  animation: orb-drift-4 28s ease-in-out infinite;
}

/* ── Keyframes des 4 mouvements indépendants ────────────── */
/* Chaque orb a sa propre trajectoire pour l'effet lava-lamp */

@keyframes orb-drift-1 {
  0%   { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
  20%  { transform: translate(-40px, 30px) scale(1.06) ; border-radius: 55% 45% 52% 48%; }
  45%  { transform: translate(-20px, 60px) scale(0.96) ; border-radius: 48% 52% 44% 56%; }
  70%  { transform: translate( 50px, 20px) scale(1.04) ; border-radius: 52% 48% 58% 42%; }
  100% { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
}

@keyframes orb-drift-2 {
  0%   { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
  25%  { transform: translate( 60px,-40px) scale(1.08) ; border-radius: 46% 54% 50% 50%; }
  50%  { transform: translate( 30px, 50px) scale(0.94) ; border-radius: 54% 46% 48% 52%; }
  75%  { transform: translate(-50px, 20px) scale(1.05) ; border-radius: 50% 50% 56% 44%; }
  100% { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
}

@keyframes orb-drift-3 {
  0%   { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
  30%  { transform: translate( 70px, 30px) scale(1.10) ; border-radius: 44% 56% 52% 48%; }
  60%  { transform: translate( 20px,-50px) scale(0.92) ; border-radius: 56% 44% 46% 54%; }
  100% { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
}

@keyframes orb-drift-4 {
  0%   { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
  35%  { transform: translate(-60px,-30px) scale(1.07) ; border-radius: 52% 48% 44% 56%; }
  65%  { transform: translate(-20px, 55px) scale(0.95) ; border-radius: 46% 54% 58% 42%; }
  100% { transform: translate(0,    0)    scale(1)    ; border-radius: 50%; }
}

/* ── Accessibilité : suppression des animations ─────────── */
@media (prefers-reduced-motion: reduce) {
  .orb { animation: none !important; }
}

/* ── Reset & base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--primary-soft-bd); }

/* ── Bug iOS : font-size ≥ 16px sur tous les champs ─────── */
input, select, textarea { font-size: 16px !important; }
@media (min-width: 640px) {
  input, select, textarea { font-size: inherit !important; }
}

/* ── Scrollbar discrète ─────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bd-strong);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.nice-scroll { scrollbar-width: thin; scrollbar-color: var(--bd-strong) transparent; }

/* ── Icône Lucide wrapper ───────────────────────────────── */
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico > svg { width: 100%; height: 100%; display: block; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(4px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes menuSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view    { animation: fadeSlideIn .18s ease-out; }
.pop-in  { animation: popIn .22s cubic-bezier(.2,.7,.2,1) both; }
@media (prefers-reduced-motion: reduce) {
  .view, .pop-in { animation: none; }
}

/* ════════════════════════════════════════════════
   HEADER renforcé
   ════════════════════════════════════════════════ */
.site-header {
  position: sticky;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
}

html.theme-light .site-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg,
    oklch(0.55 0.135 248) 0%,
    oklch(0.62 0.12 220)  50%,
    oklch(0.55 0.135 248) 100%);
  opacity: 0.7;
}

.header-inner { position: relative; }

.header-icon-btn {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-ctl);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.header-icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Toggle langue FR | EN ──────────────────────────────── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: var(--r-ctl);
  background: transparent;
}
.lang-toggle .lang-opt {
  border: none;
  background: transparent;
  color: var(--faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-toggle .lang-opt:hover { color: var(--text); background: var(--surface-2); }
.lang-toggle .lang-opt.active { color: var(--primary); }
.lang-toggle .lang-sep { color: var(--faint); font-size: 12px; user-select: none; }

/* ── Menu mobile hamburger ──────────────────────────────── */
.mobile-menu {
  display: none;
  border-top: 1px solid var(--header-border);
  background: var(--header-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mobile-menu.is-open {
  display: block;
  animation: menuSlideDown .18s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .mobile-menu.is-open { animation: none; }
}

#main-nav-mobile .nav-tab {
  width: 100%;
  justify-content: flex-start;
  border-radius: var(--r-ctl);
  padding: 0 16px;
  height: 44px;
  font-size: 15px;
}

/* ── Composants de base ─────────────────────────────────── */

/* Card */
.ds-card {
  background: var(--surface);
  border: 1px solid var(--bd);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
}
.ds-card-hover { transition: border-color .15s, box-shadow .15s; }
.ds-card-hover:hover { border-color: var(--bd-strong); box-shadow: var(--shadow-lg); }

/* Badge */
.ds-badge {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px; border: 1px solid transparent;
  padding: 3px 8px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.ds-badge-neutral { background: var(--surface-2);   color: var(--muted);   border-color: var(--bd); }
.ds-badge-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-soft-bd); }
.ds-badge-ok      { background: var(--ok-soft);      color: var(--ok); }
.ds-badge-warn    { background: var(--warn-soft);     color: var(--warn); }
.ds-badge-violet  { background: var(--violet-soft);   color: var(--violet); }

/* Chip */
.ds-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; border: 1px solid var(--bd);
  padding: 0 12px; height: 36px;
  font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap;
  background: var(--surface); color: var(--muted);
  transition: border-color .15s, background .15s, color .15s;
}
.ds-chip:hover  { border-color: var(--bd-strong); color: var(--text); }
.ds-chip.active { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }

/* Button */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-ctl); font-weight: 600; font-family: var(--font);
  cursor: pointer; transition: background .15s, opacity .15s;
  white-space: nowrap; border: none; gap: 8px;
}
.ds-btn:disabled { opacity: .5; cursor: not-allowed; }
.ds-btn-sm  { height: 36px; padding: 0 12px; font-size: 13px;   gap: 6px; }
.ds-btn-md  { height: 44px; padding: 0 16px; font-size: 14.5px; gap: 8px; }
.ds-btn-lg  { height: 48px; padding: 0 20px; font-size: 15px;   gap: 8px; }
.ds-btn-primary { background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow); }
.ds-btn-primary:hover:not(:disabled) { background: var(--primary-press); }
.ds-btn-soft  { background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-soft-bd); }
.ds-btn-soft:hover:not(:disabled) { opacity: .8; }
.ds-btn-ghost { background: transparent; color: var(--muted); }
.ds-btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.ds-btn-outline { background: var(--surface); color: var(--text); border: 1px solid var(--bd); }
.ds-btn-outline:hover:not(:disabled) { border-color: var(--bd-strong); }
.ds-btn-danger { background: oklch(0.55 0.18 25); color: #fff; }
.ds-btn-danger:hover:not(:disabled) { background: oklch(0.49 0.18 25); }
.ds-btn-warn   { background: var(--warn); color: #fff; }
.ds-btn-warn:hover:not(:disabled)   { background: oklch(0.58 0.14 62); }
.ds-btn-full { width: 100%; }

/* Field */
.ds-field {
  display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 14px;
  border-radius: var(--r-ctl); background: var(--surface); border: 1px solid var(--bd);
  transition: border-color .15s, box-shadow .15s;
}
.ds-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 15%, transparent);
}
.ds-field input, .ds-field select {
  flex: 1; min-width: 0; background: transparent; outline: none;
  color: var(--text); font-family: var(--font); border: none; padding: 0;
}
.ds-field input::placeholder { color: var(--faint); }

/* Segmented */
.ds-segmented {
  display: inline-flex; align-items: center; padding: 4px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--bd); height: 40px;
}
.ds-seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 0 14px; height: 100%;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: transparent; border: none; color: var(--muted);
  transition: color .15s; font-family: var(--font); white-space: nowrap;
}
.ds-seg-btn:hover { color: var(--text); }
.ds-seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Avatar */
.ds-avatar {
  display: grid; place-items: center; border-radius: 999px;
  font-weight: 700; flex-shrink: 0; font-family: var(--font);
}

/* Striped placeholder */
.ph-stripe {
  background-image: repeating-linear-gradient(
    135deg,
    color-mix(in oklch, var(--muted) 9%, transparent) 0 9px,
    transparent 9px 18px
  );
}

/* ── Navigation tabs ────────────────────────────────────── */
.nav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; height: 36px; border-radius: 999px;
  font-weight: 600; font-size: 13.5px; cursor: pointer;
  transition: background .15s, color .15s; white-space: nowrap;
  color: var(--muted); background: transparent; border: none; font-family: var(--font);
}
.nav-tab:hover { background: color-mix(in oklch, var(--primary) 8%, transparent); color: var(--text); }
.nav-tab.active {
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--primary-soft-bd);
}

/* ── Carte praticien ────────────────────────────────────── */
.practitioner-card {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: var(--r-card); box-shadow: var(--shadow);
  cursor: pointer; transition: border-color .15s, box-shadow .15s; overflow: hidden;
}
.practitioner-card:hover { border-color: var(--bd-strong); box-shadow: var(--shadow-lg); }
/* Carte favori sélectionnée : fond bleu → signale que le calendrier ci-dessous
   lui est rattaché. */
.practitioner-card.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--primary) 35%, transparent);
}

/* ── Pictogramme profession ─────────────────────────────── */
.pro-picto {
  display: block;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* Wrapper relatif pour picto + avatar de fallback (superposés) */
.pro-picto-wrap {
  position: relative;
  flex-shrink: 0;
}

/* ── Spinner ────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--bd-strong); border-top-color: var(--primary);
  border-radius: 9999px; animation: spin .7s linear infinite;
  display: inline-block; flex-shrink: 0;
}

/* ── Spinner overlay calendrier ─────────────────────────── */
/* Injecté par setCalendarLoading() pendant datesSet */
.cal-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  backdrop-filter: blur(2px);
  z-index: 10;
  border-radius: 0;
  pointer-events: none;
}
/* ── Loader organique (blob morphant) ───────────────────── */
/* Forme fluide qui se déforme + tourne doucement, dans l'esprit des orbs.
   Remplace le cercle qui tourne dans l'overlay du calendrier. */
.organic-loader {
  width: 112px;
  height: 112px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--violet) 100%);
  border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  animation: organic-morph 2.4s ease-in-out infinite,
             organic-spin 6s linear infinite,
             organic-pulse 2.4s ease-in-out infinite;
  box-shadow: 0 6px 20px -4px color-mix(in oklch, var(--primary) 45%, transparent);
}
.cal-loader .organic-loader { width: 128px; height: 128px; }

@keyframes organic-morph {
  0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%      { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
@keyframes organic-spin {
  to { transform: rotate(360deg); }
}
@keyframes organic-pulse {
  0%, 100% { opacity: .85; }
  50%      { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .organic-loader { animation: organic-pulse 2s ease-in-out infinite; }
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; padding: 10px 20px; border-radius: var(--r-ctl);
  font-size: 14px; font-weight: 600; font-family: var(--font);
  box-shadow: var(--shadow-lg); pointer-events: none;
  animation: popIn .2s cubic-bezier(.2,.7,.2,1) both; white-space: nowrap;
}
.toast-success { background: var(--ok);                color: #fff; }
.toast-error   { background: oklch(0.55 0.18 25);      color: #fff; }
.toast-info    { background: var(--primary);           color: var(--primary-fg); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeSlideIn .15s ease-out; backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface); border: 1px solid var(--bd);
  border-radius: var(--r-card); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 28rem; padding: 28px; color: var(--text);
}
.modal-box h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--text); }
.modal-box p  { margin: 0 0 16px; font-size: 14px; color: var(--muted); }

/* ── Formulaire ─────────────────────────────────────────── */
.form-input {
  width: 100%; border: 1px solid var(--bd); border-radius: var(--r-ctl);
  padding: 10px 14px; font-family: var(--font); color: var(--text);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 15%, transparent);
}
.form-input::placeholder { color: var(--faint); }
select.form-input { cursor: pointer; }

.form-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px;
}

/* ── Badges statut ───────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.badge-green  { background: var(--ok-soft);         color: var(--ok); }
.badge-red    { background: oklch(0.96 0.03 25);    color: oklch(0.55 0.18 25); }
.badge-orange { background: var(--warn-soft);        color: var(--warn); }
.badge-gray   { background: var(--surface-2);        color: var(--muted); border: 1px solid var(--bd); }

/* ── Bouton favori ───────────────────────────────────────── */
.btn-fav {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-ctl);
  border: 1px solid var(--bd); background: var(--surface);
  color: var(--faint); font-size: 16px; cursor: pointer;
  transition: transform .12s, border-color .15s, background .15s, color .15s, box-shadow .12s;
  user-select: none;
}
.btn-fav:hover {
  transform: scale(1.15); border-color: var(--warn); color: var(--warn);
  box-shadow: 0 2px 8px color-mix(in oklch, var(--warn) 25%, transparent);
}
.btn-fav.is-fav { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

/* ── Badge géoloc ────────────────────────────────────────── */
.geo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--primary);
  background: var(--primary-soft); border: 1px solid var(--primary-soft-bd);
  border-radius: 999px; padding: 4px 12px 4px 8px;
}
.geo-badge .geo-change {
  font-weight: 500; color: var(--muted); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.geo-badge .geo-change:hover { color: var(--primary); }

/* ── Favoris groupés par métier (vue RDV) ───────────────── */
#section-favoris-inline h2 {
  display: flex; align-items: center; gap: 8px;
}

/* En-tête de groupe (titre métier + picto + compteur) */
.fav-group {
  margin-bottom: 20px;
}
.fav-group:last-child {
  margin-bottom: 0;
}

.fav-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--bd);
}

.fav-group-picto {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.fav-group-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.fav-group-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .fav-group-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .fav-group-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Légère teinte warm sur les cartes favoris pour les distinguer des résultats */
#section-favoris-inline .practitioner-card {
  border-color: color-mix(in oklch, var(--warn) 18%, var(--bd));
}

/* ── QR code fiche ───────────────────────────────────────── */
#fiche-qr {
  overflow: hidden;
}
#fiche-qr canvas,
#fiche-qr img {
  display: block;
  /* Taille compacte alignée sur l'en-tête (72px) */
  width: 72px !important;
  height: 72px !important;
  border-radius: 6px;
}

/* ── Chips profession (filtre dans renderLocationPicker) ─── */
/* Rangée horizontale défilable sur mobile */
.prof-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
@media (max-width: 480px) {
  .prof-chips-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .prof-chips-row::-webkit-scrollbar { display: none; }
}

/* Chip individuelle — même base que .ds-chip mais nommée séparément */
.prof-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid var(--bd);
  padding: 0 12px;
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font);
  transition: border-color .15s, background .15s, color .15s;
}
.prof-chip:hover {
  border-color: var(--bd-strong);
  color: var(--text);
}
.prof-chip.active {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: var(--primary);
}

/* ── FullCalendar overrides ──────────────────────────────── */
.fc {
  --fc-border-color: var(--bd);
  --fc-today-bg-color: color-mix(in oklch, var(--primary) 8%, transparent);
  --fc-now-indicator-color: var(--warn);
  --fc-button-bg-color: var(--primary);
  --fc-button-border-color: var(--primary-press);
  --fc-button-hover-bg-color: var(--primary-press);
  --fc-button-hover-border-color: var(--primary-press);
  --fc-button-active-bg-color: var(--primary-press);
  --fc-button-text-color: var(--primary-fg);
  --fc-event-border-color: transparent;
  --fc-page-bg-color: transparent;
}
.fc .fc-toolbar-title { font-size: 15px; font-weight: 700; color: var(--text); }
.fc .fc-col-header-cell-cushion,
.fc .fc-daygrid-day-number,
.fc .fc-timegrid-slot-label-cushion {
  color: var(--muted); font-size: 13px; font-weight: 600; text-decoration: none;
}
.fc .fc-timegrid-slot { border-color: var(--bd); }
.fc .fc-scrollgrid {
  border-color: var(--bd); background: var(--surface);
  border-radius: var(--r-card); overflow: hidden;
}
.fc .fc-scrollgrid-sync-table td,
.fc .fc-scrollgrid-sync-table th { border-color: var(--bd); }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--bd); }

/* Vues patient/fiche : affichage inversé.
   Les zones « occupées / indisponibles » sont matérialisées par un événement
   de fond gris (.slot-occupied-bg) couvrant toute la plage horaire de chaque
   jour. Les créneaux libres (.slot-free) sont rendus PAR-DESSUS comme des
   placeholders clairs et cliquables → les « trous » lisibles = réservables. */
.fc-event.slot-occupied-bg {
  background: color-mix(in oklch, #e6e9f0 70%, var(--surface)) !important;
  opacity: 1 !important;
}
html.theme-dark .fc-event.slot-occupied-bg {
  background: color-mix(in oklch, var(--surface) 55%, var(--bg)) !important;
}

/* Créneau DÉJÀ PRIS (RDV/bloqué/busy externe) : gris foncé par-dessus le fond
   pour bien le distinguer d'une plage simplement non ouverte. */
/* Largeur identique entre créneaux libres et pris : on neutralise le retrait
   droit variable de FullCalendar sur les harness d'events, et on applique la
   même marge horizontale aux deux types. */
.fc-timegrid-event-harness { inset-inline: 0 !important; }

.fc-event.slot-taken-bg {
  background: color-mix(in oklch, #8a93a6 78%, var(--surface)) !important;
  opacity: 1 !important;
  border-radius: 6px !important;
  margin: 1px 3px !important;
}
html.theme-dark .fc-event.slot-taken-bg {
  background: color-mix(in oklch, #2a3140 80%, var(--bg)) !important;
}

/* Créneau libre : placeholder clair, fond quasi blanc, bordure primaire,
   curseur pointer, léger highlight au survol. Affiche juste l'heure. */
.fc-event.slot-free {
  background-color: var(--surface) !important;
  border: 1.5px solid var(--primary) !important;
  color: var(--primary) !important;
  cursor: pointer;
  border-radius: 6px !important;
  margin: 1px 3px !important;
  box-shadow: 0 1px 3px color-mix(in oklch, var(--primary) 14%, transparent);
  transition: background-color .12s, box-shadow .12s, border-color .12s;
}
.fc-event.slot-free:hover {
  background-color: var(--primary-soft) !important;
  border-color: var(--primary-press) !important;
  box-shadow: 0 2px 8px color-mix(in oklch, var(--primary) 28%, transparent);
}

/* Heure affichée dans le créneau libre : petite, lisible (couleur primaire) */
.fc-event.slot-free .slot-free-time {
  display: block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 2px 4px;
  color: var(--primary);
}

.fc-event.rdv-confirmed {
  background-color: var(--ok) !important;
  border-color: var(--ok) !important;
  color: #fff !important; border-radius: 8px !important;
}
.fc-event.slot-blocked {
  background-color: var(--warn) !important;
  border-color: var(--warn) !important;
  color: #fff !important; border-radius: 8px !important;
}
.fc-event.slot-busy {
  background-color: var(--muted) !important;
  border-color: var(--muted) !important;
  color: var(--surface) !important; border-radius: 8px !important; opacity: .7;
}
@media (max-width: 639px) {
  .fc .fc-toolbar { flex-direction: column; gap: 8px; }
  .fc .fc-toolbar-title { font-size: 14px; }
}

/* ── RPPS monospace ──────────────────────────────────────── */
.fiche-rpps {
  font-family: 'Courier New', monospace;
  font-size: 11px; color: var(--faint); letter-spacing: .04em;
}

/* ── Éditeur de calendrier hebdomadaire (praticien) ──────── */
.rules-day-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--bd);
}
.rules-day-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 92px; cursor: pointer; user-select: none;
}
.rules-day-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.rules-day-fields { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.rules-field { display: flex; flex-direction: column; gap: 3px; }
.rules-field-lbl { font-size: 10.5px; font-weight: 600; color: var(--muted); }
.rules-field .form-input { padding: 5px 7px; font-size: 13px; width: auto; }
.rules-lunch-toggle { align-items: center; flex-direction: row; gap: 6px; }
.rules-lunch-toggle .rules-field-lbl { font-size: 12px; }
.rules-day-row.is-closed { opacity: .55; }
.rules-day-row.is-closed .rules-day-name { font-weight: 600; color: var(--muted); }
@media (max-width: 639px) {
  .rules-day-fields { gap: 8px; }
  .rules-field .form-input { font-size: 12.5px; }
}
