@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap");

/* THEME VARIABLES */
:root {
  --bg-page: #eef2f6;
  --bg-card: #ffffff;
  --bg-soft: #f7f9fc;
  --border-card: #d6dbe6;

  --text-main: #0b1324;
  --text-dim: #556075;
  --text-invert: #ffffff;

  --accent: #1f5bff;
  --accent-strong: #0b49f2;
  --accent-bg: rgba(31, 91, 255, 0.12);

  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 22px 50px rgba(15, 23, 42, 0.12);

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font-body: "IBM Plex Sans", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --font-display: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(circle at 10% 10%, rgba(31, 91, 255, 0.08), transparent 45%),
    radial-gradient(circle at 90% 5%, rgba(14, 165, 233, 0.08), transparent 40%);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.45;
}

/* HEADER (brand bar) */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-card);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  padding: 1.25rem 1.5rem;
  display: flex;
  justify-content: center;
}

.app-header-inner {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.2;
}

.app-subtitle {
  font-size: .95rem;
  color: var(--text-dim);
  margin: .4rem 0 0 0;
  line-height: 1.4;
}

/* MAIN WRAPPER */
.container {
  max-width: 1100px;
  margin: 1.5rem auto 4rem auto;
  padding: 0 1.25rem 2.5rem 1.25rem;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* CARD */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.25rem 1.5rem 1.25rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 0;
  transition: box-shadow .2s ease, transform .2s ease;
}

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

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: .35rem;
}

.card-subtitle{
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.3;
}

.label-step{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 700;
  margin-right: .4rem;
}

.or-divider{
  display: flex;
  align-items: center;
  justify-content: center;
  margin: .25rem 0 1rem 0;
  color: var(--text-dim);
  font-size: .7rem;
  letter-spacing: .08em;
}

.or-divider::before,
.or-divider::after{
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-card);
  margin: 0 .6rem;
}

.card h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: .5rem;
  line-height: 1.3;
}

.tag {
  font-size: .7rem;
  font-weight: 600;
  background: var(--accent-bg);
  color: var(--accent-strong);
  border-radius: var(--radius-md);
  padding: .2rem .5rem;
  white-space: nowrap;
}

/* CONTROL BLOCKS */
.control-block {
  display: flex;
  flex-direction: column;
  margin-bottom: .9rem;
}

.control-block label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: .4rem;
  line-height: 1.3;
}

select,
input[type="text"],
button {
  font-family: inherit;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  padding: .7rem .8rem;
  background-color: #fff;
  color: #0b1324;
  line-height: 1.2;
  outline: none;
  width: 100%;
  font-weight: 600;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7b8798 50%),
    linear-gradient(135deg, #7b8798 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 12px) calc(1em + 2px), 0 0;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-repeat: no-repeat;
  padding-right: 2rem;
  color: #0b1324;
  font-weight: 600;
}

/* Fix dropdown option contrast */
select option {
  background-color: #ffffff;
  color: #0b1324;
  padding: 8px;
  font-weight: 500;
}

select option:disabled {
  color: #9aa3b2;
}

select:disabled,
input:disabled,
button:disabled {
  background-color: #eef1f6;
  color: #9aa3b2;
  border-color: #d6dbe6;
  cursor: not-allowed;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 91, 255, 0.18);
}

/* STOP ID LOOKUP BLOCK */
.stop-id-row {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.stop-id-row label {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-main);
}

.stop-id-input-wrapper {
  display: flex;
  flex-wrap: wrap;        /* allow wrapping to the next line if needed */
  gap: .5rem;
  align-items: stretch;
  width: 100%;
}

.stop-id-input-wrapper input[type="text"] {
  flex: 1 1 140px;        /* grow, but also shrink if space is tight */
  min-width: 0;           /* don't force a minimum that breaks layout */
}

.stop-id-input-wrapper button {
  flex: 0 0 auto;         /* size to content, not full row */
  background-color: var(--accent);
  border: 0;
  color: var(--text-invert);
  font-weight: 600;
  cursor: pointer;
  min-width: auto;        /* <-- IMPORTANT: remove the 6rem min width */
  padding: .7rem 1rem;   /* comfy tap target */
  box-shadow: 0 12px 24px rgba(31, 91, 255, 0.35);
  line-height: 1.2;
}

