/* ===== VoyageAI — Styles ===== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #0e7490;
  --primary-dark: #155e75;
  --accent: #f59e0b;
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --text-light: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 50%, #06b6d4 100%);
  color: white;
  padding-bottom: 60px;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 5%;
}

.logo {
  font-size: 22px;
  font-weight: 700;
}

.logo span { color: #fbbf24; }

.hero-content {
  text-align: center;
  padding: 40px 20px 20px;
  max-width: 700px;
  margin: 0 auto;
}

.hero-content h1 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  margin-bottom: 16px;
}

.hero-content p {
  font-size: 18px;
  opacity: 0.9;
}

/* ===== Container ===== */
.container {
  max-width: 640px;
  margin: -40px auto 60px;
  padding: 0 20px;
}

/* ===== Form ===== */
.form-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 32px;
}

.field { margin-bottom: 24px; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--text);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Budget slider */
.budget-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--primary);
  height: 6px;
}

.budget-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  min-width: 90px;
  text-align: right;
}

/* Counter */
.counter {
  display: flex;
  align-items: center;
  gap: 16px;
}

.counter button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.counter button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.counter span {
  font-size: 20px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: var(--primary); }

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-weight: 600;
}

/* Toggle */
.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle {
  padding: 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.toggle.selected {
  background: #ecfeff;
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 600;
}

/* Text input */
input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 15px;
  outline: none;
  transition: border 0.15s;
}

input[type="text"]:focus { border-color: var(--primary); }

/* Submit */
.submit-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.submit-btn:hover { background: #d97706; transform: translateY(-1px); }
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none; }

/* ===== Results ===== */
.results {
  margin-top: 32px;
}

.results h2 {
  font-size: 24px;
  margin-bottom: 20px;
}

.results-content {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 32px;
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.8;
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ===== Nav auth links ===== */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
}

.nav-auth a, .nav-auth button {
  color: white;
  text-decoration: none;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  opacity: 0.9;
}

.nav-auth a:hover, .nav-auth button:hover { opacity: 1; }

.nav-auth .nav-cta {
  background: rgba(255,255,255,0.15);
  padding: 8px 16px;
  border-radius: 20px;
}

/* ===== Auth forms (login / register) ===== */
.auth-container {
  max-width: 420px;
  margin: -40px auto 60px;
  padding: 0 20px;
}

.auth-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 32px;
}

.auth-card h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.auth-card .auth-subtitle {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-card label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  margin-top: 18px;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: 15px;
  outline: none;
  transition: border 0.15s;
}

.auth-card input:focus { border-color: var(--primary); }

.auth-card .submit-btn { margin-top: 24px; }

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-light);
}

.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }

.form-message {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
}

.form-message.error {
  background: #fef2f2;
  color: #b91c1c;
}

.form-message.success {
  background: #f0fdf4;
  color: #166534;
}

/* ===== Mobile ===== */
@media (max-width: 480px) {
  .form-card { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
}

/* ===== Écrans (page utilisateur en 4 vues) ===== */

/* Le catalogue et la fiche détaillée ont besoin de plus de largeur que le
   formulaire, qui reste volontairement étroit pour rester lisible. */
.container.wide { max-width: 1000px; }

.logo { text-decoration: none; color: inherit; cursor: pointer; }

/* Le conteneur remonte sur le dégradé du hero (margin-top négatif) : un bouton
   texte en bleu y serait illisible. Une pastille blanche le rend lisible sur
   le dégradé comme sur le fond clair. */
.back-btn {
  display: inline-block;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  color: var(--primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.10);
  transition: all 0.15s;
}

.back-btn:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  transform: translateX(-2px);
}

.screen-title {
  font-size: 22px;
  margin-bottom: 20px;
}

/* ===== Écran 1 — Les deux cartes de choix ===== */
/* auto-fit : la grille accepte 2 cartes (visiteur) ou 3 (connecté, avec
   « Mes plans ») sans règle supplémentaire. */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 28px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.choice-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 44px rgba(0,0,0,0.12);
  border-color: var(--primary);
}

