/* ============================================
   Метро Харків PWA — Light Theme v3
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ---- Tokens ---- */
:root {
  /* Backgrounds */
  --bg: #F5F6FA;
  --bg-card: #FFFFFF;
  --bg-card-2: #F0F2F8;

  /* Line colors */
  --red: #E53935;
  --red-light: #FFEBEE;
  --red-mid: #FFCDD2;

  --blue: #1565C0;
  --blue-light: #E3F2FD;
  --blue-mid: #BBDEFB;

  --green: #2E7D32;
  --green-light: #E8F5E9;
  --green-mid: #C8E6C9;

  /* Text */
  --text-1: #0F1117;
  --text-2: #4A5568;
  --text-3: #9AA3B4;

  /* Borders */
  --border: #E2E8F0;
  --border-2: #CBD5E0;

  /* Accents */
  --accent-metro: #E53935;
  /* subway red */

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 20px;

  --nav-height: 68px;
  --shadow-s: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-m: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.04);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   App shell
   ============================================ */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- Header ---- */
.app-header {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  gap: 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-s);
}

.logo-metro {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.header-titles {
  flex: 1;
}

.header-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.2px;
  line-height: 1.1;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  margin-top: 1px;
}

.live-time {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-metro);
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-metro);
  animation: blink 2s infinite;
  flex-shrink: 0;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

/* ============================================
   Tab panels
   ============================================ */
.tab-panel {
  display: none;
  flex: 1;
  padding-bottom: calc(var(--nav-height) + 12px);
  animation: fade-up 0.18s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   Section label
   ============================================ */
.section-label {
  padding: 14px 18px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
}

/* ============================================
   Station select
   ============================================ */
.station-picker-wrap {
  position: relative;
  padding: 0 18px;
}

.station-select {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-m);
  color: var(--text-1);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  padding: 14px 48px 14px 16px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  box-shadow: var(--shadow-s);
  line-height: 1.2;
}

.station-select:focus {
  border-color: var(--accent-metro);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.15);
}

/* Line-colored option groups shown with custom select (via optgroup label color) */
.station-select optgroup {
  font-size: 13px;
}

.select-chevron {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-3);
  display: flex;
  align-items: center;
  z-index: 1;
}

.select-chevron svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* ============================================
   Direction toggle
   ============================================ */
.direction-wrap {
  padding: 0 18px;
}

.direction-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-card);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-m);
  padding: 4px;
  gap: 4px;
  box-shadow: var(--shadow-s);
}

.dir-btn {
  padding: 12px 8px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-s);
  background: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.dir-btn-arrow {
  font-size: 18px;
  line-height: 1;
}

.dir-btn-text {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-align: center;
  line-height: 1.2;
  transition: color 0.15s;
}

.dir-btn.active {
  background: var(--red-light);
  border-color: var(--red);
}

.dir-btn.active .dir-btn-text {
  color: var(--red);
}

/* ============================================
   Countdown block
   ============================================ */
.countdown-wrap {
  padding: 12px 18px 0;
}

.countdown-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-l);
  padding: 20px 18px 18px;
  text-align: center;
  box-shadow: var(--shadow-m);
  position: relative;
  overflow: hidden;
}

.countdown-card.is-open {
  border-color: var(--red);
  background: linear-gradient(160deg, #fff9f9 0%, #ffffff 60%);
}

.countdown-eyebrow {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 10px;
}

.countdown-digits {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  letter-spacing: -3px;
}

.countdown-unit {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
  margin-top: 6px;
}

.countdown-divider {
  width: 36px;
  height: 1px;
  background: var(--border);
  margin: 12px auto;
}

.next-train-line {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 500;
}

.next-train-time {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.last-badge {
  display: inline-block;
  background: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
  border-radius: 20px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================
   Day-type toggle
   ============================================ */
.day-switch-wrap {
  padding: 10px 18px 0;
  display: flex;
  gap: 7px;
}

.day-switch-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-s);
  background: var(--bg-card);
  color: var(--text-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: var(--shadow-s);
}

.day-switch-btn.active {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-light);
}

/* ============================================
   Schedule table — HH:MM chips style
   ============================================ */
.schedule-wrap {
  padding: 12px 18px 0;
}

.schedule-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}

.schedule-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card-2);
}

.schedule-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.schedule-next-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  background: var(--red-light);
  border: 1px solid var(--red-mid);
  border-radius: 20px;
  padding: 2px 9px;
}

.trains-count {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
}

/* Grid of HH:MM chips */
.time-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 12px 14px;
}

.time-chip {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-card-2);
  color: var(--text-2);
  transition: all 0.15s;
  cursor: default;
  letter-spacing: -0.2px;
}

/* The very next upcoming train */
.time-chip.chip-next {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  font-weight: 900;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(229, 57, 53, 0.35);
  animation: chip-pulse 2s ease-in-out infinite;
  order: -1;
  /* float to front */
}

/* Past trains — dimmed */
.time-chip.chip-past {
  opacity: 0.3;
}

