/* Voyage.ia — mobile-first, sans framework */

:root {
  --bg: #f2f6fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --border: #e3e9f2;
  --text: #0f1b2d;
  --text-muted: #64748b;

  --primary: #0ea5e9;
  --primary-2: #06b6d4;
  --primary-dark: #0369a1;
  --accent: #f97316;
  --accent-2: #fb923c;
  --pink: #ec4899;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 27, 45, 0.06);
  --shadow-md: 0 6px 20px -4px rgba(15, 27, 45, 0.12), 0 2px 6px rgba(15, 27, 45, 0.06);
  --shadow-lg: 0 20px 50px -12px rgba(15, 27, 45, 0.25);
  --shadow-glow: 0 8px 24px -6px rgba(14, 165, 233, 0.45);

  --nav-h: 68px;
  --top-h: 60px;

  --font-display: 'Fredoka', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a1120;
    --surface: #121c30;
    --surface-2: #182236;
    --border: #223049;
    --text: #eaf1fb;
    --text-muted: #90a1bc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 24px -6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -14px rgba(0, 0, 0, 0.65);
    --shadow-glow: 0 0 0 1px rgba(14, 165, 233, 0.25), 0 8px 24px -4px rgba(14, 165, 233, 0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* évite le zoom auto iOS au focus */
  color: inherit;
}

a { color: var(--primary-dark); }

h1, h2, h3, .card-title, .topbar-title, .btn, .nav-btn small, .section-title {
  font-family: var(--font-display);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(14px, -18px) scale(1.06); }
}

