/* ==========================================================================
   Valise — feuille de style. Mobile-first, thème clair par défaut,
   bascule automatique en sombre selon le réglage du téléphone.
   ========================================================================== */

:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --danger: #e11d48;
  --warn: #d97706;
  --ok: #059669;
  --sun: #f59e0b;
  --rain: #3b82f6;
  --shadow: 0 6px 24px rgba(15, 23, 42, .08);
  --radius: 18px;
  --tap: 46px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --teal: #2dd4bf;
    --teal-dark: #14b8a6;
    --teal-soft: #134e4a;
    --ink: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
    --bg: #0b1220;
    --card: #131c2e;
    --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  overscroll-behavior-y: none;
}

.hidden { display: none !important; }

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  background-size: cover;
  background-position: center;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(13, 148, 136, .3);
}
.topbar .tb-back {
  background: rgba(255, 255, 255, .18);
  border: none;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 20px;
  flex: 0 0 auto;
  cursor: pointer;
}
.topbar .tb-title { font-size: 19px; font-weight: 700; flex: 1; min-width: 0; }
.topbar .tb-title .tb-sub {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: .85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .tb-action {
  background: rgba(255, 255, 255, .18);
  border: none;
  color: #fff;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  flex: 0 0 auto;
  cursor: pointer;
}

/* ---------- Vue / contenu ---------- */
.view {
  flex: 1;
  padding: 16px 16px calc(var(--safe-bot) + 32px);
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

h2.section-t { font-size: 15px; margin: 4px 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Accueil : cartes voyages ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 42px 18px 34px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  color: #fff;
  background-image: linear-gradient(180deg, rgba(15, 23, 42, .30), rgba(15, 23, 42, .68)), url('img/bg-home.jpg');
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero h1 { font-size: 27px; margin: 0 0 6px; color: #fff; }
.hero p { color: rgba(255, 255, 255, .92); margin: 0; font-size: 15px; }

.trip-card {
  position: relative;
  min-height: 116px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
  color: #fff;
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.trip-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(15, 23, 42, .82), rgba(15, 23, 42, .34));
}
.trip-card > * { position: relative; z-index: 1; }
.trip-card .tc-emoji {
  position: absolute;
  top: 0; right: 0;
  font-size: 22px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .18);
  border-radius: 12px;
  backdrop-filter: blur(3px);
}
.trip-card .tc-body { min-width: 0; }
.trip-card .tc-name { font-weight: 700; font-size: 19px; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
.trip-card .tc-meta { color: rgba(255, 255, 255, .92); font-size: 13px; margin-top: 2px; text-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.trip-card .tc-prog {
  height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .3); margin-top: 10px; overflow: hidden;
}
.trip-card .tc-prog > i { display: block; height: 100%; background: #fff; border-radius: 4px; }
.trip-card .tc-count { font-size: 12px; color: rgba(255, 255, 255, .9); margin-top: 5px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}
.empty .big { font-size: 48px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-primary { background: var(--teal); color: #fff; border-color: transparent; }
.btn-primary:active { background: var(--teal-dark); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: none; color: var(--teal); }
.btn-danger { color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.fab {
  position: fixed;
  right: max(16px, calc(50% - 320px + 16px));
  bottom: calc(var(--safe-bot) + 20px);
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  border: none;
  font-size: 30px;
  box-shadow: 0 8px 24px rgba(13, 148, 136, .45);
  z-index: 30;
  cursor: pointer;
}

/* ---------- Formulaire / wizard ---------- */
.steps {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.steps > i {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--line);
}
.steps > i.done { background: var(--teal); }

.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 13px; margin: -3px 0 8px; }

input[type=text], input[type=date], input[type=number], select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--teal); outline-offset: 0; border-color: transparent; }

.row2 { display: flex; gap: 12px; }
.row2 > .field { flex: 1; }

/* Compteur +/- */
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}
.stepper .val { font-size: 22px; font-weight: 700; min-width: 30px; text-align: center; }

/* Puces sélectionnables (type, style) */
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip {
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}
.chip.on {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 600;
}

/* Résultats géocodage */
.geo-results { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.geo-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 15px;
}
.geo-item .flag { margin-right: 8px; }
.geo-item .sub { color: var(--muted); font-size: 13px; }
.geo-picked {
  border: 1.5px solid var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.geo-picked button { background: none; border: none; color: var(--teal-dark); font-size: 14px; cursor: pointer; }

/* Enfants : liste d'âges */
.kids { display: flex; flex-direction: column; gap: 10px; }
.kid-row { display: flex; align-items: center; gap: 10px; }
.kid-row label { flex: 1; font-size: 15px; }

/* ---------- Météo (bandeau) ---------- */
.weather {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.weather .w-ico { font-size: 34px; }
.weather .w-body { flex: 1; }
.weather .w-t { font-weight: 700; font-size: 16px; }
.weather .w-d { font-size: 13px; opacity: .92; margin-top: 2px; }
.weather.est { background: linear-gradient(135deg, #6366f1, #7c3aed); }
.weather.err { background: linear-gradient(135deg, #64748b, #475569); }
.weather.tappable { cursor: pointer; }
.weather .w-more { font-size: 13px; font-weight: 600; opacity: .9; flex: 0 0 auto; white-space: nowrap; }

/* Détail météo jour par jour (feuille) */
.wd-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.wd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
}
.wd-row:last-child { border-bottom: none; }
.wd-ico { font-size: 24px; flex: 0 0 auto; width: 30px; text-align: center; }
.wd-day { flex: 1; font-size: 15px; text-transform: capitalize; }
.wd-temp { font-size: 15px; flex: 0 0 auto; }
.wd-temp .wd-min { color: var(--muted); margin-left: 4px; }
.wd-p { flex: 0 0 auto; min-width: 64px; text-align: right; }
.wd-rain { font-size: 12px; color: var(--rain); font-weight: 600; }

/* ---------- Checklist ---------- */
.progress-wrap { margin-bottom: 14px; }
.progress-wrap .pw-top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; color: var(--muted); }
.progress-wrap .pw-bar { height: 9px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress-wrap .pw-bar > i { display: block; height: 100%; background: var(--teal); border-radius: 6px; transition: width .25s; }

.cat-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 20px 4px 8px;
}
.cat-title .cat-n { font-weight: 500; opacity: .8; }
.cat-title.clickable { cursor: pointer; }
.cat-title .caret { font-size: 11px; opacity: .7; }
.cat-title.collapsed { opacity: .6; margin-bottom: 8px; }

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 13px;
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.item .chk {
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid var(--line);
  flex: 0 0 auto;
  display: grid; place-items: center;
  cursor: pointer;
  font-size: 16px;
  color: transparent;
}
.item.done .chk { background: var(--teal); border-color: var(--teal); color: #fff; }
.item .lbl { flex: 1; font-size: 16px; cursor: pointer; }
.item.done .lbl { text-decoration: line-through; color: var(--muted); }
.item .why { font-size: 11px; color: var(--muted); display: block; margin-top: 1px; }
.item .del { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 6px; }

.add-inline {
  display: flex; gap: 8px; margin-top: 4px; margin-bottom: 8px;
}
.add-inline input { flex: 1; }

/* ---------- Feuille modale ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  z-index: 40;
  backdrop-filter: blur(2px);
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 20px 18px calc(var(--safe-bot) + 22px);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .25);
  max-width: 640px;
  margin: 0 auto;
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.sheet .sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet .sheet-actions .btn { flex: 1; }
.sheet-note { color: var(--muted); font-size: 13px; margin: 8px 0; }
.sheet-ver { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.share-area {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--card);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  padding: 12px;
  resize: vertical;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bot) + 24px);
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 60;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- Divers ---------- */
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--line);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.center-msg { text-align: center; color: var(--muted); padding: 20px; }
.mt { margin-top: 14px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: none; }