/* Trains with asterisk (last of the night) */
.time-chip.chip-last {
  border-style: dashed;
  border-color: var(--red-mid);
  color: var(--red);
}

/* Tomorrow's first train */
.time-chip.chip-tomorrow-first {
  background: var(--green-light);
  border-color: var(--green);
  color: var(--green);
  font-weight: 900;
}

@keyframes chip-pulse {

  0%,
  100% {
    box-shadow: 0 2px 6px rgba(229, 57, 53, 0.2);
  }

  50% {
    box-shadow: 0 2px 18px rgba(229, 57, 53, 0.55);
  }
}

/* Schedule section header (when displaying tomorrow) */
.schedule-section-label {
  width: 100%;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-3);
  padding: 8px 0 3px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.schedule-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 15px;
  font-weight: 500;
}

/* ============================================
   Hours & notice cards
   ============================================ */
.hours-wrap {
  padding: 10px 18px 0;
}

.hours-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-s);
}

.hours-emoji {
  font-size: 22px;
  flex-shrink: 0;
}

.hours-row {
  display: flex;
  gap: 24px;
  align-items: center;
}

.hours-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.hours-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
}

.hours-val {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.hours-val.open {
  color: var(--green);
}

.hours-val.close {
  color: var(--red);
}

/* Vestibule note */
.vestibule-note-wrap {
  padding: 8px 18px 0;
}

.vestibule-note {
  background: #FFF8E1;
  border: 1px solid #FFE082;
  border-radius: var(--radius-s);
  padding: 10px 13px;
  font-size: 12px;
  color: #5D4037;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.vestibule-note-ico {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* War notice */
.notice-wrap {
  padding: 8px 18px 0;
}

.notice {
  background: #FFF3E0;
  border: 1px solid #FFCC80;
  border-radius: var(--radius-s);
  padding: 10px 13px;
  font-size: 12px;
  color: #6D4C41;
  line-height: 1.5;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.notice-ico {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ============================================
   Map / Line view
   ============================================ */
.line-map-wrap {
  padding: 14px 18px 0;
}

.line-map-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.line-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.line-badge.green {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid var(--green-mid);
}

.line-badge.red {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid var(--red-mid);
}

.line-badge.blue {
  background: var(--blue-light);
  color: var(--blue);
  border: 1px solid var(--blue-mid);
}

.line-color-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.metro-line-svg-wrap {
  position: relative;
}

.metro-track {
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
}

.track-green {
  background: var(--green);
}

.track-red {
  background: var(--red);
}

.track-blue {
  background: var(--blue);
}

.metro-station-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
  transition: all 0.12s;
}

.metro-station-row:active {
  opacity: 0.7;
}

.metro-dot-col {
  width: 58px;
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.metro-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--text-3);
  transition: all 0.15s;
}

.metro-station-row.is-terminal .metro-dot {
  width: 20px;
  height: 20px;
  border-width: 4px;
}

.metro-station-row.line-green .metro-dot {
  border-color: var(--green);
}

.metro-station-row.line-red .metro-dot {
  border-color: var(--red);
}

.metro-station-row.line-blue .metro-dot {
  border-color: var(--blue);
}

.metro-station-row.is-active .metro-dot,
.metro-station-row:hover .metro-dot {
  transform: scale(1.2);
}

.metro-station-row.line-green.is-active .metro-dot {
  background: var(--green);
}

.metro-station-row.line-red.is-active .metro-dot {
  background: var(--red);
}

.metro-station-row.line-blue.is-active .metro-dot {
  background: var(--blue);
}

.metro-station-info {
  flex: 1;
  min-width: 0;
}

.metro-station-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.15s;
}

.metro-station-row.line-green.is-active .metro-station-name {
  color: var(--green);
}

.metro-station-row.line-red.is-active .metro-station-name {
  color: var(--red);
}

.metro-station-row.line-blue.is-active .metro-station-name {
  color: var(--blue);
}

.metro-transfer {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

.map-select-chip {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  background: var(--bg-card);
}

.metro-station-row.line-green.is-active .map-select-chip {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-light);
}

.metro-station-row.line-red.is-active .map-select-chip {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-light);
}

.metro-station-row.line-blue.is-active .map-select-chip {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--blue-light);
}

/* Map line group header */
.metro-line-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

/* ============================================
   Bottom nav
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 0 8px env(safe-area-inset-bottom);
  z-index: 100;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 0;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-s);
  transition: all 0.15s;
  color: var(--text-3);
  font-family: inherit;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.nav-item span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: inherit;
}

.nav-item.active {
  color: var(--red);
  background: var(--red-light);
}

/* ============================================
   Toast
   ============================================ */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 14px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-1);
  color: #fff;
  border-radius: var(--radius-s);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  z-index: 200;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  animation: toast-show 0.2s ease forwards, toast-hide 0.2s ease 2.3s forwards;
}

@keyframes toast-show {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toast-hide {
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-5px);
  }
}

/* ============================================
   Scrollbar (light)
   ============================================ */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: 4px;
}