/* Organise ma sortie — styles
   Principe : beaucoup d'espace, une action principale par écran, les détails seulement sur demande. */
:root {
  --bg: #f6f4ef;
  --bg-2: #efe9df;
  --card: #ffffff;
  --ink: #18181b;
  --muted: #6b6b76;
  --line: #e7e2d9;
  --accent: #e85d3f;
  --accent-2: #f2a541;
  --accent-ink: #ffffff;
  --ok: #15803d;
  --ok-bg: #e8f6ec;
  --warn: #a16207;
  --warn-bg: #fdf4dc;
  --bad: #b91c1c;
  --bad-bg: #fde8e8;
  --info-bg: #eef3fb;
  --live: #0e7490;
  --live-bg: #e3f5f8;
  --shadow: 0 1px 2px rgba(24, 24, 27, 0.05), 0 8px 24px rgba(24, 24, 27, 0.06);
  --radius: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111114;
    --bg-2: #18181d;
    --card: #1c1c22;
    --ink: #f3f2ee;
    --muted: #a1a1aa;
    --line: #2c2c35;
    --ok-bg: #12301d;
    --warn-bg: #352a10;
    --bad-bg: #3a1515;
    --info-bg: #17223a;
    --live-bg: #0f2b31;
    --ok: #4ade80;
    --warn: #fbbf24;
    --bad: #f87171;
    --live: #67e8f9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { --bg: #111114; --bg-2: #18181d; --card: #1c1c22; --ink: #f3f2ee; --muted: #a1a1aa; --line: #2c2c35; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.error { color: var(--bad); }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; }

/* Boutons */
.primary, .ghost, .btn-s, .chip, .link, .back { border: 0; background: none; text-decoration: none; }
.primary {
  background: linear-gradient(135deg, var(--accent), #d9472b);
  color: var(--accent-ink);
  padding: 12px 20px;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(232, 93, 63, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px;
}
.primary:hover { transform: translateY(-1px); }
.primary.big { font-size: 1.08rem; padding: 15px 26px; min-height: 56px; }
.ghost {
  background: var(--card); border: 1px solid var(--line); padding: 10px 16px; border-radius: 14px; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px;
}
.ghost:hover { border-color: var(--muted); }
.ghost.sm { padding: 7px 12px; min-height: 38px; font-size: 0.9rem; }
.wide { width: 100%; }
.btn-s {
  background: var(--bg-2); padding: 9px 13px; border-radius: 12px; font-size: 0.9rem; font-weight: 500; min-height: 40px;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-s:hover { filter: brightness(0.96); }
.link { color: var(--accent); font-weight: 500; padding: 4px 0; font-size: 0.9rem; }
.link.danger { color: var(--bad); }
.link.muted { color: var(--muted); font-weight: 400; }
.back { color: var(--muted); padding: 8px; font-size: 0.95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chips.center { justify-content: center; }
.chip {
  background: var(--card); border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; font-size: 0.92rem; min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { border-color: var(--accent); }
.chip.static { min-height: auto; padding: 4px 11px; font-size: 0.84rem; background: var(--bg-2); border-color: transparent; }

/* Accueil : titre, sous-titre, deux choix */
#view-home { min-height: 100vh; background: radial-gradient(1200px 500px at 50% -10%, rgba(242, 165, 65, 0.22), transparent 60%), var(--bg); }
.home-top { display: flex; justify-content: flex-end; padding: 14px 16px; max-width: 980px; margin: 0 auto; min-height: 66px; }
.hero { max-width: 560px; margin: 0 auto; padding: 8vh 16px 48px; text-align: center; animation: rise 0.5s ease both; }
h1 { font-family: Fraunces, Georgia, serif; font-size: clamp(2.3rem, 8vw, 3.6rem); line-height: 1.05; margin: 0 0 12px; letter-spacing: -0.02em; text-transform: uppercase; }
.sub { font-size: clamp(1.05rem, 2.6vw, 1.2rem); color: var(--muted); margin: 0 0 40px; }
.choices { display: flex; flex-direction: column; gap: 14px; }
.choice {
  display: flex; align-items: center; gap: 16px; width: 100%; text-align: left; padding: 22px 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transition: transform 0.15s ease, border-color 0.15s;
}
.choice:hover { transform: translateY(-2px); border-color: var(--accent); }
.choice.main { background: linear-gradient(135deg, var(--accent), #d9472b); color: #fff; border-color: transparent; }
.choice .ci { font-size: 1.9rem; }
.choice b { display: block; font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.02em; }
.choice small { opacity: 0.8; font-size: 0.95rem; }
.nearby { margin-top: 10px; border: 0; background: none; color: var(--muted); font-size: 0.95rem; padding: 10px; }
.nearby:hover { color: var(--ink); }
.ask { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.ask-label { font-weight: 600; font-size: 1.05rem; }
.ask textarea { border: 1px solid var(--line); border-radius: 18px; outline: none; resize: none; background: var(--card); font-size: 1.08rem; padding: 16px; min-height: 140px; box-shadow: var(--shadow); }
.ask textarea:focus { border-color: var(--accent); }
.ask textarea.shake { animation: shake 0.4s; }
.health { margin-top: 24px; }
.warn-small { color: var(--warn); font-size: 0.86rem; margin: 6px 0; }

/* Chargement / question */
.center-view { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.loader-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 28px 22px; width: min(560px, 100%); box-shadow: var(--shadow); text-align: center; animation: rise 0.35s ease both; }
.loader-card h2 { font-family: Fraunces, Georgia, serif; margin-top: 0; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--bg-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; margin: 0 auto 14px; }
.loading-steps { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; }
.loading-steps li { padding: 6px 0 6px 28px; position: relative; color: var(--muted); }
.loading-steps li.done::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 700; }
.loading-steps li.active { color: var(--ink); font-weight: 500; }
.loading-steps li.active::before { content: ""; position: absolute; left: 5px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
.city-form { display: flex; gap: 8px; margin: 14px 0; }
.city-form input, .origin-row input {
  flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-height: 48px;
}

/* Sortie : mise en page */
.plan-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr); height: 100vh; }
.map-wrap { position: relative; height: 100vh; }
#map { position: absolute; inset: 0; }
.map-error { display: grid; place-items: center; height: 100%; color: var(--muted); padding: 20px; text-align: center; }
.panel { overflow-y: auto; height: 100vh; padding: 20px 22px 120px; background: var(--bg); border-left: 1px solid var(--line); }
/* Téléphone : carte toujours visible en haut, programme qui défile en dessous (sans passer sous la carte). */
@media (max-width: 899px) {
  .plan-layout { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
  .map-wrap { flex: 0 0 auto; height: 36vh; height: 36dvh; min-height: 210px; }
  .panel { flex: 1 1 auto; min-height: 0; height: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; border-left: 0; border-radius: 18px 18px 0 0; margin-top: -14px; position: relative; z-index: 2; box-shadow: 0 -6px 20px rgba(0,0,0,0.08); padding: 14px 14px calc(96px + env(safe-area-inset-bottom)); }
}
.panel-top { display: flex; justify-content: space-between; gap: 8px; }
.plan-title { font-family: Fraunces, Georgia, serif; font-size: 1.7rem; margin: 18px 0 2px; letter-spacing: -0.01em; }
.plan-sub { color: var(--muted); }
.plan-sub::first-letter { text-transform: uppercase; }
.plan-line { margin: 8px 0 16px; font-size: 0.92rem; display: flex; flex-wrap: wrap; gap: 6px; }
.pill, .pill-edit { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; border-radius: 999px; background: var(--bg-2); border: 1px solid transparent; min-height: 36px; }
.pill-edit { border-color: var(--line); background: var(--card); font-weight: 500; }
.pill-edit:hover { border-color: var(--accent); }
.pill-edit .pen { font-size: 0.8rem; opacity: 0.7; }
.group-form { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-weight: 600; margin-top: 6px; }
.field, .stepper input { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-height: 48px; font-size: 1rem; width: 100%; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper input { text-align: center; font-weight: 700; font-size: 1.15rem; }
.step-btn { flex: none; width: 52px; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 1.4rem; font-weight: 600; }
.ask-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ask-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.ask-field input { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); min-height: 48px; font-size: 1rem; width: 100%; color: var(--ink); }
.ask-field input:focus { outline: none; border-color: var(--accent); }
.geo-toggle { border: 1px dashed var(--line); background: var(--card); border-radius: 14px; padding: 12px; min-height: 48px; font-weight: 500; }
.geo-toggle[aria-pressed="true"] { border-style: solid; border-color: var(--ok); color: var(--ok); background: var(--ok-bg); }
.geo-toggle:disabled { opacity: 0.7; }
.geo-msg { margin: -6px 0 0; font-size: 0.86rem; }
.geo-msg.ok { color: var(--ok); }
.geo-msg.err { color: var(--bad); }
#city-error { text-align: left; font-size: 0.92rem; }
.updated { background: var(--ok-bg); border-radius: 16px; padding: 12px 14px; margin: 10px 0 16px; font-size: 0.92rem; animation: rise 0.3s ease both; }
.updated b { color: var(--ok); display: block; margin-bottom: 4px; }
.updated.nochange { background: var(--warn-bg); }
.updated.nochange b { color: var(--warn); }
.updated div { margin: 3px 0; }
.start { margin: 4px 0 18px; }

/* Alertes : seulement celles qui demandent une décision */
.alerts { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 16px; }
.alert { border-radius: 14px; padding: 12px 14px; font-size: 0.9rem; animation: rise 0.3s ease both; }
.alert.warn { background: var(--warn-bg); }
.alert.danger { background: var(--bad-bg); }
.alert-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.alert .btn-s { background: var(--card); }

/* Mode « sortie en cours » : la prochaine étape en grand */
.live { background: var(--live-bg); border-radius: 22px; padding: 18px; margin: 4px 0 20px; display: flex; flex-direction: column; gap: 6px; animation: rise 0.3s ease both; }
.live-title { font-weight: 600; color: var(--live); display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
.live-label { font-size: 0.78rem; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; margin-top: 8px; }
.live-name { font-family: Fraunces, Georgia, serif; font-size: 1.6rem; line-height: 1.2; }
.live-time { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.live-meta { font-size: 1.05rem; margin-bottom: 6px; }
.live-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.timeline.is-live .step:not(.done) .step-head { opacity: 0.85; }

/* Programme : timeline simple */
.timeline { display: flex; flex-direction: column; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin: 60px; overflow: hidden; }
.step.done { opacity: 0.55; box-shadow: none; }
.step-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 14px 16px; background: none; border: 0; text-align: left; }
.step-num { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.step.done .step-num { background: var(--muted); }
.step-main { display: flex; flex-direction: column; min-width: 0; }
.step-kind { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; color: var(--muted); }
.step-name { font-size: 1.06rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.step-time { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.step-time b { font-size: 1.1rem; }
.step-time small { color: var(--muted); }
.step-details { padding: 0 16px 16px 66px; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; animation: rise 0.2s ease both; }
@media (max-width: 480px) { .step-details { padding-left: 16px; } }
.d-row { overflow-wrap: anywhere; }
.hours.open { color: var(--ok); }
.hours.closed { color: var(--bad); }
.hours.closes_during, .hours.unk { color: var(--warn); }
.hours .src { color: var(--muted); font-size: 0.8rem; }
.resa { color: var(--ok); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions.col { flex-direction: column; }
.actions.secondary { gap: 4px 16px; margin-top: 4px; }
.leg { position: relative; display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 0 10px 32px; color: var(--muted); font-size: 0.92rem; }
/* Trait de la couleur du trajet sur la carte */
.leg::before { content: ""; position: absolute; left: 15px; top: 5px; bottom: 5px; width: 5px; border-radius: 3px; background: var(--leg-color, var(--line)); }
.leg:hover .leg-txt { color: var(--ink); }
.end-row { padding: 6px 0 0 32px; color: var(--muted); font-size: 0.92rem; }
.infos { margin-top: 26px; font-size: 0.86rem; color: var(--muted); }
.infos summary { cursor: pointer; padding: 6px 0; }
.infos ul { padding-left: 18px; margin: 6px 0; }
.credits { color: var(--muted); font-size: 0.72rem; margin-top: 18px; line-height: 1.6; }

/* Bouton principal flottant */
.fab {
  position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 20; border: 0;
  background: var(--ink); color: var(--bg); padding: 16px 24px; border-radius: 999px; font-weight: 600; font-size: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease;
}
.fab:hover { transform: translateY(-2px); }
@media (max-width: 899px) { .fab { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); padding: 13px 18px; font-size: 0.95rem; } }

/* Feuille modale */
.sheet { position: fixed; inset: 0; background: rgba(10, 10, 14, 0.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity 0.2s ease; }
.sheet.open { opacity: 1; }
.sheet-card {
  position: relative; background: var(--card); width: min(560px, 100%); max-height: 88vh; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(30px); transition: transform 0.22s ease;
}
.sheet.open .sheet-card { transform: translateY(0); }
@media (min-width: 700px) { .sheet { align-items: center; } .sheet-card { border-radius: 24px; } }
.sheet-card h2 { font-family: Fraunces, Georgia, serif; margin: 0 34px 10px 0; font-size: 1.4rem; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg-2); font-size: 1.3rem; }
.sheet textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--bg); margin: 8px 0 10px; resize: vertical; min-height: 90px; }
.alts { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.alt { display: flex; gap: 12px; align-items: center; text-align: left; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-height: 60px; }
.alt:hover { border-color: var(--accent); }
.alt.current { border-color: var(--ink); }
.alt.surprise { border-style: dashed; border-color: var(--accent-2); }
.alt-n { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; flex: none; }
.alt-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.alt-body small { color: var(--muted); }
.cur { font-size: 0.75rem; color: var(--muted); }
.resa-form { display: flex; flex-direction: column; gap: 10px; }
.origin-row { display: flex; gap: 6px; align-items: center; width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Carte : marqueurs (une seule couleur, numérotés) */
.mk {
  width: 32px; height: 32px; border-radius: 50%; background: #e85d3f; color: #fff; font-weight: 700; border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3); display: grid; place-items: center; font-size: 0.95rem; padding: 0;
}
.mk.done { background: #a1a1aa; }
.mk.next { width: 40px; height: 40px; font-size: 1.1rem; }
.mk-origin { font-size: 1.6rem; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.3)); }
.mk-user { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mk-user-dot { width: 18px; height: 18px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.22), 0 2px 6px rgba(0,0,0,.3); }
.mk-user-label { background: #2563eb; color: #fff; font-size: 0.72rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }

/* Toast */
.toast { position: fixed; left: 50%; top: 18px; transform: translate(-50%, -30px); opacity: 0; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; z-index: 80; transition: all 0.25s ease; font-weight: 500; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); color: #fff; }
body.working .panel { opacity: 0.6; pointer-events: none; transition: opacity 0.2s; }
body.working .fab { opacity: 0.5; }

/* Téléphone : textes et cartes plus compacts (placé après les règles de base pour les remplacer) */
@media (max-width: 899px) {
  .plan-title { font-size: 1.3rem; margin-top: 10px; }
  .plan-sub { font-size: 0.9rem; }
  .step-head { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .step-num { width: 30px; height: 30px; font-size: 0.92rem; }
  .step-name { font-size: 1rem; }
  .step-time b { font-size: 1rem; }
  .step-details { padding: 0 12px 14px; }
  .actions .btn-s { flex: 1 1 calc(50% - 8px); justify-content: center; }
  .live-name { font-size: 1.3rem; }
  .live-time { font-size: 1.25rem; }
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
