/* =========================================================
   StellwerkSim Suche — Stylesheet
   Inspired by the stellwerksim.de yellow/black design
   ========================================================= */

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

body {
  font-family: sans-serif;
  font-size: 13px;
  background: #ffffd0;
  color: #000;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: #0000cc; }
a:hover { color: #cc0000; }

/* ----- Header ------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, #ffff00 0%, #eeee00 60%, #cccc00 100%);
  border-bottom: 2px solid #000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-title a {
  font-size: 20px;
  font-weight: bold;
  color: #000;
  text-decoration: none;
  letter-spacing: 0.5px;
}
.site-title a:hover { color: #660000; }

.site-nav {
  display: flex;
  gap: 16px;
  margin-left: auto;
}
.site-nav a {
  color: #000;
  text-decoration: none;
  font-weight: bold;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
}
.site-nav a:hover {
  border-color: #000;
  background: #ffff99;
}

/* ----- Page layout -------------------------------------- */
.page-wrap {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* ----- Filter sidebar ----------------------------------- */
.filter-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #ffff99;
  border: 1px solid #000;
  padding: 10px 12px;
  position: sticky;
  top: 54px;
}

.filter-sidebar h2 {
  font-size: 13px;
  font-weight: bold;
  border-bottom: 1px solid #000;
  padding-bottom: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group {
  margin-bottom: 12px;
}

.filter-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 3px;
  font-size: 11px;
  text-transform: uppercase;
  color: #333;
}

.filter-group input[type="text"],
.filter-group input[type="number"],
.filter-group select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #888;
  font-size: 12px;
  background: #fff;
}

.filter-group input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.range-value {
  text-align: right;
  font-size: 11px;
  color: #555;
}

/* ----- Dual range slider -------------------------------- */
.dual-range {
  position: relative;
  height: 28px;
  margin: 4px 0 2px;
}

/* Track background */
.dual-range-track {
  position: absolute;
  left: 0; right: 0;
  top: 50%; transform: translateY(-50%);
  height: 5px;
  background: #ccc;
  border: 1px solid #aaa;
  border-radius: 3px;
  pointer-events: none;
}

/* Filled segment between the two thumbs */
.dual-range-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #cccc00, #ffcc00);
  border-radius: 3px;
}

/* Both range inputs sit on top of each other */
.dual-range .dr-input {
  position: absolute;
  width: 100%;
  top: 50%; transform: translateY(-50%);
  margin: 0; padding: 0;
  background: transparent;
  pointer-events: none;    /* only the thumb is interactive */
  -webkit-appearance: none;
  appearance: none;
  height: 28px;
  outline: none;
  border: none;
  z-index: 2;
}

/* Chrome/Safari thumb */
.dual-range .dr-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffdd00;
  border: 2px solid #333;
  cursor: grab;
  pointer-events: all;
  position: relative;
  z-index: 3;
  transition: background 0.15s, transform 0.1s;
}
.dual-range .dr-input::-webkit-slider-thumb:active {
  background: #ffaa00;
  cursor: grabbing;
  transform: scale(1.2);
}

/* Firefox thumb */
.dual-range .dr-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffdd00;
  border: 2px solid #333;
  cursor: grab;
  pointer-events: all;
}
.dual-range .dr-input::-moz-range-thumb:active {
  background: #ffaa00;
  cursor: grabbing;
}

/* Remove Firefox default track */
.dual-range .dr-input::-moz-range-track {
  background: transparent;
  border: none;
}

/* The min thumb sits below the max so max always grabbable on overlap */
.dual-range .dr-min { z-index: 2; }
.dual-range .dr-max { z-index: 2; }

/* Value labels below the slider */
.dual-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #333;
  font-weight: bold;
  padding: 0 2px;
}

.btn-reset {
  width: 100%;
  padding: 5px;
  background: #cccc00;
  border: 1px solid #000;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
}
.btn-reset:hover { background: #ffff00; }

/* ----- Main content area -------------------------------- */
.main-content {
  flex: 1;
  min-width: 0;
}

.result-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.result-count {
  font-size: 12px;
  color: #555;
}

/* ----- Station table ------------------------------------ */
.station-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #000;
  background: #fff;
}

.station-table thead th {
  background: #ccddcc;
  border: 1px solid #000;
  padding: 5px 8px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
}

