/* =============================================================
   Design Tokens — yuegang-web (proto-01-pro-trust 专业可信风)
   ============================================================= */

:root {
  /* Primary palette — 交通蓝 */
  --primary:      #2563EB;
  --primary-dark: #1d4ed8;
  --primary-light:#dbeafe;

  /* CTA — 行动橙 */
  --cta:          #F97316;
  --cta-dark:     #ea6c04;

  /* Neutrals */
  --text:         #0f172a;
  --muted:        #64748b;
  --surface:      #F8FAFC;
  --white:        #ffffff;

  /* Borders */
  --border:       #e2e8f0;

  /* Typography */
  --font-heading: 'Lexend', system-ui, sans-serif;
  --font-body:    'Source Sans 3', system-ui, sans-serif;

  /* Radius */
  --radius-sm:    4px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-full:  9999px;

  /* Shadows */
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow-md:    0 4px 12px rgba(0,0,0,.10);
}

/* ---- Base resets ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--surface);
  line-height: 1.6;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-heading);
}

/* ---- Utility classes ---- */
.font-heading { font-family: var(--font-heading); }
.font-body    { font-family: var(--font-body); }

.text-primary  { color: var(--primary); }
.text-cta      { color: var(--cta); }
.text-muted    { color: var(--muted); }
.text-text     { color: var(--text); }

.bg-primary    { background-color: var(--primary); }
.bg-cta        { background-color: var(--cta); }
.bg-surface    { background-color: var(--surface); }
.bg-white      { background-color: var(--white); }

.border-border { border-color: var(--border); }
.border-primary { border-color: var(--primary); }

/* ---- Components ---- */

/* Card */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, box-shadow .15s;
  text-decoration: none;
  border: none;
  background: transparent;
}
.btn:hover { opacity: .88; }

.btn-primary {
  background-color: var(--primary);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:hover { background-color: var(--primary-dark); }

.btn-cta {
  background-color: var(--cta);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-cta:hover { background-color: var(--cta-dark); }

/* 班次卡片购票按钮：价格加载中的 loading 状态（不可点击 + spinner） */
.is-price-loading {
  position: relative;
  pointer-events: none !important;
  opacity: .6;
  cursor: progress;
}
.is-price-loading::after {
  content: '';
  position: absolute;
  width: 1em;
  height: 1em;
  top: 50%;
  left: 50%;
  margin: -.5em 0 0 -.5em;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Nav link */
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .15s;
}
.nav-link:hover,
.nav-link.active { color: var(--primary); }

/* Nav logo — fills the h-16 (64px) nav bar height, width auto so it can expand */
.nav-logo { height: 3.5rem; width: auto; }

/* Badge */
.badge        { display: inline-block; }
.badge-primary {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Form fields */
.field-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
}
.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* Focus visible ring */
.focus-visible\:ring-2:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.focus-visible\:ring-cta:focus-visible {
  outline-color: var(--cta);
}

/* ---- Modal (confirmation dialog) ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-color: rgba(15, 23, 42, 0.5);
}
.modal-overlay.modal-open {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 24rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.modal-title {
  text-align: center;
  margin-bottom: 0.5rem;
}
.modal-msg {
  font-size: 0.875rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
}
.modal-btn {
  flex: 1 1 0;
  padding: 0.625rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  text-align: center;
}

.pay-cancel-trigger {
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

/* ---- Help center page ---- */
.help-hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.help-hero h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.help-hero p {
  color: var(--muted);
  font-size: 0.95rem;
}

.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  padding: 1rem;
  margin: 0 auto 1.5rem;
  max-width: 56rem;
  border-bottom: 1px solid var(--border);
}
.help-toc a {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text);
  text-decoration: none;
  background: var(--white);
  transition: border-color .15s, color .15s;
}
.help-toc a:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.help-body {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}
.help-section {
  scroll-margin-top: 5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.help-section:last-child { border-bottom: none; }
.help-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--primary);
}
.help-section p,
.help-section li {
  color: var(--text);
  font-size: 0.925rem;
  line-height: 1.7;
}
.help-section .help-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}
.help-list {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}
.help-list li { margin-bottom: 0.35rem; }

