/* ── Variables ─────────────────────────────────────────────────────── */
:root {
  --primary:      #1e3a5f;
  --primary-d:    #132540;
  --accent:       #e53e3e;
  --success:      #38a169;
  --warning:      #d97706;
  --bg:           #f4f6fa;
  --card:         #ffffff;
  --text:         #1a202c;
  --muted:        #718096;
  --border:       #e2e8f0;
  --radius:       14px;
  --shadow:       0 2px 14px rgba(0,0,0,0.08);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ───────────────────────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}
.screen.active { display: flex; }

.screen-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--primary);
  color: white;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.btn-back {
  background: none; border: none;
  color: rgba(255,255,255,0.75);
  font-size: 16px; font-weight: 600;
  cursor: pointer; padding: 2px 0;
  flex-shrink: 0;
}
.btn-back:hover { color: white; }
.screen-title {
  font-weight: 700; font-size: 16px;
  flex: 1; text-align: center;
  padding-right: 40px; /* balance back btn */
}

.screen-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.screen-body.center {
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100dvh;
}
.screen-intro { font-size: 14px; color: var(--muted); line-height: 1.5; }

/* ── Home ──────────────────────────────────────────────────────────── */
.home-hero {
  padding: 48px 24px 28px;
  text-align: center;
  background: var(--primary);
  color: white;
}
.home-logo  { font-size: 56px; margin-bottom: 10px; }
.home-title { font-size: 30px; font-weight: 900; letter-spacing: .06em; }
.home-subtitle { margin-top: 6px; font-size: 14px; color: rgba(255,255,255,.6); }