.stop-id-input-wrapper button:active {
  transform: scale(0.98);
}

.helper-text {
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: .4rem;
  line-height: 1.35;
}

/* RESULTS / NEXT BUSES */
.results-block h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
  line-height: 1.3;
}

.results-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  row-gap: .5rem;
}

.results-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: .5rem;
}

/* Refresh / Clear buttons */
.btn-small {
  font-size: .8rem;
  line-height: 1.2;
  padding: .5rem .6rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  min-width: 4.5rem;
  text-align: center;
}

.btn-refresh {
  background-color: var(--accent);
  border: 0;
  color: var(--text-invert);
  box-shadow: 0 10px 20px rgba(37,99,255,0.4);
}

.btn-refresh:active {
  transform: scale(0.98);
}

.btn-clear {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  box-shadow: 0 8px 20px rgba(239,68,68,0.15);
}

.btn-clear:hover {
  background-color: #fee2e2;
}


.btn-clear:active {
  transform: scale(0.98);
}

#predictionsList {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

#predictionsList li {
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  padding: .9rem 1rem;
  box-shadow: 0 10px 24px rgba(0,0,0,0.04);
  font-size: .92rem;
  line-height: 1.4;
}

#predictionsList li.empty-state {
  background: var(--bg-soft);
  border-style: dashed;
  color: var(--text-dim);
  text-align: center;
}

.loading-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.arrival-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .6rem;
  align-items: center;
}

.arrival-main {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.arrival-route {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  color: var(--text-main);
}

.arrival-dest {
  color: var(--text-dim);
  font-size: .85rem;
}

.arrival-min {
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-weight: 700;
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .85rem;
  white-space: nowrap;
}

.arrival-meta {
  margin-top: .35rem;
  color: var(--text-dim);
  font-size: .78rem;
}

/* FOOTNOTE */
.footer-note {
  text-align: center;
  font-size: .7rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* MOBILE TWEAKS */
@media (max-width: 400px) {
  .app-title {
    font-size: 1rem;
  }

  .app-subtitle {
    font-size: .75rem;
  }

  select,
  input[type="text"],
  button {
    font-size: .95rem;
  }

  #predictionsList li {
    font-size: .85rem;
  }
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .app-header-inner {
    text-align: center;
  }

  .app-title {
    font-size: 1.4rem;
  }
}
/* --- Assistant Chat --- */
#chat-toggle{
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 60%, #1d4ed8 100%);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: .85rem;
  letter-spacing: .02em;
  box-shadow: 0 10px 28px rgba(37,99,235,.35);
  z-index: 9998;
}

#chat-toggle:focus{
  outline: 3px solid rgba(37, 99, 255, 0.35);
  outline-offset: 2px;
}

#chat-panel{
  position: fixed;
  right: 24px;
  bottom: 74px;
  width: 320px;
  max-height: 60vh;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0,0,0,.18);
  display: none;
  z-index: 9999;
  overflow: hidden;
  font-family: var(--font-body);
}

#chat-panel.open{
  display: flex;
  flex-direction: column;
}

#chat-header{
  padding: 8px 12px;
  background: #0f172a;
  color: #fff;
  font-weight: 600;
  font-size: .85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#chat-messages{
  padding: 12px;
  overflow-y: auto;
  gap: 8px;
  display: flex;
  flex-direction: column;
  height: 260px;
  background: #f8fafc;
}

.bubble{
  padding: 10px 12px;
  border-radius: 12px;
  max-width: 85%;
  line-height: 1.3;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #1f2937;
}

.bubble.user{
  align-self: flex-end;
  background: #3b82f6;
  color: #ffffff;
}
.bubble.bot{
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
}

#chat-input-row{
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e5e7eb;
  align-items: stretch;
}