.help-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0.5rem 0;
}
.help-steps li {
  counter-increment: step;
  position: relative;
  padding: 0.5rem 0 0.5rem 2.5rem;
}
.help-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq-item {
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--border);
}
.faq-item:last-child { border-bottom: none; }
.faq-item .faq-q {
  font-weight: 600;
  font-family: var(--font-heading);
  margin-bottom: 0.25rem;
}
.faq-item .faq-a {
  color: var(--muted);
  font-size: 0.9rem;
}

.help-contact {
  text-align: center;
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.help-contact h2 { color: var(--primary); margin-bottom: 0.5rem; }
.help-contact p { color: var(--text); font-size: 0.9rem; margin-bottom: 1rem; }

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ---- Station filter (schedules page) ---- */
.stop-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}
.stop-fieldset + .stop-fieldset {
  margin-top: 0.75rem;
}

.stop-legend {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  padding: 0;
}

.stop-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.375rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1;
  transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s;
  user-select: none;
}
.stop-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.stop-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.stop-chip:has(input:checked) {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .25);
}
.stop-chip:has(input:checked):hover {
  color: #fff;
}

.stop-chip:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Stop display chips (schedules card) ---- */
.stop-row-label {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--muted);
  padding-top: 0.25rem;
  white-space: nowrap;
}

.stop-chip-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: var(--white);
  font-size: 0.8rem;
  color: var(--text);
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background-color .15s, color .15s, box-shadow .15s;
}
.stop-chip-display:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Route badge: circular 起/终 labels */
.route-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  line-height: 1;
}
.route-badge--start { background-color: var(--primary); }
.route-badge--end   { background-color: var(--cta); }

/* Active/selected state */
.stop-chip-display.stop-chip--active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

/* =============================================================
   Schedule Summary Card — order-form page
   3-col grid: 1fr | auto | 1fr
   Row1: [city-from]  [empty]                    [city-to]
   Row2: [stop-from]  [time + arrow-svg + port]  [stop-to]
   Row3: date · company · badge
   ============================================================= */

/* Top accent stripe */
.schedule-card__accent {
  height: 3px;
  background-color: var(--primary);
}

/*
 * Both city-row and stop-row use the SAME 3-col grid so that
 * "江门" and "江门胜利车站" share the same left edge, and
 * "香港" and "太子砵蘭街" share the same right edge.
 */
.schedule-card__row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

/* City row — flex space-between so names always touch card edges */
.schedule-card__cities {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* City names — Row 1 */
.schedule-card__city {
  font-family: var(--font-heading);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.schedule-card__city--arrive {
  text-align: right;
}

/* Stop row — Row 2, same grid columns, tiny gap from Row 1 */
.schedule-card__row--stops {
  margin-top: 0.25rem;
}

/* Stop names */
.schedule-card__stop {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.schedule-card__stop--arrive {
  text-align: right;
}

/*
 * Center column: time (top) → arrow SVG → port (bottom).
 * Horizontal padding creates breathing room on both sides.
 */
.schedule-card__arrow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.15rem;
}

/* Departure time */
.schedule-card__time {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  white-space: nowrap;
}

/* Arrow SVG */
.schedule-card__arrow-icon {
  display: block;
  color: var(--primary);
}

/* Port / border crossing name */
.schedule-card__port {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1.4;
}

/* Divider between route info and footer */
.schedule-card__divider {
  height: 1px;
  background-color: var(--border);
  margin-top: 0.875rem;
}

/* Footer: date · company · badge */
.schedule-card__footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.625rem;
  flex-wrap: wrap;
}

.schedule-card__date {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 500;
}

.schedule-card__company {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* 往返套票 badge */
.schedule-card__badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: rgba(249, 115, 22, 0.1);
  color: var(--cta);
}
