/**
 * Стили страницы маршрута
 */

body {
  background: #f8fafc;
}

/* header и back-link — стили в common.css */

/* ===== MAIN ===== */
.route-main {
  padding: 24px 0 60px;
}

/* ===== SUMMARY ===== */
.route-summary {
  margin-bottom: 20px;
}

.route-summary__loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
}

.route-summary__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.route-summary__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.route-summary__subtitle {
  font-size: 1rem;
  color: #6b7280;
  max-width: 100%;
  margin: 0;
  line-height: 1.5;
}

.route-summary__address {
  font-size: 0.875rem;
  color: #6b7280;
  max-width: 100%;
  margin: 0;
  line-height: 1.5;
}

.route-summary__time {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
}

/* ===== DIRECTION SWITCH ===== */
.direction-switch-wrapper {
  display: flex;
  justify-content: center;
  margin: 16px 0 24px;
}

.direction-switch {
  display: inline-flex;
  background: #d1d5db;
  border-radius: 10px;
  padding: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.direction-switch__btn {
  padding: 10px 20px;
  font-size: 0.9375rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 7px;
}

.direction-switch__btn:hover:not(.direction-switch__btn--active) {
  background: rgba(255, 255, 255, 0.4);
  color: #374151;
}

.direction-switch__btn--active {
  background: white;
  color: #1f2937;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

@media (max-width: 480px) {
  .direction-switch-wrapper {
    margin: 12px 0 20px;
    /* На мобильных занимаем всю ширину */
    display: block;
  }
  
  .direction-switch {
    display: flex;
    width: 100%;
  }
  
  .direction-switch__btn {
    flex: 1;
    padding: 14px 12px;
    font-size: 0.875rem;
    text-align: center;
  }
}

/* ===== MAP ===== */
.route-map {
  width: 100%;
  height: 450px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .route-map {
    height: 350px;
    border-radius: 12px;
  }
}

/* ===== MODE BUTTONS ===== */
.route-mode-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.route-mode-btn {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  background: white;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
  text-align: center;
}

.route-mode-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

.route-mode-btn--active {
  border-color: var(--color-brand-primary);
  background: #fef2f2;
  color: var(--color-brand-primary);
}

@media (max-width: 480px) {
  .route-mode-buttons {
    flex-direction: column;
  }
}

/* ===== STEPS ===== */
.route-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.route-steps__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 16px 0;
  line-height: 1.4;
}

/* "Другие маршруты..." — отделяем от предыдущего блока и центрируем заголовок */
#related-routes {
  margin-top: 24px;
}
#related-routes .route-steps__title {
  text-align: center;
}

/* "Вопросы и ответы" — центрируем заголовок как у других блоков */
#faq .route-steps__title {
  text-align: center;
}

/* ===== FAQ (saved routes) ===== */
.route-faq {
  margin-top: 24px;
}

.route-faq .faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.route-faq .faq-item {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.route-faq .faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 0.8125rem; /* как в описании шагов */
  line-height: 1.5;     /* как в описании шагов */
  font-weight: 600;
  color: #1f2937;
  list-style: none;
}

.route-faq .faq-question::after {
  content: "▾";
  flex: 0 0 auto;
  margin-left: 12px;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.15s ease, color 0.15s ease;
}

.route-faq .faq-question::-webkit-details-marker {
  display: none;
}

.route-faq .faq-item[open] .faq-question::after {
  transform: rotate(180deg);
  color: #6b7280;
}

.route-faq .faq-question:hover::after {
  color: #6b7280;
}

.route-faq .faq-item[open] .faq-question {
  border-bottom: 1px solid #e5e7eb;
}

.route-faq .faq-answer {
  padding: 0 16px 16px;
  font-size: 0.8125rem; /* как в описании шагов */
  color: #6b7280;       /* как в описании шагов */
  line-height: 1.5;
}