#chat-input{
  flex: 1 1 0;
  min-width: 0;
  resize: vertical;
  min-height: 64px;
  height: 72px;
  max-height: 180px;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
}

#chat-send{
  flex: 0 0 auto;
  width: auto;
  min-width: 90px;
  height: 72px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 600;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
}

#chat-clear{
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: .75rem;
  cursor: pointer;
}

#chat-clear:hover{
  background: rgba(255,255,255,0.25);
}

@media (max-width: 420px){
  #chat-panel{ width: 95vw; right: 2.5vw; }
}

/* Quick action buttons in chat */
.chat-buttons{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 520px){
  .chat-buttons{
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }
}

@media (max-width: 360px){
  .chat-buttons{
    grid-template-columns: 1fr;
  }
}
.bubble-actions{
  background: transparent;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
}

.chat-btn{
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s ease;
  text-align: left;
  width: 100%;
}

.chat-input-inline{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
}


.chat-btn-disabled{
  cursor: not-allowed;
  opacity: 0.6;
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #6b7280;
  box-shadow: none;
  transform: none;
}

.chat-btn-disabled:hover{
  background: #f3f4f6;
  border-color: #e5e7eb;
  box-shadow: none;
  transform: none;
}

.chat-btn:hover{
  background: #f9fafb;
  border-color: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

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

/* Chat button with subtitle styling */
.chat-btn .btn-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.chat-btn .btn-subtitle {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  opacity: 0.9;
}

.assistant-card{
  margin: 2rem auto 3rem;
  max-width: 460px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.assistant-card .btn-primary{
  align-self: center;
}

/* Wizard-only UI */
.wizard-shell{
  background: #ffffff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.2);
  margin-bottom: 24px;
  color: #0f172a;
}

.wizard-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.wizard-header h2{
  margin: 0 0 6px 0;
  font-size: 1.4rem;
}

.wizard-steps{
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: wizardFadeIn 0.3s ease;
}

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

.wizard-card{
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  background: #f8fafc;
}

.wizard-card h4{
  margin: 0 0 12px 0;
  font-size: 1rem;
}

.wiz-filter-input{
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  margin-bottom: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}
.wiz-filter-input:focus{
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.15);
}

.wizard-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.wizard-row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.wizard-btn{
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.wizard-btn:hover{
  border-color: var(--accent);
  background: #f8fafc;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37,99,235,0.15);
}

.wizard-btn:active{
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.wizard-btn.primary{
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(37,99,235,0.4);
}

.wizard-btn.primary:hover{
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37,99,235,0.5);
}

.wizard-hint{
  margin-top: 10px;
  font-size: 0.85rem;
  color: #6b7280;
}

.wizard-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.wizard-output{
  margin-top: 16px;
  animation: wizardFadeIn 0.3s ease;
}

.btn-secondary{
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover{
  background: #e2e8f0;
  border-color: #94a3b8;
}

.wizard-note{
  background: linear-gradient(135deg, #e0f2fe 0%, #f0f9ff 100%);
  border: 1px solid #bae6fd;
  padding: 12px 14px;
  border-radius: 10px;
  color: #0c4a6e;
  font-weight: 600;
  animation: wizardFadeIn 0.3s ease;
}

.wizard-note::before{
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #0ea5e9;
  border-radius: 50%;
  margin-right: 10px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse{
  0%, 100%{ opacity: 1; transform: scale(1); }
  50%{ opacity: 0.5; transform: scale(1.2); }
}

.wizard-error{
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 10px 12px;
  border-radius: 10px;
  color: #991b1b;
  font-weight: 600;
}

.wizard-result{
  white-space: pre-wrap;
  font-family: inherit;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  padding: 12px;
  border-radius: 10px;
}

.wizard-list{
  margin: 12px 0 0 0;
  padding: 0;
  list-style: none;
}

.wizard-list li{
  margin: 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.wizard-list li:hover{
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(37,99,235,0.1);
}

.wizard-list li strong{
  color: var(--accent-strong);
}

/* Wizard fallback note (ETA → Schedule) */
.wizard-fallback-note{
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 10px 12px;
  border-radius: 10px;
  color: #92400e;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Service exception styling */
.wizard-exception{
  display: block;
  margin-top: 10px;
  padding: 8px 12px;
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  border-radius: 0 8px 8px 0;
  color: #78350f;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Stop ID badge in stop picker */
.stop-id{
  display: inline-block;
  background: var(--accent-bg);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: 8px;
}

.stop-name{
  font-weight: 600;
}

/* Wizard icon styling */
.wiz-icon{
  display: inline-block;
  margin-right: 6px;
  font-size: 1.1em;
  vertical-align: middle;
}

.wizard-card h4 .wiz-icon{
  font-size: 1.2em;
}

.wizard-btn .wiz-icon{
  opacity: 0.9;
}

.wizard-shell input{
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
}

.chat-panel-disabled{
  border-radius: 18px;
  background: rgba(15,23,42,0.6);
  color: #e2e8f0;
  padding: 16px;
  box-shadow: 0 15px 35px rgba(15,23,42,0.3);
}

.chat-disabled-header h3{
  margin: 0 0 6px 0;
}

.chat-disabled-body{
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-disabled-body textarea{
  height: 64px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.4);
  padding: 10px 12px;
  background: rgba(15,23,42,0.2);
  color: #cbd5f5;
}

.chat-disabled-body button{
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: rgba(148,163,184,0.4);
  color: #e2e8f0;
}

@media (max-width: 640px){
  .wizard-row{
    grid-template-columns: 1fr;
  }
  .chat-disabled-body{
    grid-template-columns: 1fr;
  }
}

/* Standalone chat page */
body.chat-standalone{
  background: #0f172a;
  min-height: 100vh;
  color: #f8fafc;
}

.chat-alone-header{
  background: linear-gradient(135deg,#2563eb,#1e3a8a);
  color: #fff;
  padding: 32px 6vw;
  box-shadow: 0 10px 30px rgba(15,23,42,0.4);
}

.chat-alone-inner{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.chat-alone-inner h1{
  margin: 0 0 6px;
  font-size: 1.85rem;
}

.btn-link{
  background: rgba(255,255,255,0.15);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.4);
  transition: background .2s ease, transform .2s ease;
}

.btn-link:hover{
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.chat-alone-main{
  max-width: 640px;
  margin: 32px auto 80px;
  padding: 0 20px;
}

#chat-toggle.standalone{
  position: relative;
  margin-bottom: 12px;
  right: auto;
  bottom: auto;
  background: transparent;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
}

#chat-panel.standalone{
  position: relative;
  width: 100%;
  box-shadow: 0 25px 70px rgba(15,23,42,0.6);
}

.btn-primary{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border: none;
  transition: background .2s ease, transform .2s ease;
}

.btn-primary:hover{
  background: var(--accent-strong);
  transform: translateY(-1px);
}
/* ===================================
   V2 IMPROVEMENTS - NEW STYLES
   =================================== */

/* Delay Badge for Predictions */
.delay-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background-color: #fef3c7;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 8px;
}

.arrival-card.delayed {
  border-left: 3px solid #f59e0b;
}

/* Helper Text Error State */
.helper-text.error {
  color: #dc2626;
  font-weight: 500;
}

/* Loading Spinner */
.loading-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

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

/* Chat Bubble Loading State */
.bubble.loading {
  opacity: 0.7;
  font-style: italic;
}

/* Chat Button Secondary Style */
.chat-btn.secondary {
  background-color: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
}

.chat-btn.secondary:hover {
  background-color: var(--accent-bg);
}

/* Chat Button Disabled State */
.chat-btn-disabled,
.chat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #e5e7eb;
  color: #9ca3af;
}

.chat-btn:disabled:hover {
  background-color: #e5e7eb;
  transform: none;
}

/* Wizard Progress Indicator */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  margin: 12px 0;
}

.progress-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #d1d5db;
  transition: all 0.3s ease;
}

.progress-dot.active {
  width: 14px;
  height: 14px;
  background-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}

.progress-dot.completed {
  background-color: #10b981;
}

/* Language Toggle Button */
.language-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-card);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  transition: all 0.2s ease;
  z-index: 10000;
  backdrop-filter: blur(8px);
}

.chat-standalone .language-toggle {
  top: 80px;
  right: 16px;
  background-color: rgba(255, 255, 255, 0.98);
}

.language-toggle:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  background-color: #ffffff;
}

/* Offline Indicator */
.offline-indicator {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background-color: #fbbf24;
  color: #78350f;
  font-weight: 600;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.4);
  z-index: 9998;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Mobile Improvements - Larger Touch Targets */
@media (max-width: 640px) {
  .chat-btn {
    min-height: 44px; /* iOS recommended touch target */
    padding: 12px 18px;
    font-size: 1rem;
  }

.chat-btn.back{
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #1e3a8a;
  font-weight: 600;
}

.chat-btn.back:hover{
  background: #e0e7ff;
  border-color: #a5b4fc;
  transform: none;
  box-shadow: none;
}


  .btn-small {
    min-height: 40px;
    padding: 8px 16px;
  }

  select,
  input[type="text"],
  button {
    min-height: 44px;
    font-size: 16px; /* Prevents iOS zoom on focus */
  }

  /* Larger tap areas for dropdowns */
  .control-block select {
    padding: 14px 16px;
  }

  /* Sticky prediction header on mobile */
  .results-header-row {
    position: sticky;
    top: 0;
    background-color: var(--bg-card);
    z-index: 10;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-card);
  }
}