/* ---------- Login ---------- */
.login-body {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 20px;
  background: linear-gradient(120deg, #0ea5e9, #06b6d4 35%, #f97316 75%, #fb923c);
  background-size: 300% 300%;
  animation: gradientShift 14s ease infinite;
}
.login-body::before,
.login-body::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  animation: floatBlob 9s ease-in-out infinite;
}
.login-body::before {
  width: 300px; height: 300px;
  background: rgba(255, 255, 255, 0.55);
  top: -100px; left: -90px;
}
.login-body::after {
  width: 240px; height: 240px;
  background: rgba(253, 230, 138, 0.55);
  bottom: -80px; right: -70px;
  animation-delay: 1.5s;
}
.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  padding: 40px 30px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.5s cubic-bezier(.2, .9, .3, 1.2) both;
}
@media (prefers-color-scheme: dark) {
  .login-card {
    background: rgba(18, 28, 48, 0.85);
    border-color: rgba(255, 255, 255, 0.08);
  }
}
.login-emoji {
  font-size: 46px;
  width: 88px; height: 88px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-glow);
}
.login-card h1 {
  margin: 20px 0 2px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-sub { color: var(--text-muted); margin: 4px 0 26px; font-size: 14.5px; }
.login-error {
  background: #fee2e2; color: #991b1b; border-radius: var(--radius-sm);
  padding: 11px 14px; font-size: 14px; margin-bottom: 18px; text-align: left;
}
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 14px 18px; font-weight: 700;
  text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-google:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-google:active { transform: translateY(0) scale(0.98); }
.login-note { color: var(--text-muted); font-size: 12.5px; margin-top: 22px; }

/* ---------- App shell ---------- */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--top-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; white-space: nowrap; font-size: 16px;
}
.topbar-emoji {
  font-size: 17px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: var(--shadow-glow);
}
.leg-switch {
  flex: 1;
  min-width: 0;
}
.leg-switch-track {
  position: relative;
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  min-width: 0;
}
.leg-switch-indicator {
  position: absolute;
  top: 3px; left: 3px;
  height: calc(100% - 6px);
  width: calc((100% - 6px) / var(--leg-count, 2));
  border-radius: 999px;
  transform: translateX(calc(var(--leg-index, 0) * 100%));
  transition: transform 0.35s cubic-bezier(.25, 1, .3, 1.2), background 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.leg-chip {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: none; background: transparent;
  color: var(--text-muted);
  border-radius: 999px; padding: 7px 10px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  min-width: 0;
  transition: color 0.3s ease, transform 0.15s ease;
}
.leg-chip-icon { font-size: 14px; flex-shrink: 0; }
.leg-chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
.leg-chip.active { color: #fff; }
.leg-chip:active { transform: scale(0.95); }
.logout-link {
  text-decoration: none; font-size: 16px; color: var(--text-muted);
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0; transition: background 0.15s ease, color 0.15s ease;
}
.logout-link:hover { background: var(--surface-2); color: var(--danger); }

.view {
  flex: 1;
  padding: 16px 14px calc(var(--nav-h) + 24px);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  height: var(--nav-h);
  display: flex; overflow-x: auto;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(15, 27, 45, 0.05);
}
.nav-btn {
  flex: 1 0 auto; min-width: 68px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; background: none; border: none; color: var(--text-muted);
  padding: 8px 4px 6px; cursor: pointer; position: relative;
  transition: color 0.15s ease, transform 0.15s ease;
}
.nav-btn span { font-size: 20px; transition: transform 0.2s cubic-bezier(.3,1.4,.5,1); }
.nav-btn small { font-size: 10.5px; font-weight: 600; }
.nav-btn.active { color: var(--primary); }
.nav-btn.active span { transform: translateY(-2px) scale(1.08); }
.nav-btn.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
}
.nav-btn:active { transform: scale(0.94); }

/* ---------- Sections communes ---------- */
.section-title {
  font-size: 14.5px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 20px 0 10px;
}
.section-title:first-child { margin-top: 0; }

.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 600;
  white-space: nowrap; cursor: pointer; color: var(--text-muted);
  transition: all 0.15s ease;
}
.chip.active { background: var(--text); color: var(--surface); border-color: var(--text); box-shadow: var(--shadow-sm); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 11px;
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.35s ease both;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 600; font-size: 15.5px; letter-spacing: -0.005em; }
.card-sub { color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.card-body { font-size: 14px; margin-top: 7px; color: var(--text); line-height: 1.5; }
.card-notes { font-size: 13px; color: var(--text-muted); margin-top: 5px; white-space: pre-wrap; line-height: 1.5; }
.card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  background: var(--surface-2); border: none; border-radius: 10px;
  width: 32px; height: 32px; font-size: 14px; cursor: pointer; color: var(--text-muted);
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--border); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  border-radius: 999px; padding: 4px 10px; margin-right: 5px; margin-top: 5px;
}
.badge-idee { background: #e0e7ff; color: #3730a3; }
.badge-a_reserver { background: #fef3c7; color: #92400e; }
.badge-prevu { background: #fef3c7; color: #92400e; }
.badge-reserve { background: #dcfce7; color: #166534; }
.badge-fait { background: #dbeafe; color: #1e40af; }
.badge-kid { background: #fce7f3; color: #9d174d; }
.badge-type { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
@media (prefers-color-scheme: dark) {
  .badge-idee { background: #312e81; color: #c7d2fe; }
  .badge-a_reserver, .badge-prevu { background: #451a03; color: #fde68a; }
  .badge-reserve { background: #14532d; color: #bbf7d0; }
  .badge-fait { background: #1e3a5f; color: #bfdbfe; }
  .badge-kid { background: #500724; color: #fbcfe8; }
}

.empty-state {
  text-align: center; color: var(--text-muted); font-size: 14px;
  padding: 44px 16px; animation: fadeInUp 0.35s ease both;
}

/* ---------- Formulaires ---------- */
details.add-form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
details.add-form summary {
  padding: 14px 16px; font-weight: 600; cursor: pointer;
  list-style: none; display: flex; align-items: center; gap: 8px;
  color: var(--primary-dark); font-size: 15px;
  transition: background 0.15s ease;
}
details.add-form summary::-webkit-details-marker { display: none; }
details.add-form summary::after {
  content: '›'; margin-left: auto; font-size: 20px; color: var(--text-muted);
  transform: rotate(90deg); transition: transform 0.2s ease;
}
details[open].add-form summary::after { transform: rotate(-90deg); }
details.add-form summary:hover { background: var(--surface-2); }
.form-grid {
  padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 11px;
  animation: fadeInUp 0.25s ease both;
}
.form-row { display: flex; gap: 8px; }
.form-row > * { flex: 1; min-width: 0; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
textarea { resize: vertical; min-height: 56px; }
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border: none; border-radius: 999px;
  padding: 12px 18px; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn.secondary { background: var(--surface-2); color: var(--text); box-shadow: none; border: 1px solid var(--border); }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; transform: none; cursor: default; }
.form-actions { display: flex; gap: 8px; }

/* ---------- Checklist ---------- */
.check-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
  transition: background 0.2s ease;
}
.check-row input[type=checkbox] {
  width: 21px; height: 21px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer;
}
.check-row.done { background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.check-row.done .check-label { text-decoration: line-through; color: var(--text-muted); }
.check-label { flex: 1; font-size: 14px; }
.check-meta { font-size: 11.5px; color: var(--text-muted); }

/* ---------- Budget ---------- */
.budget-total {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 55%, var(--accent) 130%);
  color: #fff; border-radius: var(--radius-lg); padding: 20px;
  margin-bottom: 16px; box-shadow: var(--shadow-md);
  animation: fadeInUp 0.3s ease both;
}
.budget-total .amount { font-size: 32px; font-weight: 700; font-family: var(--font-display); }
.budget-total .label { font-size: 12.5px; opacity: 0.9; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.budget-split { display: flex; gap: 16px; margin-top: 12px; font-size: 12.5px; flex-wrap: wrap; opacity: 0.95; }

/* ---------- Assistant / chat ---------- */
.chat-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.chat-bubble {
  max-width: 85%; padding: 11px 14px; border-radius: 18px; font-size: 14px;
  white-space: pre-wrap; line-height: 1.5;
  animation: fadeInUp 0.25s ease both;
}
.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-bottom-right-radius: 4px; box-shadow: var(--shadow-sm);
}
.chat-bubble.assistant {
  align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-input-row {
  position: sticky; bottom: calc(var(--nav-h) + 10px);
  display: flex; gap: 8px; background: var(--bg); padding-top: 6px;
}
.chat-input-row textarea {
  flex: 1; min-height: 46px; border-radius: var(--radius-sm);
}

.suggestion-card { border: 1px dashed var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.suggestion-actions { margin-top: 10px; }

/* ---------- Documents ---------- */
.doc-row {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-bottom: 8px;
  animation: fadeInUp 0.3s ease both;
}
.doc-icon {
  font-size: 19px; flex-shrink: 0;
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--surface-2);
}
.doc-info { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; font-size: 14px; }
.doc-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 500; z-index: 50; max-width: 90vw; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s cubic-bezier(.3,1.4,.5,1) both;
}
.toast.error { background: var(--danger); color: #fff; }

@media (min-width: 600px) {
  .view { padding-left: 22px; padding-right: 22px; }
}