.route-step {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.route-step__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.route-step__body {
  min-width: 0;
}

.route-step__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.route-step__details {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.5;
}

.route-step__meta {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1f2937;
  text-align: right;
  white-space: nowrap;
}

/* ===== NARRATIVE (SEO TEXT UNDER STEPS) ===== */
.route-narrative {
  margin-top: 16px;
  padding: 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.route-narrative__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 10px 0;
  line-height: 1.35;
  text-align: center;
}

.route-narrative__p {
  margin: 0 0 10px 0;
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.6;
}

.route-narrative__p:last-child {
  margin-bottom: 0;
}

.route-narrative .btn-buy {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .route-step {
    grid-template-columns: 36px 1fr;
    gap: 10px;
  }
  
  .route-step__meta {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
    font-size: 0.875rem;
  }

  /* CTA should be on its own row on mobile to avoid overlapping meta */
  .route-step__actions {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* ===== ERROR STATE ===== */
.route-error {
  padding: 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #b91c1c;
  text-align: center;
}

.route-error__title {
  font-weight: 600;
  margin-bottom: 8px;
}

.route-error__message {
  font-size: 0.875rem;
  margin-bottom: 16px;
}

/* ===== TWO COLUMNS LAYOUT ===== */
.route-columns {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-top: 24px;
}

.route-column--left {
  min-width: 0;
}

.route-column--right {
  min-width: 0;
}

/* Saved route page (marshrut.php): 3 блока внутри .route-columns.
   На десктопе правую колонку растягиваем на обе строки, чтобы sticky работал на всей высоте контента. */
.route-columns--saved .route-column--right {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.route-columns--saved .route-column--secondary {
  grid-column: 1;
  grid-row: 2;
}

@media (max-width: 1024px) {
  .route-columns {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  /* На мобильных снова естественный DOM-порядок (1 колонка). */
  .route-columns--saved .route-column--right,
  .route-columns--saved .route-column--secondary {
    grid-column: auto;
    grid-row: auto;
  }
}

/* ===== PRICE CALCULATOR ===== */
.price-calculator {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

@media (min-width: 1025px) {
  .price-calculator {
    position: sticky;
    top: 24px;
  }
}

.price-calculator__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 20px 0;
  text-align: center;
}

.price-calculator__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.price-calculator__row--children {
  padding-left: 28px;
}

.price-calculator__label {
  font-size: 0.875rem;
  color: #374151;
}

/* Counter */
.counter {
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter__btn {
  width: 36px;
  height: 36px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.counter__btn:hover {
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary);
}

.counter__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.counter__btn:disabled:hover {
  border-color: #e5e7eb;
  color: #374151;
}

.counter__value {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1f2937;
  min-width: 24px;
  text-align: center;
}

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: #374151;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-brand-primary);
  cursor: pointer;
}

/* Price Cards */
.price-card {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

.price-card--aeroexpress {
  border-color: #22c55e;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.price-card--taxi {
  border-color: #d1d5db;
  background: #f9fafb;
}

.price-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
  text-align: center;
}

.price-card__loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
}

.price-card__loading-state .spinner {
  width: 24px;
  height: 24px;
  margin-bottom: 8px;
}

.price-card__loading-state span {
  font-size: 0.875rem;
  color: #6b7280;
}

.price-card__price {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1f2937;
  text-align: center;
}

.price-card__cars-detail {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  margin-top: 4px;
}

.price-card--aeroexpress .price-card__price {
  color: #16a34a;
}

.price-card__children-note {
  font-size: 0.8125rem;
  color: #16a34a;
  margin-top: 4px;
  text-align: center;
}

.price-card__benefits {
  list-style: none;
  margin: 12px 0 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.price-card__benefits li {
  font-size: 0.8125rem;
  color: #374151;
  padding-left: 16px;
  position: relative;
}

.price-card__benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #22c55e;
  font-weight: 700;
}

/* Специальный пункт преимуществ: одна строка по центру */
.price-card__benefits li.price-card__benefit-centered {
  grid-column: 1 / -1;
  padding-left: 0;
  text-align: center;
  justify-self: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
}

.price-card__benefits li.price-card__benefit-centered::before {
  content: none;
}

/* Savings */
.price-savings {
  text-align: center;
  margin-bottom: 16px;
  padding: 8px 0;
}

.price-savings__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #16a34a;
  margin-bottom: 4px;
}

.price-savings__amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: #16a34a;
}

.price-savings__amount span:last-child {
  font-size: 1rem;
  font-weight: 600;
  color: #22c55e;
}

/* Buy Button */
.btn-buy {
  display: block;
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
}

.btn-buy:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.34);
}

.btn-buy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28), 0 6px 16px rgba(22, 163, 74, 0.22);
}