.station-table thead th:hover { background: #aabbaa; }

.station-table thead th.sort-asc::after  { content: ' ▲'; font-size: 10px; }
.station-table thead th.sort-desc::after { content: ' ▼'; font-size: 10px; }

.station-table tbody tr:nth-child(even) { background: #ffffc0; }
.station-table tbody tr:hover { background: #ffff88; }

.station-table td {
  border: 1px solid #ccc;
  padding: 4px 8px;
  vertical-align: middle;
  font-size: 12px;
}

.station-table td.td-name { font-weight: bold; }
.station-table td.td-name a { text-decoration: none; }
.station-table td.td-name a:hover { text-decoration: underline; }

.station-table td.td-num    { text-align: right; white-space: nowrap; }
.station-table td.td-center { text-align: center; }
.station-table th.th-tags,
.station-table td.td-tags   { max-width: 150px; }

/* Tag chip — used in table + station detail */
.tag-chip {
  display: inline-block;
  background: #e8f4ff;
  border: 1px solid #88aacc;
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 10px;
  white-space: nowrap;
  margin: 1px 1px 1px 0;
}

/* Year tag badge */
.year-tag {
  display: inline-block;
  background: #ffcc00;
  border: 1px solid #aa8800;
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: bold;
  white-space: nowrap;
}

/* Rating bar */
.rating-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.rating-bar-track {
  display: inline-block;
  width: 60px;
  height: 8px;
  background: #ddd;
  border: 1px solid #aaa;
  border-radius: 2px;
  overflow: hidden;
  vertical-align: middle;
}
.rating-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #44cc44, #cccc00, #cc4400);
  border-radius: 2px;
}
.rating-val { font-size: 11px; min-width: 28px; }

/* Map icon link */
.map-icon {
  display: inline-block;
  padding: 2px 5px;
  background: #e0f0e0;
  border: 1px solid #888;
  border-radius: 2px;
  font-size: 11px;
  text-decoration: none;
  color: #005500;
}
.map-icon:hover { background: #c0e8c0; }

/* No data placeholder */
.td-empty { color: #aaa; font-style: italic; }

/* ----- Pagination --------------------------------------- */
.pagination {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 12px;
  align-items: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid #aaa;
  background: #fff;
  text-decoration: none;
  font-size: 12px;
  color: #000;
}
.pagination a:hover { background: #ffff99; border-color: #000; }
.pagination .current {
  background: #ffff00;
  border-color: #000;
  font-weight: bold;
}
.pagination .disabled { color: #aaa; cursor: default; }

/* ----- Detail page -------------------------------------- */
.detail-card {
  background: #fff;
  border: 1px solid #000;
  padding: 16px;
  max-width: 800px;
}
.detail-card h1 {
  font-size: 18px;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 12px;
}
/* Station screenshot */
.station-shot {
  margin-bottom: 14px;
  border: 1px solid #000;
  background: #111;
  display: inline-block;   /* shrink-wrap around the image */
  max-width: 100%;
  vertical-align: top;
}
.station-shot-img {
  display: block;
  max-width: 100%;
  max-height: 340px;
  width: auto;
  height: auto;
  cursor: pointer;
  transition: opacity 0.15s;
}
.station-shot-img:hover { opacity: 0.88; }
.station-shot-caption {
  background: #222;
  color: #ddd;
  font-size: 11px;
  padding: 4px 8px;
}
.station-shot-caption a { color: #aaddff; }

.detail-table { border-collapse: collapse; width: 100%; }
.detail-table th {
  text-align: left;
  background: #ccddcc;
  border: 1px solid #000;
  padding: 5px 10px;
  width: 180px;
  font-size: 12px;
}
.detail-table td {
  border: 1px solid #ccc;
  padding: 5px 10px;
  font-size: 13px;
}
.detail-map {
  margin-top: 16px;
  border: 1px solid #000;
}
.detail-map iframe {
  display: block;
  width: 100%;
  height: 300px;
  border: 0;
}
.detail-back {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 10px;
  background: #ffff99;
  border: 1px solid #000;
  text-decoration: none;
  color: #000;
  font-size: 12px;
}
.detail-back:hover { background: #ffff00; }

/* ----- Admin page --------------------------------------- */
.admin-section {
  background: #fff;
  border: 1px solid #000;
  padding: 14px;
  margin-bottom: 16px;
  max-width: 900px;
}
.admin-section h2 {
  font-size: 14px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 6px;
  margin-bottom: 10px;
}
.stat-grid {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stat-box {
  background: #ffff99;
  border: 1px solid #000;
  padding: 8px 14px;
  text-align: center;
  min-width: 120px;
}
.stat-box .stat-val { font-size: 22px; font-weight: bold; }
.stat-box .stat-lbl { font-size: 11px; color: #555; }
.stat-box-warn      { background: #ffddaa; border-color: #cc4400; }
.stat-box-warn .stat-val { color: #cc4400; }

.btn-primary {
  padding: 6px 16px;
  background: #ffff00;
  border: 2px solid #000;
  cursor: pointer;
  font-size: 13px;
  font-weight: bold;
}
.btn-primary:hover { background: #cccc00; }
.btn-danger {
  background: #ffcccc;
  border-color: #cc0000;
  color: #cc0000;
}
.btn-danger:hover { background: #ffaaaa; }

.log-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.log-table th {
  background: #ccddcc;
  border: 1px solid #000;
  padding: 4px 8px;
  text-align: left;
}
.log-table td { border: 1px solid #ccc; padding: 4px 8px; }
.log-table tr.status-failed td { background: #ffeeee; }
.log-table tr.status-success td { background: #eeffee; }
.log-table tr.status-running td { background: #ffffd0; }

.alert { padding: 8px 12px; margin-bottom: 10px; border: 1px solid; font-size: 12px; }
.alert-ok  { background: #ddffdd; border-color: #008800; color: #005500; }
.alert-err { background: #ffdddd; border-color: #cc0000; color: #880000; }

/* ----- Footer ------------------------------------------- */
.site-footer {
  background: #cccc88;
  border-top: 2px solid #000;
  padding: 8px 16px;
  text-align: center;
  font-size: 11px;
  color: #333;
}
.site-footer a { color: #000; }

/* ----- Responsive --------------------------------------- */
@media (max-width: 800px) {
  .page-wrap { flex-direction: column; }
  .filter-sidebar { width: 100%; position: static; }
  .station-table td.td-creator,
  .station-table th.th-creator { display: none; }
}
