/* ===============================================================
   CAPTEUR REFLUX — Design System
   ---------------------------------------------------------------
   Aligné avec la charte Capteur Digital :
     - Navy  #0b1628
     - Orange #f47920
     - Police Outfit
     - Zéro emoji en JS (SVG custom)
   =============================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --navy:        #0b1628;
  --navy-soft:   #1a2740;
  --navy-light:  #e8ebf0;
  --orange:      #f47920;
  --orange-dark: #d65f08;
  --orange-soft: #fff3e6;

  /* Sémantique Koufman (cohérent avec le PDF) */
  --green:       #2e7d32;
  --green-soft:  #e8f5e9;
  --amber:       #ef6c00;
  --amber-soft:  #fff3e0;
  --red:         #c62828;
  --red-soft:    #ffebee;
  --grey:        #6b7280;
  --grey-light:  #f3f4f6;
  --grey-mid:    #d1d5db;

  /* Neutres */
  --bg:          #ffffff;
  --bg-alt:      #fafbfc;
  --text:        #0f172a;
  --text-mute:   #64748b;
  --border:      #e5e7eb;

  /* Effets */
  --shadow-sm:   0 1px 2px rgba(0,0,0,0.05);
  --shadow:      0 2px 8px rgba(11,22,40,0.08);
  --shadow-lg:   0 10px 30px rgba(11,22,40,0.12);

  /* Rayons */
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  16px;
  --r-xl:  24px;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 48px;

  /* Layout */
  --header-h: 60px;
  --nav-h:    64px;
  --max-w:    680px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Outfit', -apple-system, system-ui, sans-serif;
  background: var(--bg-alt);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
}

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 var(--s-3); color: var(--navy); font-weight: 700; }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 16px; line-height: 1.3; }

p { margin: 0 0 var(--s-3); line-height: 1.55; }

/* ============================================================
   Header / App bar
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--navy);
  color: #fff;
  height: var(--header-h);
  padding: 0 var(--s-4);
  display: flex; align-items: center;
  box-shadow: var(--shadow);
}
.app-header h1 {
  color: #fff;
  font-size: 18px;
  margin: 0;
  flex: 1;
  display: flex; align-items: center; gap: var(--s-2);
}
.app-header .logo-mark {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--orange);
  border-radius: 50%;
}

/* ============================================================
   Main container
   ============================================================ */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s-4);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: #fff;
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.card h2 { margin-top: 0; }
.card-title { color: var(--navy); font-size: 15px; font-weight: 600; }
.card-subtitle { color: var(--text-mute); font-size: 13px; margin-top: -4px; }

/* ============================================================
   Verdicts feu tricolore
   ============================================================ */
.verdict {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.verdict-autorise  { background: var(--green-soft); color: var(--green); }
.verdict-limite    { background: var(--amber-soft); color: var(--amber); }
.verdict-interdit  { background: var(--red-soft); color: var(--red); }
.verdict-inconnu   { background: var(--grey-light); color: var(--grey); }

.verdict-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Cartes verdict pleine largeur (page scanner / détail aliment) */
.verdict-card {
  padding: var(--s-5);
  border-radius: var(--r-lg);
  border-left: 6px solid;
  margin-bottom: var(--s-4);
}
.verdict-card.autorise { background: var(--green-soft); border-left-color: var(--green); }
.verdict-card.limite   { background: var(--amber-soft); border-left-color: var(--amber); }
.verdict-card.interdit { background: var(--red-soft); border-left-color: var(--red); }
.verdict-card.inconnu  { background: var(--grey-light); border-left-color: var(--grey); }

.verdict-card h2 { color: var(--navy); margin: 0 0 var(--s-2); }
.verdict-card .big-verdict {
  font-size: 28px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--s-2);
}
.verdict-card.autorise .big-verdict { color: var(--green); }
.verdict-card.limite   .big-verdict { color: var(--amber); }
.verdict-card.interdit .big-verdict { color: var(--red); }
.verdict-card.inconnu  .big-verdict { color: var(--grey); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 12px 20px;
  border: none;
  border-radius: var(--r);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary   { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: var(--navy); color: #fff; }
.btn-secondary:hover { background: var(--navy-soft); }
.btn-outline   { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-ghost     { background: transparent; color: var(--navy); }
.btn-block     { display: flex; width: 100%; }
.btn-icon      { padding: 10px; border-radius: 50%; width: 44px; height: 44px; }

/* ============================================================
   Form controls
   ============================================================ */
input[type=text], input[type=email], input[type=password],
input[type=search], input[type=number], textarea, select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font: inherit;
  font-size: 15px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--orange);
}
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--navy);
  margin-bottom: var(--s-2);
}

