/* style.css - Dakar Dem Dikk */
:root{ 
  /* Couleurs officielles Dakar Dem Dikk */
  --ddd-primary: #15af97;
  --ddd-accent: #ffdd00;
  --ddd-dark: #52646d;
  
  --bg: linear-gradient(135deg, #15af97 0%, #0e8a75 100%);
  --bg-light: #f7faf9;
  --user: #52646d; 
  --bot: #15af97; 
  --muted: #6b7c85;
  --warning: #e5b800;
  --success: #15af97;
  --list-bg: #f0f7f5;
  --list-border: #c5e3de;
  --primary-gradient: linear-gradient(135deg, #15af97 0%, #0e8a75 100%);
  --accent-gradient: linear-gradient(135deg, #ffdd00 0%, #e5c800 100%);
  --bot-gradient: linear-gradient(135deg, #15af97 0%, #12a088 100%);
  --user-gradient: linear-gradient(135deg, #52646d 0%, #3d4d54 100%);
  --shadow-sm: 0 2px 4px rgba(21, 175, 151, 0.08);
  --shadow-md: 0 4px 12px rgba(21, 175, 151, 0.12);
  --shadow-lg: 0 8px 24px rgba(21, 175, 151, 0.15);
  --shadow-xl: 0 12px 32px rgba(82, 100, 109, 0.15);
}

* {
  box-sizing: border-box;
}

body { 
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; 
  max-width: 1000px;
  margin: 0 auto;
  color: #1f2937;
  background: var(--bg-light);
  line-height: 1.6;
  padding: 0;
  position: relative;
}

/* ── Mode embed (iframe) ─────────────────────────────────────────────────── */
body.embed{
  max-width:none;
  margin:0;
  min-height:100vh;
  background: transparent;
}
body.embed::before{
  display:none;
}
.embed .header-container{ display:none; }
.embed .container.embed-container{
  padding: 12px;
}
.embed #chat{
  height: calc(100vh - 88px);
  padding: 14px;
  border-radius: 14px;
}
.embed .embed-form{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 12px;
  background: rgba(247, 250, 249, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--list-border);
}
.embed .embed-form .input-wrapper{
  max-width: 100%;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 300px;
  background: linear-gradient(180deg, rgba(21, 175, 151, 0.06) 0%, transparent 100%);
  z-index: -1;
}

.container{ 
  padding:1rem 
}

#chat { 
  border-radius:16px;
  border:1px solid var(--list-border);
  padding:1.5rem;
  overflow-y:auto;
  overflow-x:hidden;
  background:white;
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}

.bubble{ 
  display:inline-block;
  padding:16px 20px;
  border-radius:18px;
  margin:12px 0;
  max-width:85%;
  box-shadow: var(--shadow-md);
  line-height:1.6;
  animation: slideIn 0.3s ease-out;
  position: relative;
  transition: all 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bubble:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.user .bubble{ 
  background: var(--user-gradient);
  color: white; 
  float:right; 
  border-bottom-right-radius:6px;
  border-top-right-radius:18px;
  box-shadow: 0 4px 15px rgba(82, 100, 109, 0.25);
}

.user .bubble::before {
  content: '';
  position: absolute;
  right: -8px;
  bottom: 10px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: #52646d;
  border-right: none;
}

.bot .bubble{ 
  background: linear-gradient(135deg, #f0faf8 0%, #e6f5f2 100%);
  color: #1f2937; 
  float:left; 
  border-bottom-left-radius:6px;
  border-top-left-radius:18px;
  border-left:4px solid var(--ddd-primary);
  box-shadow: 0 4px 15px rgba(21, 175, 151, 0.12);
}

.bot .bubble::before {
  content: '';
  position: absolute;
  left: -8px;
  bottom: 10px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: #e6f5f2;
  border-left: none;
}

/* Rangée « copier » sous le contenu (évite le chevauchement avec « Plus d'infos ») */
.copy-fab-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  clear: both;
}
.bot-reply-block .copy-fab-row {
  border-top: 1px solid rgba(21, 175, 151, 0.14);
}
.line-details-container .copy-fab-row {
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
}
.copy-fab {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  cursor: pointer;
  color: #94a3b8;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.copy-fab:hover {
  color: #64748b;
  background: #f8fafc;
  border-color: rgba(100, 116, 139, 0.45);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.copy-fab:focus-visible {
  outline: 2px solid var(--ddd-primary);
  outline-offset: 2px;
}
.copy-fab--ok {
  color: #16a34a;
  border-color: rgba(22, 163, 74, 0.35);
  background: #f0fdf4;
}
.copy-fab__svg {
  display: block;
  pointer-events: none;
}

/* « Plus de détails » après clic : état discret */
.small-btn.small-btn--state-done {
  opacity: 0.85;
  cursor: default;
  font-size: 0.85em;
}

/* Réponses assistant seules (hors extrait site) : texte continu, sans sous-cartes */
.answer-content.answer-plain {
  margin: 0;
  padding: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: inherit;
}
.answer-content.answer-plain p {
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.meta{ 
  font-size:0.9em;
  color:var(--ddd-dark);
  display:block;
  margin-top:15px;
  padding:12px 16px;
  border-radius:10px;
  background: linear-gradient(135deg, #f0faf8, #e6f5f2);
  font-weight: 500;
  text-align: center;
  border: 2px solid var(--list-border);
}
.meta-more-info .more-info-link {
  color: var(--bot);
  font-weight: 600;
  text-decoration: none;
}
.meta-more-info .more-info-link:hover {
  text-decoration: underline;
  color: #0d9488;
}

.preview{ 
  margin-top:12px; 
  color:inherit; 
  white-space:pre-wrap;
  line-height:1.6;
  background:var(--list-bg);
  border-radius:8px;
  padding:12px;
  border:1px solid var(--list-border);
  font-size:0.95em;
}

.fulltext{ 
  margin-top:12px; 
  color:inherit; 
  white-space:pre-wrap;
  line-height:1.6;
  background:var(--list-bg);
  border-radius:8px;
  padding:12px;
  border:1px solid var(--list-border);
}

.list-container {
  background: var(--list-bg);
  border: 1px solid var(--list-border);
  border-radius: 8px;
  padding: 1rem;
  margin: 12px 0;
  font-size: 0.95em;
}

.city-header {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--ddd-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0faf8, #e6f5f2);
  border-radius: 12px;
  border-left: 4px solid var(--ddd-primary);
  box-shadow: var(--shadow-sm);
  animation: fadeInUp 0.4s ease-out;
}

.section-title {
  font-weight: 700;
  color: var(--ddd-dark);
  margin: 1.5rem 0 1rem 0;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f0faf8, #e6f5f2);
  border-radius: 10px;
  border-left: 4px solid var(--ddd-primary);
  display: inline-block;
}

.list-item {
  margin: 0.75rem 0;
  padding: 10px 16px 10px 2rem;
  position: relative;
  line-height: 1.6;
  background: white;
  border-radius: 8px;
  border-left: 3px solid var(--ddd-primary);
  transition: all 0.3s ease;
}

.list-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
  border-left-width: 4px;
}

.list-item::before {
  content: "▸";
  position: absolute;
  left: 0.75rem;
  color: var(--ddd-primary);
  font-weight: bold;
  font-size: 1.1em;
}

.price-tag {
  background: rgba(21, 175, 151, 0.2);
  color: #0e6b5a;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.85em;
  margin-left: 0.5rem;
}

.contact-badge {
  background: rgba(255, 221, 0, 0.25);
  color: #7a6b00;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.85em;
  margin-left: 0.5rem;
}

.time-badge {
  background: rgba(82, 100, 109, 0.15);
  color: var(--ddd-dark);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.85em;
  margin-left: 0.5rem;
}

form {
  margin-top: 0;
}

.input-wrapper {
  display:flex; 
  gap:12px;
  background: white;
  padding: 8px;
  border-radius: 50px;
  box-shadow: var(--shadow-lg);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.input-wrapper:focus-within {
  border-color: var(--ddd-primary);
  box-shadow: 0 0 0 4px rgba(21, 175, 151, 0.15), var(--shadow-xl);
  transform: translateY(-2px);
}

input[type=text]{ 
  flex:1;
  padding:16px 24px;
  border-radius:50px;
  border:none;
  font-size:16px;
  transition:all 0.3s ease;
  background: transparent;
  color: #1f2937;
  font-weight: 400;
}

input[type=text]:focus{ 
  outline:none;
}

input[type=text]::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.send-btn{ 
  padding:16px 32px;
  border-radius:50px;
  border:none;
  background: var(--primary-gradient);
  color:white;
  font-weight:600;
  cursor:pointer;
  transition:all 0.3s ease;
  font-size:16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(21, 175, 151, 0.35);
  position: relative;
  overflow: hidden;
}

.mic-btn{
  width: 52px;
  min-width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--list-border);
  background: white;
  color: var(--ddd-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.mic-btn:hover{
  border-color: var(--ddd-primary);
  transform: translateY(-1px);
}

.mic-btn.listening{
  background: #ef4444;
  border-color: #ef4444;
  color: white;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.15);
  animation: micPulse 1.2s infinite;
}

.mic-icon{
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
  line-height: 1;
}

@keyframes micPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.send-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.send-btn:hover::before {
  width: 300px;
  height: 300px;
}

.send-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(21, 175, 151, 0.45);
}

.send-btn:active {
  transform: translateY(0);
}

.send-icon {
  font-size: 1.1em;
  transition: transform 0.3s ease;
}

.send-btn:hover .send-icon {
  transform: translateX(3px) rotate(15deg);
}

.controls{ 
  margin-top:12px; 
  display:flex; 
  gap:8px;
  flex-wrap:wrap;
}

.small-btn{ 
  font-size:0.9em;
  padding:10px 18px;
  border-radius:25px;
  border:2px solid var(--list-border);
  background:white;
  cursor:pointer;
  color:var(--ddd-primary);
  transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.small-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary-gradient);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
  z-index: 0;
}

.small-btn span {
  position: relative;
  z-index: 1;
}

/* Libellé au-dessus du halo (::before) — obligatoire si le texte n’est pas dans un <span> */
.small-btn > .choice-label {
  position: relative;
  z-index: 1;
}

.clarification-box .small-btn::before {
  z-index: 0;
}

.small-btn:hover{
  color: white;
  border-color:var(--ddd-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(21, 175, 151, 0.35);
}

.small-btn:hover::before {
  width: 200px;
  height: 200px;
  background: var(--primary-gradient);
}

.small-btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
}

.link{ 
  color:var(--ddd-primary); 
  text-decoration:none;
}

.link:hover{
  text-decoration:underline;
}

/* Liens cliquables dans les bulles de réponse */
.answer-link {
  color: var(--ddd-primary, #0066cc);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dotted var(--ddd-primary, #0066cc);
  transition: opacity .15s;
  word-break: break-all;
}

.answer-link:hover {
  opacity: .75;
  text-decoration: underline;
}

.clearfix::after{ 
  content:'';
  display:block;
  clear:both;
}

/* Header Dakar Dem Dikk */
.header-container {
  background: var(--primary-gradient);
  padding: 1.5rem 2rem;
  border-radius: 0 0 24px 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 0.5rem;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: white;
  border-radius: 12px;
  padding: 6px;
  box-shadow: var(--shadow-md);
  display: none; /* affiché via onload si logo existe */
}

.logo-icon {
  font-size: 2.5rem;
  line-height: 1;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.logo-text h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.logo-text .subtitle {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: rgba(255,255,255,0.9);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

/* Badges */
.badge {
  display:inline-flex;
  align-items:center;
  gap:0.3rem;
  padding:4px 10px;
  border-radius:12px;
  font-size:0.8em;
  font-weight:600;
  margin-right:8px;
  margin-bottom:4px;
}

.badge-price {
  background:#fef3c7;
  color:#92400e;
}

.badge-schedule {
  background:#dbeafe;
  color:#1e40af;
}

.badge-contact {
  background:#dcfce7;
  color:#166534;
}

.badge-city {
  background:#ede9fe;
  color:#5b21b6;
}

/* Loading animation améliorée */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes typing {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.loading {
  animation: typing 1.5s ease-in-out infinite;
  color:var(--ddd-dark);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 12px;
  background: linear-gradient(135deg, #f0faf8, #e6f5f2);
  border-radius: 12px;
  border-left: 3px solid var(--ddd-primary);
}

.loading::before {
  content: "💬";
  animation: bounce 1s ease-in-out infinite;
}

.loading::after {
  content: "...";
  animation: typing 1.5s ease-in-out infinite;
  margin-left: 4px;
}

/* Clarification box */
.clarification-box {
  background:#fffbeb;
  border:1px solid #fde68a;
  border-radius:8px;
  padding:1rem;
  margin:1rem 0;
  border-left:4px solid var(--warning);
}

.clarification-box-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.interurbain-picker .interurbain-picker-hint {
  margin: 0.45rem 0 0.65rem;
  font-size: 0.95rem;
  color: #4b5563;
  line-height: 1.45;
}

.interurbain-city-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.interurbain-city-chip {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 2px solid var(--ddd-primary, #14b8a6);
  background: #fff;
  color: var(--ddd-primary, #0f766e);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.interurbain-city-chip:hover {
  background: var(--ddd-primary, #14b8a6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 118, 110, 0.25);
}

/* ═══════════════════════════════════════════════════════
   LAYOUT DE BASE — chat app plein-écran sur tous appareils
   ═══════════════════════════════════════════════════════ */

/* Empêche le scroll global : seul #chat scrolle */
html, body {
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;           /* dynamic viewport height (gère le clavier virtuel) */
  padding: 0;
}

.container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  min-height: 0;            /* indispensable pour que flex shrink fonctionne */
}

#chat {
  flex: 1;
  height: auto;             /* laisse le flex gérer la hauteur */
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Formulaire collé en bas, jamais caché par le clavier */
form {
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.75rem 1.5rem 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  background: var(--bg-light);
  border-top: 1px solid rgba(21,175,151,0.10);
}

/* Scrollbar styling */
#chat::-webkit-scrollbar {
  width:8px;
}

#chat::-webkit-scrollbar-track {
  background:#f1f5f9;
  border-radius:4px;
}

#chat::-webkit-scrollbar-thumb {
  background:#cbd5e1;
  border-radius:4px;
}

#chat::-webkit-scrollbar-thumb:hover {
  background:#94a3b8;
}

.meta-info {
  font-size: 0.85em;
  color: var(--muted);
  margin-top: 2px;
  padding-left: 1.5rem;
  font-style: italic;
}

.structured-section {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--list-bg);
  border-radius: 8px;
  border: 1px solid var(--list-border);
}

.structured-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: white;
  border-radius: 6px;
  border-left: 3px solid var(--bot);
}

.structured-label {
  font-weight: 600;
  min-width: 80px;
  color: var(--bot);
}

.structured-value {
  flex: 1;
}

/* Style spécifique pour chaque type d'information */
.price-item .structured-label::before {
  content: "💰 ";
}

.time-item .structured-label::before {
  content: "⏰ ";
}

.day-item .structured-label::before {
  content: "📅 ";
}

.departure-item .structured-label::before {
  content: "🚀 ";
}

.arrival-item .structured-label::before {
  content: "🏁 ";
}

.contact-item .structured-label::before {
  content: "📞 ";
}

/* AJOUTER DANS LE STYLE */
.preview {
    transition: all 0.3s ease;
    max-height: 200px;
    overflow: hidden;
}

.preview.fulltext {
    max-height: none;
    overflow: visible;
}

.complete-paragraph {
    margin-bottom: 1rem;
    line-height: 1.6;
    text-align: justify;
}

/* Style pour la transition */
.preview.fulltext {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--bot);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Pour éviter le problème de répétition */
.bubble .preview:not(.fulltext) + .preview.fulltext {
    display: none; /* Cache le preview quand on a déjà le fulltext */
}

.bubble .preview.fulltext ~ .preview:not(.fulltext) {
    display: none; /* Cache le snippet quand on a le fulltext */
}

/* AJOUTER DANS LE STYLE */
.lines-container {
    margin: 15px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 25px;
    border: 2px solid #e2e8f0;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.lines-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    animation: expandLine 0.8s ease-out forwards;
}

@keyframes expandLine {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.line-category {
    margin-bottom: 25px;
}

.category-title {
    font-size: 1.1em;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.line-card {
    background: white;
    border-radius: 16px;
    padding: 18px;
    box-shadow: var(--shadow-md);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.line-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--bot-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.line-card:hover::before {
    transform: scaleY(1);
}

.line-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
    border-color: var(--bot);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.line-card-content {
    position: relative;
    padding-left: 10px;
}

.line-number {
    font-weight: 700;
    font-size: 1.1em;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.line-destinations {
    font-size: 0.9em;
    color: #475569;
    line-height: 1.4;
    margin-bottom: 8px;
}

.line-emoji {
    position: absolute;
    right: 5px;
    top: 5px;
    font-size: 1.2em;
    opacity: 0.7;
}

/* (responsive lines-grid — géré dans la section unifiée ci-dessous) */

/* Animation améliorée */
.line-card {
    animation: slideInCard 0.5s ease-out backwards;
}

.line-card:nth-child(1) { animation-delay: 0.05s; }
.line-card:nth-child(2) { animation-delay: 0.1s; }
.line-card:nth-child(3) { animation-delay: 0.15s; }
.line-card:nth-child(4) { animation-delay: 0.2s; }
.line-card:nth-child(5) { animation-delay: 0.25s; }
.line-card:nth-child(n+6) { animation-delay: 0.3s; }

@keyframes slideInCard {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Légende */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 15px 0;
    padding: 12px;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 0.85em;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-text {
    color: #475569;
}
/* AJOUTER DANS style.css */

/* Style pour les résumés de lignes */
.lines-grid-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.line-summary-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.line-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-color: var(--bot);
}

.line-number-big {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--bot);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.line-route {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.95em;
}

.line-start, .line-end {
    flex: 1;
    padding: 6px 10px;
    background: #f8fafc;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
}

.line-arrow {
    color: var(--bot);
    font-weight: bold;
    font-size: 1.1em;
}

.line-detail-btn {
    width: 100%;
    justify-content: center;
    margin-top: 8px;
}

/* Style pour les détails de ligne */
.line-details-container {
    margin: 15px 0;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
}

.line-main-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.line-start-big, .line-end-big {
    font-size: 1.2em;
    font-weight: 600;
    padding: 15px 20px;
    background: linear-gradient(135deg, #e6f0ff, #d3e6ff);
    border-radius: 8px;
    flex: 1;
    text-align: center;
    color: var(--user);
}

.line-arrow-big {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--bot);
    padding: 0 15px;
}

.line-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: white;
    border-radius: 25px;
    font-weight: 600;
    margin: 15px 0;
    border: 2px solid var(--bot);
}

/* Style pour la timeline des arrêts */
.stops-container {
    margin-top: 25px;
}

.stops-timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 20px;
}

.stops-timeline::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--bot), var(--user));
    border-radius: 3px;
}

.stop-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.stop-marker {
    width: 32px;
    height: 32px;
    background: white;
    border: 3px solid var(--bot);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    z-index: 2;
    position: relative;
    flex-shrink: 0;
}

.stop-terminus .stop-marker {
    background: var(--bot);
    color: white;
}

.stop-content {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    flex: 1;
    border-left: 4px solid var(--bot);
}

.stop-name {
    font-weight: 500;
    margin-bottom: 5px;
    color: #1f2937;
}

.stop-label {
    font-size: 0.85em;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Badge dans les catégories */
.category-title .badge {
    background: var(--bot);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 8px;
}

/* (responsive lines-grid-summary — section unifiée en fin de fichier) */
/* AJOUTER DANS style.css */
.line-summary-card {
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

.line-number-big {
    font-size: 1.1em;
    color: #1e40af;
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 10px;
}

.line-route {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.line-start, .line-end {
    padding: 8px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #10b981;
    font-size: 0.9em;
    line-height: 1.4;
}

.line-end {
    border-left-color: #3b82f6;
}

.line-arrow {
    text-align: center;
    font-weight: bold;
    color: #6b7280;
    margin: 5px 0;
}

.line-detail-btn {
    margin-top: auto;
}

.category-title .badge {
    background: #3b82f6;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 10px;
}

/* Pour les lignes sans détails */
.line-details-container .clarification-box {
    margin: 20px 0;
    padding: 15px;
}
/* AJOUTER DANS style.css */

/* Style compact pour les lignes */
.lines-grid-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.line-card-compact {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.line-card-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    border-color: var(--bot);
}

.line-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.line-number-compact {
    font-weight: 700;
    font-size: 1em;
    color: var(--bot);
    background: #f0f9ff;
    padding: 4px 8px;
    border-radius: 4px;
}

.line-detail-btn-compact {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--muted);
    transition: all 0.2s ease;
}

.line-detail-btn-compact:hover {
    background: var(--bot);
    color: white;
    border-color: var(--bot);
}

.line-route-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.line-stop {
    flex: 1;
    padding: 6px;
    background: #f8fafc;
    border-radius: 4px;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-weight: 500;
}

.line-arrow-compact {
    color: var(--bot);
    font-weight: bold;
    font-size: 0.9em;
    padding: 0 4px;
}

.line-count-badge {
    background: #3b82f6;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 8px;
    font-weight: 600;
}

/* Catégorie titre */
.line-category {
    margin-bottom: 20px;
}

.category-title {
    font-size: 1em;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
}

/* (responsive lines-grid-compact — section unifiée en fin de fichier) */
/* AJOUTER AU STYLE EXISTANT */
.line-detail-btn {
    background: linear-gradient(135deg, #0b5cff, #0950d6);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 10px;
    box-shadow: 0 2px 4px rgba(11, 92, 255, 0.2);
}

.line-detail-btn:hover {
    background: linear-gradient(135deg, #0950d6, #0842b3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(11, 92, 255, 0.3);
}

.line-detail-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(11, 92, 255, 0.2);
}

.line-count-badge {
    background: var(--bot);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    margin-left: 8px;
    font-weight: 600;
    vertical-align: middle;
}

/* Style pour les détails de ligne spécifique */
.line-details-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.line-main-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.line-start-big, .line-end-big {
    font-size: 1.2em;
    font-weight: 600;
    color: #1f2937;
    padding: 10px 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    flex: 1;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-arrow-big {
    font-size: 2em;
    color: var(--bot);
    font-weight: bold;
}

/* Style pour les arrêts */
.stops-container {
    margin-top: 25px;
}

.stops-timeline {
    position: relative;
    padding-left: 30px;
    margin-top: 20px;
}

.stops-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--bot), #cbd5e1);
}

.stop-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 24px;
    position: relative;
    animation: slideInStop 0.4s ease-out backwards;
}

.stop-item:nth-child(1) { animation-delay: 0.1s; }
.stop-item:nth-child(2) { animation-delay: 0.15s; }
.stop-item:nth-child(3) { animation-delay: 0.2s; }
.stop-item:nth-child(n+4) { animation-delay: 0.25s; }

@keyframes slideInStop {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stop-marker {
    width: 36px;
    height: 36px;
    background: white;
    border: 3px solid var(--bot);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    z-index: 2;
    position: relative;
    box-shadow: 0 2px 8px rgba(10, 122, 68, 0.2);
    transition: all 0.3s ease;
}

.stop-item:hover .stop-marker {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(10, 122, 68, 0.3);
}

.stop-terminus .stop-marker {
    background: var(--bot-gradient);
    color: white;
    font-size: 1.3em;
    border-color: var(--bot);
    box-shadow: 0 4px 12px rgba(10, 122, 68, 0.4);
}

.stop-content {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.stop-item:hover .stop-content {
    border-color: var(--bot);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

.stop-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 5px;
}

.stop-label {
    font-size: 0.85em;
    color: var(--bot);
    font-weight: 500;
    background: #f0f9ff;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
}

/* (responsive line-main-route — section unifiée en fin de fichier) */
/* Style amélioré pour les boutons de détails */
.line-details-btn {
    background: linear-gradient(135deg, var(--bot), #0a6c3a);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-left: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.line-details-btn:hover {
    background: linear-gradient(135deg, #0a6c3a, #088f48);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.line-details-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Bouton retour */
.controls .small-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.controls .small-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* Style pour les lignes avec arrêts */
.line-details-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.line-main-route {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
    padding: 25px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 16px;
    border: 2px solid #bae6fd;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    animation: routeAppear 0.6s ease-out;
}

.line-main-route::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes routeAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.line-start-big, .line-end-big {
    font-size: 1.2em;
    font-weight: 700;
    color: #1e293b;
    padding: 18px 24px;
    background: white;
    border-radius: 12px;
    border: 2px solid #cbd5e1;
    flex: 1;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.line-start-big::before, .line-end-big::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(11, 92, 255, 0.1), transparent);
    transition: left 0.5s;
}

.line-start-big:hover::before, .line-end-big:hover::before {
    left: 100%;
}

.line-start-big:hover, .line-end-big:hover {
    border-color: var(--user);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.line-arrow-big {
    font-size: 2em;
    font-weight: bold;
    color: var(--bot);
    animation: arrowPulse 2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(10, 122, 68, 0.3));
}

@keyframes arrowPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Style pour les lignes simples dans la liste */
.lines-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.line-item-simple {
    background: white;
    border-radius: 14px;
    padding: 18px;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: slideInCard 0.5s ease-out backwards;
    cursor: pointer;
}

.line-item-simple::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--bot-gradient);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.line-item-simple:hover::before {
    transform: scaleY(1);
}

.line-item-simple:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--bot);
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.line-item-simple .line-number {
    font-size: 1.15em;
    font-weight: 700;
    color: var(--bot);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    padding: 8px 14px;
    border-radius: 10px;
    border-left: 4px solid var(--bot);
}

.line-item-simple .line-route {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95em;
}

.line-item-simple .line-from,
.line-item-simple .line-to {
    flex: 1;
    padding: 10px 14px;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    color: #1f2937;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.line-item-simple:hover .line-from {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-color: #0b5cff;
    color: #0b5cff;
}

.line-item-simple:hover .line-to {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    border-color: #10b981;
    color: #10b981;
}

.line-item-simple .line-arrow {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--bot);
    padding: 0 8px;
    animation: arrowPulse 2s ease-in-out infinite;
}

/* Liste compacte : Ligne 1, Ligne 4, … (recherche par arrêt) */
.lines-stop-block {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
    clear: both;
}
.lines-stop-intro {
    margin: 0;
    padding: 0;
    display: block;
    width: 100%;
    font-size: 1.02em;
    color: #334155;
}
.lines-stop-compact {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 1.12em;
    line-height: 1.75;
    font-weight: 500;
}
.lines-stop-list {
    margin: 0;
    padding: 0 0 0 1.35rem;
    list-style-type: disc;
    color: #334155;
}
.lines-stop-list li {
    margin: 0.35rem 0;
    padding-left: 0.15rem;
}
.line-chip {
    display: inline;
    color: var(--bot);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    font-weight: 600;
}
.line-chip:hover {
    color: #0d9488;
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE UNIFIÉ — toutes les tailles d'écran
   Couvre : tablette (≤ 900px), mobile (≤ 640px), petits mobiles (≤ 400px),
            paysage phone, et safe-area (iPhone notch / barre de navigation)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Tablette (≤ 900px) ─────────────────────────────────────────── */
@media (max-width: 900px) {
  body {
    max-width: 100%;
  }

  .container {
    padding: 0.75rem;
  }

  form {
    padding: 0.6rem 1rem 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .input-wrapper {
    padding: 6px 6px 6px 8px;
  }

  .lines-grid,
  .lines-grid-summary,
  .lines-grid-compact,
  .lines-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ── Mobile (≤ 640px) ────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Chat */
  #chat {
    padding: 0.85rem;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .bubble {
    max-width: 90%;
    padding: 12px 15px;
    font-size: 0.95rem;
    border-radius: 16px;
  }

  /* Bulles user : pas de dépassement à droite */
  .user .bubble::before,
  .bot .bubble::before {
    display: none;
  }

  /* Formulaire : rangée unique horizontale compacte */
  form {
    padding: 0.5rem 0.65rem 0.6rem;
    padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
  }

  .input-wrapper {
    flex-direction: row;
    gap: 8px;
    border-radius: 999px;
    padding: 5px 5px 5px 10px;
  }

  input[type=text] {
    padding: 11px 10px;
    font-size: 16px;  /* empêche le zoom automatique iOS */
    min-width: 0;
  }

  .mic-btn {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }

  .mic-icon {
    width: 18px;
    height: 18px;
  }

  .send-btn {
    padding: 11px 18px;
    font-size: 15px;
    border-radius: 999px;
    white-space: nowrap;
  }

  /* Boutons d'actions */
  .small-btn {
    font-size: 0.82em;
    padding: 8px 13px;
    min-height: 36px;
  }

  .controls {
    gap: 6px;
    flex-wrap: wrap;
  }

  /* Grilles de lignes */
  .lines-grid,
  .lines-grid-summary,
  .lines-grid-compact,
  .lines-list {
    grid-template-columns: 1fr;
  }

  .line-card,
  .line-card-compact {
    padding: 12px;
  }

  /* Fiche ligne : terminus en colonne */
  .line-main-route {
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    margin: 14px 0;
  }

  .line-start-big,
  .line-end-big {
    width: 100%;
    min-height: 48px;
    font-size: 1em;
    padding: 12px 16px;
  }

  .line-arrow-big {
    font-size: 1.5em;
    transform: rotate(90deg);
    margin: 4px 0;
    animation: none;    /* évite le glitch sur mobile */
  }

  /* Détail bouton / route */
  .line-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .line-detail-btn {
    align-self: stretch;
    margin-left: 0;
    margin-top: 8px;
    text-align: center;
  }

  /* Timeline arrêts */
  .stops-timeline {
    padding-left: 22px;
  }

  .stop-marker {
    width: 28px;
    height: 28px;
    font-size: 0.85em;
    margin-right: 10px;
  }

  .stop-content {
    padding: 12px;
  }

  /* Clarification */
  .clarification-box-actions {
    flex-direction: column;
  }

  .clarification-box-actions .small-btn {
    width: 100%;
    justify-content: center;
  }

  /* Interurbain chips */
  .interurbain-city-grid {
    gap: 0.35rem;
  }

  .interurbain-city-chip {
    font-size: 0.82rem;
    padding: 0.4rem 0.75rem;
  }
}

/* ── Petits mobiles (≤ 400px) ────────────────────────────────────── */
@media (max-width: 400px) {
  #chat {
    padding: 0.65rem;
    border-radius: 10px;
  }

  .bubble {
    max-width: 95%;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .send-btn .send-text {
    display: none;          /* cache le label "Envoyer" pour gagner de la place */
  }

  /* Icône d'envoi seule : on affiche une flèche via CSS */
  .send-btn::after {
    content: "➤";
    font-size: 1.1em;
  }

  .send-btn {
    padding: 11px 14px;
    min-width: 44px;
  }

  .small-btn {
    font-size: 0.78em;
    padding: 7px 11px;
  }

  .lines-container {
    padding: 14px;
    border-radius: 14px;
  }

  .line-details-container {
    padding: 12px;
  }
}

/* ── Paysage sur mobile (clavier virtuel très court) ─────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #chat {
    border-radius: 8px;
  }

  form {
    padding: 0.4rem 0.75rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }

  .input-wrapper {
    padding: 4px 4px 4px 10px;
  }

  input[type=text] {
    padding: 9px 10px;
  }

  .send-btn {
    padding: 9px 16px;
  }

  .mic-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }
}

/* ── Support safe-area (iPhone avec notch / Dynamic Island) ─────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  form {
    padding-left:  max(0.65rem, env(safe-area-inset-left));
    padding-right: max(0.65rem, env(safe-area-inset-right));
  }
}