.home-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 16px;
  justify-content: center;
}
.home-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform .15s, box-shadow .15s;
}
.home-btn:hover  { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.home-btn:active { transform: none; }
.btn-prereception { border-left: 5px solid var(--primary); }
.btn-depot        { border-left: 5px solid var(--accent); }
.btn-icon  { font-size: 34px; flex-shrink: 0; }
.btn-text  { display: flex; flex-direction: column; flex: 1; }
.btn-label { font-weight: 700; font-size: 17px; color: var(--text); }
.btn-hint  { font-size: 13px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.btn-arrow { font-size: 24px; color: var(--muted); flex-shrink: 0; }

/* ── Steps ─────────────────────────────────────────────────────────── */
.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 4px 0 8px;
}
.step {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step.active { background: var(--primary); color: white; }
.step.done   { background: var(--success); color: white; }
.step-bar    { flex: 1; height: 2px; background: var(--border); max-width: 44px; }
.step-bar.done { background: var(--success); }

/* ── Forms ─────────────────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-weight: 600; font-size: 14px; }
.field-group input,
.field-group textarea,
.field-group select {
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  width: 100%;
  background: white;
  transition: border-color .2s;
}
.field-group input:focus,
.field-group textarea:focus { border-color: var(--primary); }
.field-group textarea { resize: vertical; min-height: 110px; }
.req { color: var(--accent); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary); color: white;
  border: none; padding: 15px 24px;
  border-radius: 12px; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: background .2s;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: white; color: var(--primary);
  border: 2px solid var(--primary);
  padding: 15px 24px; border-radius: 12px;
  font-size: 16px; font-weight: 700; cursor: pointer;
}
.btn-full { width: 100%; }

.btn-camera {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 20px;
  background: var(--primary); color: white;
  border-radius: 14px; font-size: 17px; font-weight: 700;
  cursor: pointer; min-height: 64px; text-align: center;
  transition: background .2s;
}
.btn-camera:hover { background: var(--primary-d); }
.btn-camera-sm {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--bg); border: 2px dashed var(--border);
  color: var(--muted); border-radius: 10px; font-size: 14px; cursor: pointer;
  transition: border-color .2s, color .2s;
}
.btn-camera-sm:hover { border-color: var(--primary); color: var(--primary); }
.btn-add-voyant {
  padding: 10px 18px; background: var(--primary); color: white;
  border: none; border-radius: 10px; font-size: 20px; cursor: pointer;
  flex-shrink: 0;
}
.hidden { display: none !important; }

/* ── Photo guide ───────────────────────────────────────────────────── */
.photo-guide {
  text-align: center; padding: 20px;
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.guide-icon  { font-size: 52px; margin-bottom: 10px; }
.photo-guide h2 { font-size: 19px; font-weight: 700; margin-bottom: 8px; }
.photo-guide p  { font-size: 14px; color: var(--muted); }
.tips {
  display: flex; gap: 10px; justify-content: center;
  flex-wrap: wrap; margin-top: 14px;
}
.tips span {
  font-size: 12px; background: var(--bg);
  padding: 4px 10px; border-radius: 20px; color: var(--muted);
}

/* ── Photo preview ─────────────────────────────────────────────────── */
.photo-preview {
  border-radius: 12px; overflow: hidden;
  max-height: 200px; display: flex; align-items: center;
  justify-content: center; background: #000;
}
.photo-preview img { max-height: 200px; object-fit: contain; }

/* ── Motif grid ────────────────────────────────────────────────────── */
.motif-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.motif-btn {
  padding: 26px 10px; background: white;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 16px; font-weight: 600; cursor: pointer;
  text-align: center; transition: all .15s; line-height: 1.6;
}
.motif-btn:hover, .motif-btn.selected {
  border-color: var(--primary); background: #eef2ff; color: var(--primary);
}
.section-title { font-size: 18px; font-weight: 700; }
.section-hint  { font-size: 14px; color: var(--muted); }

/* ── Photo grid (description) ──────────────────────────────────────── */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-thumb { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .rm {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.55); color: white;
  border: none; border-radius: 50%; width: 24px; height: 24px;
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Options list ──────────────────────────────────────────────────── */
.options-list { display: flex; flex-direction: column; gap: 6px; }
.opt-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: white;
  border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--border);
  font-size: 15px; font-weight: 500;
  transition: border-color .15s;
}
.opt-item:hover { border-color: var(--primary); }
.opt-item input[type="checkbox"] {
  width: 20px; height: 20px;
  cursor: pointer; accent-color: var(--primary); flex-shrink: 0;
}
.opt-ico { font-size: 20px; }

/* ── Plaque badge ──────────────────────────────────────────────────── */
.plaque-lg {
  display: inline-block;
  background: white; color: #111827;
  border: 3px solid #111827; border-left: 10px solid #003189;
  border-radius: 6px;
  font-family: 'Arial Narrow', Arial, Helvetica, sans-serif;
  font-weight: 700; font-size: 28px;
  letter-spacing: .14em;
  padding: 6px 18px 6px 10px;
  white-space: nowrap; text-transform: uppercase;
}
.confirm-card {
  background: white; border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column;
  align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.confirm-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.marque      { font-size: 19px; font-weight: 700; color: var(--primary); }
.confidence  { font-size: 13px; color: var(--muted); }

/* ── Tour photos ───────────────────────────────────────────────────── */
.tour-guide {
  background: white; border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  text-align: center;
}
.tour-guide .tg-num {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: white;
  border-radius: 50%; width: 30px; height: 30px;
  font-size: 14px; font-weight: 700; margin-bottom: 8px;
}
.tour-guide h2 { font-size: 16px; font-weight: 700; }
.tour-guide p  { font-size: 13px; color: var(--muted); margin-top: 4px; }

.tour-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.tour-slot {
  position: relative; border-radius: 10px; overflow: hidden;
  aspect-ratio: 1; border: 2px dashed var(--border);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; background: white; transition: border-color .15s, background .15s;
}
.tour-slot.done   { border: 2px solid var(--success); }
.tour-slot.active { border: 2px solid var(--primary); background: #eef2ff; }
.tour-slot .sl-ico   { font-size: 24px; margin-bottom: 4px; }
.tour-slot .sl-label {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-align: center; padding: 0 4px; line-height: 1.3; white-space: pre-line;
}
.tour-slot .sl-check {
  position: absolute; top: 4px; right: 4px;
  background: var(--success); color: white;
  border-radius: 50%; width: 20px; height: 20px;
  font-size: 11px; display: flex; align-items: center; justify-content: center;
}
.tour-slot img { width: 100%; height: 100%; object-fit: cover; }
.tour-progress {
  font-size: 14px; color: var(--muted); text-align: center; font-weight: 600;
}

/* ── Tableau de bord ───────────────────────────────────────────────── */
.input-unit { display: flex; align-items: center; gap: 10px; }
.input-unit input { flex: 1; }
.unit { font-weight: 600; color: var(--muted); font-size: 15px; }

input[type="range"] {
  width: 100%; height: 8px;
  accent-color: var(--primary);
}
.fuel-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}

.voyants-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 10px; }
.voyant-tag {
  display: flex; align-items: center; gap: 6px;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
  padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 500;
}
.voyant-tag .rm-v { cursor: pointer; font-size: 14px; line-height: 1; }
.voyant-add { display: flex; gap: 8px; }
.voyant-add input { flex: 1; }

/* ── Recap ─────────────────────────────────────────────────────────── */
.recap-card {
  background: white; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.recap-row {
  display: flex; flex-direction: column; gap: 4px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.recap-row:last-child { border-bottom: none; padding-bottom: 0; }
.recap-lbl {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.recap-val { font-size: 15px; color: var(--text); }
.recap-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.recap-tag {
  background: var(--bg); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 12px; font-size: 13px; color: var(--muted);
}

/* ── Succès ────────────────────────────────────────────────────────── */
.succes-icon  { font-size: 72px; margin-bottom: 18px; }
.succes-title { font-size: 26px; font-weight: 800; margin-bottom: 14px; }
.succes-text  {
  font-size: 15px; color: var(--muted); line-height: 1.65;
  max-width: 300px; margin-bottom: 20px;
}
.succes-ref {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 20px;
  font-size: 14px; color: var(--muted); margin-bottom: 20px;
}

/* ── Loading / Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 52px; height: 52px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-bottom: 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 18px; font-weight: 700; }
.loading-sub  { font-size: 14px; color: var(--muted); max-width: 260px; margin-top: 6px; }

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 600; color: white;
  z-index: 9999; animation: toastIn .3s ease;
  max-width: 340px; text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--accent); }
.toast.hidden  { display: none; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Desktop centering ─────────────────────────────────────────────── */
@media (min-width: 481px) {
  body { background: #dde3ec; display: flex; justify-content: center; }
  .screen { box-shadow: 0 0 40px rgba(0,0,0,.15); }
}