/* Le parcours IA est l'offre mise en avant : bordure ambre plus marquée. */
.choice-card.featured { border: 2px solid var(--accent); }
.choice-card.featured:hover { border-color: var(--accent); }

.choice-icon { font-size: 34px; line-height: 1; }

.choice-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.choice-text {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.6;
}

.choice-cta {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.choice-card.featured .choice-cta { color: #d97706; }

/* ===== Écran 3 — Grille du catalogue ===== */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.trip-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.trip-card:hover,
.trip-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 14px 44px rgba(0,0,0,0.12);
  outline: none;
}

.trip-card-cover {
  height: 170px;
  background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.trip-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trip-card-placeholder { font-size: 44px; }

.trip-card-body { padding: 18px 20px 20px; }

.trip-card-body h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.trip-card-meta {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 8px;
}

.trip-card-summary {
  font-size: 14px;
  color: var(--text-light);
  line-height: 1.55;
  margin-bottom: 12px;
}

.trip-card-budget {
  font-size: 17px;
  font-weight: 800;
  color: var(--accent);
}

/* États de chargement / erreur / catalogue vide */
.catalog-state {
  text-align: center;
  color: var(--text-light);
  padding: 30px 20px;
}

.catalog-error { color: #b91c1c; }

.catalog-empty {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 48px 28px;
  text-align: center;
}

.catalog-empty-icon { font-size: 46px; margin-bottom: 14px; }

.catalog-empty h3 { font-size: 20px; margin-bottom: 10px; }

.catalog-empty p {
  color: var(--text-light);
  font-size: 15px;
  max-width: 420px;
  margin: 0 auto 22px;
}

.catalog-empty-cta { max-width: 340px; margin: 0 auto; }

/* ===== Écran 4 — Fiche détaillée ===== */
.trip-title { font-size: 28px; margin-bottom: 6px; }

.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.trip-meta span {
  background: #ecfeff;
  color: var(--primary-dark);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 700;
}

.trip-meta span:last-child { background: #fef3c7; color: #b45309; }

.trip-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.trip-gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.trip-block {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 28px;
  margin-bottom: 24px;
}

.trip-block h3 { font-size: 18px; margin-bottom: 16px; }

/* pre-wrap : conserve les retours à la ligne saisis par l'admin. */
.trip-description {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.8;
}

.trip-map {
  height: 380px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  margin-bottom: 20px;
}

.trip-places { list-style: none; display: flex; flex-direction: column; gap: 10px; }

.trip-places li {
  display: flex;
  flex-direction: column;
  border-left: 3px solid var(--primary);
  padding-left: 14px;
}

.trip-place-name { font-weight: 700; font-size: 15px; }

.trip-place-note { font-size: 14px; color: var(--text-light); }

/* ===== Écran 5 — Mes plans ===== */
.plans-list { display: flex; flex-direction: column; gap: 16px; }

.plan-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  padding: 22px 24px;
}

.plan-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.plan-card-head h3 { font-size: 17px; margin-bottom: 4px; }

.plan-card-meta {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

.plan-card-date {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

.plan-card-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.plan-card-actions button {
  border: 1.5px solid var(--border);
  background: white;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.plan-card-actions button:hover { border-color: var(--primary); color: var(--primary); }
.plan-card-actions button.danger:hover { border-color: #dc2626; color: #dc2626; }
.plan-card-actions button:disabled { opacity: 0.6; cursor: not-allowed; }

.plan-card-nocontent { font-size: 12px; color: var(--text-light); }

/* pre-wrap : conserve la mise en forme du texte généré par l'IA. */
.plan-card-content {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.8;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

@media (max-width: 720px) {
  .choice-grid { grid-template-columns: 1fr; }
  .trip-map { height: 300px; }
  .trip-title { font-size: 23px; }
  .plan-card-head { flex-direction: column; }
  .plan-card-actions { width: 100%; }
}