/* Range sliders RSI */
.rsi-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--grey-light);
  border-radius: 3px;
  outline: none;
  padding: 0;
  border: none;
  margin: var(--s-3) 0;
}
.rsi-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}
.rsi-slider::-moz-range-thumb {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--orange);
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: var(--shadow);
}
.rsi-scale {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-mute);
  margin-top: 4px;
}

/* ============================================================
   Bottom navigation (PWA)
   ============================================================ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 20;
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--grey);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  gap: 3px;
  padding: 6px 4px;
  transition: color 0.15s;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--orange); }
.bottom-nav a:hover { color: var(--navy); }

/* ============================================================
   Score RSI display
   ============================================================ */
.rsi-score-big {
  text-align: center;
  padding: var(--s-6) 0;
}
.rsi-score-big .score {
  font-size: 64px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
}
.rsi-score-big .score.abnormal { color: var(--red); }
.rsi-score-big .score.normal   { color: var(--green); }
.rsi-score-big .score-label {
  font-size: 14px;
  color: var(--text-mute);
  margin-top: var(--s-2);
}
.rsi-score-big .score-max {
  font-size: 20px;
  color: var(--text-mute);
  font-weight: 500;
}

/* ============================================================
   Tags / pills
   ============================================================ */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--grey-light);
  color: var(--navy);
  margin-right: 4px;
}

/* ============================================================
   Count-down (fenêtre jeûne)
   ============================================================ */
.countdown-card {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  text-align: center;
  padding: var(--s-6) var(--s-4);
  border-radius: var(--r-lg);
}
.countdown-card h2 { color: #fff; opacity: 0.8; font-size: 14px; font-weight: 500; }
.countdown-card .countdown {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  margin: var(--s-3) 0;
}
.countdown-card .countdown.warning { color: var(--orange); }
.countdown-card .hint {
  font-size: 13px;
  opacity: 0.7;
}

/* ============================================================
   Recipe cards
   ============================================================ */
.recipe-card {
  display: flex; gap: var(--s-4);
  padding: var(--s-4);
  background: #fff;
  border-radius: var(--r);
  border: 1px solid var(--border);
  margin-bottom: var(--s-3);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
}
.recipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.recipe-card .img {
  width: 64px; height: 64px; flex-shrink: 0;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--orange-soft), var(--navy-light));
  display: flex; align-items: center; justify-content: center;
  color: var(--orange);
}
.recipe-card .body { flex: 1; min-width: 0; }
.recipe-card .title { font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.recipe-card .meta {
  font-size: 12px; color: var(--text-mute);
  display: flex; gap: var(--s-3);
}

/* ============================================================
   Utility
   ============================================================ */
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-5); }
.mb-0 { margin-bottom: 0; }
.text-mute { color: var(--text-mute); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-center { text-align: center; }
.hidden { display: none !important; }

/* Score évolution chart container */
.chart-container {
  position: relative;
  height: 240px;
  margin: var(--s-3) 0;
}

/* Toast notifications */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 16px); left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toastIn 0.25s ease;
}
@keyframes toastIn {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0);     opacity: 1; }
}

/* Loading spinner */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--grey-light);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 420px){
  h1 { font-size: 22px; }
  .rsi-score-big .score { font-size: 54px; }
  .countdown-card .countdown { font-size: 36px; }
}