/* Small CTA variant (used in map balloon + in-step card CTA) */
.btn-buy--small {
  display: inline-flex;
  width: auto;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.22);
  transform: none;
}

.btn-buy--small:hover {
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.28);
}

/* CTA placement inside step cards */
.route-step__actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

/* Smaller schedule toggle ONLY in step cards (not in price widget) */
.route-step__actions .aero-schedule__toggle {
  padding: 8px 14px;
  font-size: 0.875rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.18);
}

.route-step__actions .aero-schedule__toggle:hover {
  transform: none; /* не перетягиваем внимание */
  box-shadow: 0 3px 12px rgba(245, 158, 11, 0.22);
}

/* Price calculator: schedule block under "buy ticket" */
.price-schedule {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-schedule__toggle {
  width: 100%;
}

/* ===== AEROEXPRESS SCHEDULE (inside step card) ===== */
.aero-schedule {
  grid-column: 1 / -1;
  margin-top: 10px;
  border-top: 1px dashed #e5e7eb;
  padding-top: 10px;
}

/* Toggle button: like site buttons, but yellow */
.btn-ae-schedule {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #111827;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}

.btn-ae-schedule:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.32);
}

.btn-ae-schedule:active {
  transform: translateY(0);
}

.btn-ae-schedule:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25), 0 6px 20px rgba(245, 158, 11, 0.22);
}

.aero-schedule__table-wrap {
  margin-bottom: 10px;
  /* Мобильные: если что-то всё же не влезет — позволяем горизонтальный скролл */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.aero-schedule__title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #111827;
  text-align: center;
  margin: 2px 0 10px;
}

.aero-schedule__table {
  width: 100%;
  table-layout: fixed; /* важна для длинных заголовков станций */
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}

.aero-schedule__th,
.aero-schedule__td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  line-height: 1.2;
}

.aero-schedule__th {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #6b7280;
  /* Заголовки у нас “фразой”, не капсом — иначе длинные станции выглядят плохо */
  text-transform: none;
  letter-spacing: 0.01em;
  background: #f9fafb;
  white-space: normal;
  word-break: break-word;
}

.aero-schedule__tr:last-child .aero-schedule__td {
  border-bottom: none;
}

.aero-schedule__td--time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

.aero-schedule__th--time {
  text-align: center;
}

@media (max-width: 480px) {
  .aero-schedule__title {
    font-size: 0.875rem;
    margin: 0 0 8px;
  }

  .aero-schedule__th,
  .aero-schedule__td {
    padding: 8px 10px;
  }

  .aero-schedule__th {
    font-size: 0.625rem;
    line-height: 1.2;
  }

  .aero-schedule__td {
    font-size: 0.875rem;
  }
}

.aero-schedule__status {
  font-size: 0.8125rem;
  color: #6b7280;
  text-align: center;
  margin: 6px 0 10px;
}

.aero-schedule__footer {
  display: flex;
  justify-content: center;
}

.aero-schedule__full-link {
  display: inline-block;
  padding: 6px 2px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #f59e0b; /* как у жёлтой кнопки */
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, filter 0.15s ease;
}

.aero-schedule__full-link:hover {
  color: #d97706;
  filter: brightness(0.98);
}

.aero-schedule__full-link:focus-visible {
  outline: none;
  border-radius: 6px;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

/* ===== TAXI CARD DETAILS ===== */
.price-card__details {
  font-size: 0.8125rem;
  color: #6b7280;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.price-card__error {
  font-size: 0.8125rem;
  color: #b91c1c;
  margin-top: 8px;
  padding: 10px;
  background: #fef2f2;
  border-radius: 8px;
  line-height: 1.4;
}

.price-card__retry-btn {
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.price-card__retry-btn:hover {
  background: #e5e7eb;
}

.price-card__warning {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 10px;
  line-height: 1.4;
}

.price-card__warning .warning-icon {
  color: #f59e0b;
  margin-right: 4px;
}

.price-card__footnote {
  font-size: 0.6875rem;
  color: #9ca3af;
  margin-top: 12px;
  text-align: left;
}

.price-card--taxi.has-error {
  border-color: #fecaca;
  background: #fef2f2;
}

.price-card--taxi.has-error .price-card__price {
  display: none;
}

/* Footer — унифицирован в css/common.css */

