:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --accent-contrast: #ffffff;
  --user-bubble: #2563eb;
  --user-bubble-text: #ffffff;
  --assistant-bubble: #ffffff;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #b91c1c;
  --tool-badge-bg: #eef2ff;
  --tool-badge-text: #4338ca;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  margin: 0;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 32px 20px 20px;
}

.header {
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.new-search-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.new-search-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f8faff;
}

.brand-mark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-sep {
  color: var(--text-muted);
}

.brand-sub {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 500;
}

.tagline {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.conversation {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state p {
  margin: 0 0 12px;
}

.examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.example-chip {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.example-chip:hover {
  border-color: var(--accent);
  background: #f8faff;
}

.message-row {
  display: flex;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.assistant {
  justify-content: flex-start;
}

.bubble {
  max-width: 85%;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.bubble.user {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
}

.bubble.assistant {
  background: var(--assistant-bubble);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--tool-badge-text);
  background: var(--tool-badge-bg);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 8px;
}

.hotel-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.hotel-card {
  display: flex;
  flex-direction: row;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  background: #fafbfc;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.hotel-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Hôtel sans booking_url : carte non cliquable (<div>), pas de survol trompeur. */
.hotel-card--static {
  cursor: default;
}

.hotel-card--static:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}

.hotel-card-image {
  width: 160px;
  aspect-ratio: 4 / 3;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  /* .hotel-card est en display:flex sans align-items déclaré (donc stretch par défaut) : sans
     flex-start, l'image serait réétirée à la hauteur de .hotel-card-body dès que celui-ci dépasse
     les 120px voulus (badge avis + pictogrammes amenities + lien site web) — exactement la cause
     du bug d'allongement. aspect-ratio seul ne suffit pas à s'en protéger dans un flex row. */
  align-self: flex-start;
}

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

.hotel-card-image--placeholder {
  font-size: 32px;
  color: var(--text-muted);
  background: linear-gradient(135deg, #eef2ff, #f5f6f8);
}

.hotel-card-body {
  /* flex: 1 est la vraie cause du décalage résiduel du badge/bouton (voir .hotel-card-rating et
     .hotel-card-cta) : sans lui, .hotel-card-body n'a pas de flex-grow et ne prend QUE la largeur
     nécessaire à son contenu — un hôtel avec un texte plus court laisse alors un vide entre le
     corps de carte et le bord droit de .hotel-card, que même un margin-right négatif sur les
     enfants ne peut pas combler puisqu'il ne compense que le padding, pas cet espace-là. */
  flex: 1;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.hotel-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hotel-card-rating {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  padding: 3px 9px;
  border-radius: 8px;
  flex-shrink: 0;
  /* Garantit l'alignement à droite même si la pastille est l'unique enfant de .hotel-card-top
     (hôtel noté sans catégorie d'étoiles) : justify-content: space-between seul ne pousse un
     élément à droite que s'il y a un autre enfant à gauche. */
  margin-left: auto;
  /* Compense le padding-right de .hotel-card-body (16px) pour toucher le bord droit exact de la
     carte plutôt que de s'arrêter au bord du padding. Sans effet sur le coin (border-radius: 8px
     ci-dessus, inférieur au border-radius: 12px de .hotel-card — la courbe de la pastille reste
     visuellement sous celle de la carte, pas de clip disgracieux par l'overflow:hidden du parent). */
  margin-right: -16px;
}

.hotel-card-rating-score {
  font-size: 13px;
  font-weight: 700;
}

.hotel-card-rating-count {
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
}

.hotel-card-rating--good { background: #dcfce7; color: #15803d; }
.hotel-card-rating--good .hotel-card-rating-count { color: #16a34a; }

.hotel-card-rating--mid { background: #ffedd5; color: #c2410c; }
.hotel-card-rating--mid .hotel-card-rating-count { color: #ea580c; }

.hotel-card-rating--low { background: #f1f5f9; color: #475569; }
.hotel-card-rating--low .hotel-card-rating-count { color: #64748b; }

.hotel-card-name {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  color: #7a1f2b;
}

.hotel-card-stars {
  font-size: 1.2rem;
  color: #f59e0b;
  white-space: nowrap;
  letter-spacing: 1px;
}

.hotel-card-location {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.hotel-card-amenities {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.hotel-card-amenity {
  display: inline-flex;
  flex-shrink: 0;
}

.hotel-card-amenity-icon {
  width: 17px;
  height: 17px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.hotel-card-description {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hotel-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

.hotel-card-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.hotel-card-footer-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hotel-card-website-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.hotel-card-website-link:hover {
  color: var(--accent);
}

.hotel-card-website-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.hotel-card-cta {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-contrast);
  background: var(--accent);
  padding: 7px 14px;
  border-radius: 8px;
  white-space: nowrap;
  /* Compense le padding-right de .hotel-card-body (16px), même raisonnement que .hotel-card-rating
     ci-dessus : touche le bord droit exact de la carte, border-radius: 8px < 12px (.hotel-card)
     donc pas de clip disgracieux par l'overflow:hidden du parent. */
  margin-right: -16px;
}

.typing-indicator {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 0;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.composer {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  position: sticky;
  bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.composer-input {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  padding: 8px;
  background: transparent;
  color: var(--text);
}

.composer-submit {
  border: none;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  padding: 12px 18px;
  cursor: pointer;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.composer-submit:hover {
  opacity: 0.92;
}

.composer-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 480px) {
  .bubble {
    max-width: 92%;
  }

  .hotel-card {
    flex-direction: column;
  }

  .hotel-card-image {
    width: 100%;
    height: 120px;
  }
}
