/* ==========================================================================
   Subway Time - Ultra Clean & Minimal Design System
   ========================================================================== */

:root {
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --border-subtle: #edf2f7;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --accent-color: #2563eb;
  --accent-light: #eff6ff;
  --accent-hover: #1d4ed8;

  --badge-express-bg: #fef2f2;
  --badge-express-text: #dc2626;
  --badge-express-border: #fecaca;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --container-max: 1100px;
  --header-height: 64px;
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-surface-hover: #1e293b;
  --bg-subtle: #0f172a;
  --border-color: #1f293d;
  --border-subtle: #162032;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --accent-color: #3b82f6;
  --accent-light: #1e293b;
  --accent-hover: #60a5fa;

  --badge-express-bg: #450a0a;
  --badge-express-text: #f87171;
  --badge-express-border: #7f1d1d;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

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

body {
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font-family: inherit;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #2563eb, #00A84D);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-hover);
}

/* Search Hero Section */
.search-hero {
  padding: 36px 0 24px 0;
  text-align: center;
}

.search-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.search-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.search-bar-wrapper {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.search-input-box {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 6px 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.search-input-box:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-icon {
  color: var(--text-subtle);
  margin-right: 10px;
  font-size: 1.1rem;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 0;
  font-size: 1rem;
  color: var(--text-main);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-subtle);
}

.search-results-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  z-index: 50;
  display: none;
  text-align: left;
}

.search-results-dropdown.active {
  display: block;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--bg-surface-hover);
}

.search-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Lines Pill Grid */
.lines-section {
  padding: 16px 0 32px 0;
}

.section-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.lines-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.line-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.line-pill:hover {
  border-color: var(--accent-color);
  background: var(--bg-surface-hover);
  transform: translateY(-1px);
}

.line-pill.active {
  border-color: var(--text-main);
  background: var(--bg-surface-hover);
  font-weight: 700;
}

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

/* Station Main View */
.station-header-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.station-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.station-main-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.station-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.station-heading {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.station-subname {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
}

.transfer-badge-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.transfer-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 4px;
}

.transfer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.transfer-badge:hover {
  opacity: 0.85;
}

/* Hero First & Last Train Cards */
.quick-time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.quick-time-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

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

.quick-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.quick-card-dir {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.quick-time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.quick-time-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.quick-time-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

.quick-time-dest {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 4px;
}

/* Timetable Controller */
.timetable-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.day-tabs {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-full);
}

.day-tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.day-tab-btn:hover {
  color: var(--text-main);
}

.day-tab-btn.active {
  background: var(--text-main);
  color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.filter-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip.active {
  background: var(--badge-express-bg);
  color: var(--badge-express-text);
  border-color: var(--badge-express-border);
}

/* Timetable 2-Column Split Grid */
.timetable-grid-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.day-panel {
  display: none;
}

.day-panel.active {
  display: grid;
}

@media (max-width: 820px) {
  .timetable-grid-split {
    grid-template-columns: 1fr;
  }
}

.timetable-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.column-header {
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.column-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.column-dir-tag {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.timetable-row {
  display: flex;
  align-items: flex-start;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.1s ease;
}

.timetable-row:last-child {
  border-bottom: none;
}

.timetable-row:hover {
  background: var(--bg-surface-hover);
}

.hour-badge {
  width: 44px;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}

.train-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

.train-item {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.train-item:hover {
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

.train-min {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.train-dest {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.train-item.is-express {
  background: var(--badge-express-bg);
  color: var(--badge-express-text);
  border-color: var(--badge-express-border);
}

.train-item.is-express .train-dest {
  color: var(--badge-express-text);
  font-weight: 600;
}

/* Station Details Accordion / Sections */
.station-details-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.detail-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: var(--radius-md);
}

.detail-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.detail-val {
  font-size: 0.95rem;
  font-weight: 600;
}

/* Station Exits */
.exit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.exit-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.exit-badge {
  background: var(--accent-light);
  color: var(--accent-color);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.exit-body {
  flex: 1;
}

.exit-facilities {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.exit-bus {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Line Station List View */
.line-stations-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.line-stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.station-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.15s ease;
}

.station-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-color);
  transform: translateY(-1px);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}

.footer-copyright {
  color: var(--text-subtle);
}

/* ==========================================================================
   Google AdSense Clean Container (CLS Protection & High CTR)
   ========================================================================== */
.ad-slot-wrapper {
  margin: 20px auto;
  text-align: center;
  max-width: 100%;
}

.ad-slot-wrapper.hero-ad {
  margin: 10px auto 24px auto;
  max-width: 728px;
}

.ad-slot-wrapper.mid-ad {
  margin: 28px auto;
  max-width: 100%;
}

.ad-card-box {
  background: var(--bg-surface);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  position: relative;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ad-badge-tag {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 6px;
  display: block;
}