/* Pull-to-refresh hint (visual indicator) */
.pull-to-refresh-hint {
  text-align: center;
  padding: 12px;
  color: var(--text-dim);
  font-size: 0.875rem;
  font-style: italic;
}

/* Enhanced Accessibility - Focus States */
.chat-btn:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --text-main: #000000;
    --text-dim: #333333;
    --border-card: #000000;
  }

  .delay-badge {
    border: 2px solid #92400e;
  }

  .chat-btn {
    border: 2px solid var(--accent);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .loading-spinner {
    animation: none;
  }
}

/* Dark Mode Support (for future implementation) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-soft: #334155;
    --border-card: #475569;

    --text-main: #f1f5f9;
    --text-dim: #cbd5e1;
    --text-invert: #0f172a;

    --accent: #3b82f6;
    --accent-strong: #2563eb;
    --accent-bg: rgba(59, 130, 246, 0.15);

    --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 22px 50px rgba(0, 0, 0, 0.5);
  }

  .delay-badge {
    background-color: #451a03;
    color: #fef3c7;
  }

  .offline-indicator {
    background-color: #92400e;
    color: #fef3c7;
  }
}

/* Print Styles */
@media print {
  .app-header,
  .control-block,
  .results-actions,
  .assistant-card,
  #chat-panel,
  #chat-toggle,
  .language-toggle {
    display: none !important;
  }

  .arrival-card {
    page-break-inside: avoid;
  }

  body {
    background: white;
  }

  .card {
    box-shadow: none;
    border: 1px solid #000;
  }
}

/* ===================================
   END V2 IMPROVEMENTS
   =================================== */


.chat-buttons.route-grid{
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

/* ===================================
   CHAT REDESIGN (Session 6)
   =================================== */

/* Bot bubble — visible light-blue with accent left bar */
.bubble.bot {
  background: #dbeafe;
  border: none;
  border-left: 3px solid #3b82f6;
  color: #1e3a8a;
}

/* Animated typing dots (replaces ⏳ Thinking…) */
.typing-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 18px;
  vertical-align: middle;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  background: #3b82f6;
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}
/* Suppress spin animation on loading bubble — dots handle it */
.bubble.loading .loading-spinner { display: none; }

/* Starter / quick-question chips */
.starter-questions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 12px 8px;
}
.starter-q {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1e40af;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  white-space: nowrap;
  width: auto;
  min-width: 0;
  line-height: 1.3;
}
.starter-q:hover {
  background: #dbeafe;
  border-color: #3b82f6;
  transform: translateY(-1px);
}

