/* ══════════════════════════════════════
   SECTION
══════════════════════════════════════ */
.stn-section {
  padding: 2rem 0 0;
}

.stn-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.stn-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

/* ══════════════════════════════════════
   STATS BAR
══════════════════════════════════════ */
.stn-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 1.5rem;
}

.stn-stat-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stn-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
}

.stn-stat-num--green { color: #2ECC71; }
.stn-stat-num--lightgreen { color: #A9DFBF; }
.stn-stat-num--amber { color: #F39C12; }
.stn-stat-num--red   { color: #E74C3C; }
.stn-stat-num--blue  { color: #3498DB; }

.stn-stat-lbl {
  font-size: 11px;
  color: #888;
  font-weight: 500;
  line-height: 1.3;
}

/* ══════════════════════════════════════
   MAP HEADER
══════════════════════════════════════ */
.stn-map-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stn-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.stn-controls-label {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
}

.stn-toggle-group {
  display: flex;
  gap: 4px;
  background: #f4f6f9;
  border: 1px solid #eee;
  border-radius: 20px;
  padding: 3px;
}

.stn-toggle-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #666;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.stn-toggle-btn:hover {
  background: #fff;
  color: #1a1a1a;
}

.stn-toggle-btn.active {
  background: var(--primary-color);
  color: #fff;
}

/* ══════════════════════════════════════
   MAP + LEGEND ROW
══════════════════════════════════════ */
.stn-map-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 14px;
  align-items: start;
}

/* ── SEARCH ── */
.stn-map-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.stn-search-row {
  position: relative;
  width: 100%;
}

.stn-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 0 12px;
  height: 42px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.stn-search-box:focus-within {
  border-color: var(--primary-color, #2c5f8a);
  box-shadow: 0 0 0 3px rgba(44,95,138,0.1);
}

.stn-search-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

#stn-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  color: #222;
  background: transparent;
  min-width: 0;
}

#stn-search-input::placeholder { color: #aaa; }

.stn-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: #aaa;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.stn-search-clear:hover { color: #555; }

.stn-search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  z-index: 1000;
  max-height: 280px;
  overflow-y: auto;
}

.stn-search-result-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.stn-search-result-item:hover { background: #f4f7fb; }

.stn-result-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stn-result-wigos {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── MAP ── */
.stn-map-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #eee;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.stn-map {
  height: 520px;
  width: 100%;
  display: block;
}

/* ── LEGEND PANEL ── */
.stn-legend-panel {
  position: sticky;
  top: 1.5rem;
}

.stn-legend {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stn-legend-title {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
}

.stn-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f8f8f8;
}

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

.stn-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.12);
}

.stn-legend-label {
  font-size: 11px;
  color: #555;
  line-height: 1.4;
}

/* ══════════════════════════════════════
   POPUP
══════════════════════════════════════ */
.stn-popup {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 200px;
}

.stn-popup-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stn-popup-key {
  font-size: 10px;
  font-weight: 700;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stn-popup-val {
  font-size: 13px;
  font-weight: 500;
  color: #1a1a1a;
  word-break: break-word;
}

.stn-popup-detail-btn {
  display: block;
  margin-top: 10px;
  padding: 7px 0;
  text-align: center;
  background: var(--primary-color, #2c5f8a);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.stn-popup-detail-btn:hover { opacity: 0.85; color: #fff; }

.maplibregl-popup-content {
  border-radius: 10px !important;
  padding: 14px 16px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
  border: 1px solid #eee !important;
}

.maplibregl-popup-close-button {
  font-size: 16px !important;
  color: #aaa !important;
  padding: 4px 8px !important;
}

.maplibregl-popup-close-button:hover {
  color: #333 !important;
  background: transparent !important;
}

/* ══════════════════════════════════════
   STATIONS LIST SECTION
══════════════════════════════════════ */
.stn-list-section {
  padding: 2.5rem 0 4rem;
}

.stn-list-header {
  margin-bottom: 1.25rem;
}

.stn-list-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

/* ── TABLE ── */
.stn-table-wrap {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
}

.stn-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stn-table-wrap thead th {
  background: #f8f9fb;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.stn-table-wrap thead th a {
  color: #888;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stn-table-wrap thead th a:hover {
  color: var(--primary-color);
}

.stn-table-wrap tbody tr {
  border-bottom: 1px solid #f4f4f4;
  transition: background 0.1s;
}

.stn-table-wrap tbody tr:last-child {
  border-bottom: none;
}

.stn-table-wrap tbody tr:hover {
  background: #f8f9fb;
}

.stn-table-wrap tbody td {
  padding: 10px 14px;
  color: #444;
  vertical-align: middle;
}

.stn-table-wrap tbody td a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.stn-table-wrap tbody td a:hover {
  text-decoration: underline;
}

.stn-table-wrap .pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 14px;
  border-top: 1px solid #f0f0f0;
  flex-wrap: wrap;
}

.stn-table-wrap .pagination a,
.stn-table-wrap .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  text-decoration: none;
  border: 1px solid #eee;
  background: #fff;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.stn-table-wrap .pagination a:hover {
  background: var(--background-color);
  color: var(--primary-color);
  border-color: var(--background-color);
}

.stn-table-wrap .pagination .active a,
.stn-table-wrap .pagination .active span {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 1024px) {
  .stn-stats-bar { grid-template-columns: repeat(3, 1fr); }
  .stn-map-row   { grid-template-columns: 1fr 140px; }
  .stn-map       { height: 460px; }
}

@media (max-width: 768px) {
  .stn-section      { padding: 1.5rem 0 0; }
  .stn-stats-bar    { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 1rem; }
  .stn-map-row      { grid-template-columns: 1fr; }
  .stn-map          { height: 340px; }
  .stn-legend-panel { position: static; }
  .stn-legend       { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; padding: 12px; }
  .stn-legend-item  { border-bottom: none; padding: 2px 0; }
  .stn-title        { font-size: 18px; }
  .stn-list-title   { font-size: 18px; }
  .stn-list-section { padding: 2rem 0 3rem; }
  .stn-map-title-row { flex-direction: column; align-items: flex-start; }

  .stn-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
  }

  .stn-table-wrap table { min-width: 600px; }
}

@media (max-width: 480px) {
  .stn-stats-bar { grid-template-columns: 1fr 1fr; }
  .stn-stat-num  { font-size: 22px; }
  .stn-map       { height: 280px; }
}