/* web/css/app/wl-monitor.css
   wlmonitor-specific styles. Not portable to other apps.
*/

/* ── Departure table ────────────────────────────────────────────────────────── */

.departure-table { table-layout: auto; width: 100%; }
.departure-table .badge-cell    { width: 2.8em; padding: 0.2em; vertical-align: middle; }
.departure-table .platform-cell { width: 2.2em; font-size: 0.7em; color: var(--color-muted); vertical-align: middle; }
.departure-table .towards-cell  { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.departure-table .times-cell    { white-space: nowrap; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 600; vertical-align: middle; padding-left: 0.5em; }
.departure-table td, .departure-table th {
  color: var(--color-text);
  border-color: var(--color-border);
}

/* ── Line badges ────────────────────────────────────────────────────────────── */

.line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4em; height: 2.4em;
  font-weight: 700;
  font-size: 0.7rem;
  color: #fff;
  line-height: 1;
}

/* ptTram — black circle; inverted in dark mode */
.line-badge.pt-tram { border-radius: 50%; background: #000; color: #fff; }
[data-theme="dark"] .line-badge.pt-tram { background: #fff; color: #000; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .line-badge.pt-tram { background: #fff; color: #000; }
}

/* ptBusRegion — black circle, yellow text */
.line-badge.pt-bus-region { border-radius: 50%; background: #000; color: #ffd700; }

/* ptMetro — square, per-line colour */
.line-badge.pt-metro     { border-radius: 5px; background: #666; }
.line-badge.pt-metro.U1  { background: #e2001a; }
.line-badge.pt-metro.U2  { background: #a762a3; }
.line-badge.pt-metro.U3  { background: #ec6725; }
.line-badge.pt-metro.U4  { background: #009540; }
.line-badge.pt-metro.U5  { background: #008f95; }
.line-badge.pt-metro.U6  { background: #9d6930; }

/* ptTrain — red square */
.line-badge.pt-train   { border-radius: 5px; background: #e2001a; }

/* ptTrainS — blue square */
.line-badge.pt-train-s { border-radius: 5px; background: #0000ff; }

/* ptBusCity — navy square */
.line-badge.pt-bus-city  { border-radius: 5px; background: #000080; }

/* ptBusNight — navy square, orange text */
.line-badge.pt-bus-night { border-radius: 5px; background: #000080; color: #ff8c00; }

/* ptTramWLB — blue square */
.line-badge.pt-tram-wlb  { border-radius: 5px; background: #0055a5; padding: 0.2em; }
.line-badge.pt-tram-wlb .wlb-logo {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* unknown type fallback */
.line-badge.pt-default { border-radius: 5px; background: #555; }

/* ── Station search dropdown ────────────────────────────────────────────────── */

.station-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  max-height: 60vh;
  overflow-y: auto;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
  z-index: 1055;
}
.station-dropdown-header {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background-color: var(--color-surface);
  z-index: 1;
}
.station-dropdown #stationList li p {
  padding: 0.35rem 0.75rem;
  margin: 0;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.station-dropdown #stationList li p:hover { background-color: var(--color-surface-alt); }

/* ── Brand logo icon ────────────────────────────────────────────────────────── */

.brand .brand-logo { width: 28px; height: 28px; }

/* ── Footer: three-column left / center / right ─────────────────────────────── */

.app-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.app-footer > *:first-child { text-align: left; }
.app-footer > *:nth-child(2) { text-align: center; }
.app-footer > *:last-child   { text-align: right; }

/* ── Station search inside .app-header ──────────────────────────────────────── */

.header-search {
  flex: 1;
  max-width: 280px;
  display: flex;
  align-items: center;
  position: relative;
}
.header-search .search-row {
  display: flex;
  gap: 4px;
  width: 100%;
  position: relative;
}
.header-search #s {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: 7px;
  color: var(--color-text);
  font-size: 0.85rem;
  font-family: inherit;
}
.header-search #s::placeholder { color: var(--color-muted); }
.header-search #s:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 25%, transparent);
}
.header-search .btn-icon {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 7px;
  color: var(--color-muted);
  cursor: pointer;
  padding: 4px 7px;
  display: flex;
  align-items: center;
  line-height: 1;
  transition: background .15s, color .15s;
}
.header-search .btn-icon:hover { background: var(--color-surface-alt); color: var(--color-text); }

/* ── Sort buttons in station dropdown (replaces Bootstrap .btn-check) ─────────── */

.sort-btn-group {
  display: flex;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--color-border);
}
.sort-btn-group input[type="radio"] { display: none; }
.sort-btn-group label {
  flex: 1;
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  cursor: pointer;
  background: var(--color-surface);
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}
.sort-btn-group label:not(:last-child) { border-right: 1px solid var(--color-border); }
.sort-btn-group input[type="radio"]:checked + label {
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-weight: 600;
}

/* ── Misc app elements ──────────────────────────────────────────────────────── */

#topBtn {
  position: fixed;
  bottom: 70px;
  right: 20px;
  z-index: 99;
  display: none;
}

/* Reserve space for fixed .app-header / .app-footer via the custom properties
   declared on :root in shared layout.css (rule §12/§12a/§13). */
body {
  padding-top:    var(--app-header-height);
  padding-bottom: var(--app-footer-height);
}

#stationList { cursor: default; }

/* ── Monitor card colors ─────────────────────────────────────────────────────── */

#monitor .card {
  background-color: #f4f7f4;
}
#monitor .card-header {
  background-color: #404d40;
  color: #e8ede8;
  border-bottom-color: #303d30;
}

[data-theme="dark"] #monitor .card {
  background-color: #141814;
}
[data-theme="dark"] #monitor .card-header {
  background-color: #2a342a;
  color: #cdd5cd;
  border-bottom-color: #1e281e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #monitor .card {
    background-color: #141814;
  }
  :root:not([data-theme="light"]) #monitor .card-header {
    background-color: #2a342a;
    color: #cdd5cd;
    border-bottom-color: #1e281e;
  }
}

#monitorUpdateTime {
  font-size: 8pt;
  color: var(--color-muted);
  text-align: end;
  margin-top: 0.25rem;
  padding: 0 0.25rem;
}

/* ── Per-card "+" button in card header ──────────────────────────────────────── */

#monitor .btn-add-steig {
  opacity: .3;
  transition: opacity .15s, background .15s;
  background: none;
  border: none;
  color: #e8ede8; /* matches header text */
  padding: 0 .2rem;
  border-radius: var(--radius-sm);
}
#monitor .card-header:hover .btn-add-steig,
#monitor .btn-add-steig:hover,
#monitor .btn-add-steig:focus {
  opacity: 1;
  background: rgba(255,255,255,.18);
}

[data-theme="dark"] #monitor .btn-add-steig { color: #cdd5cd; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #monitor .btn-add-steig { color: #cdd5cd; }
}

/* ── Admin page ─────────────────────────────────────────────────────────────── */

.admin-page { margin-top: var(--space-5); }

/* Tabs, tab-btn, tab-panel, and card-header-split are provided by the shared
   components.css library (Rule §15.4) — do not redeclare them here. */

/* Color table: show outline + solid preview side by side, fixed width so all
   preview buttons align regardless of label text. */
.admin-page .color-table td,
.admin-page .color-table th { vertical-align: middle; }
.admin-page .color-table code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  color: var(--color-muted);
}
.admin-page .color-table .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6.5rem;
  margin-right: var(--space-1);
}

.admin-page .user-filter-form {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.admin-page .user-filter-form .form-control { max-width: 16rem; }

.admin-page .ogd-log {
  margin-top: var(--space-3);
  padding: var(--space-2);
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.admin-page .ogd-log pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.admin-page .text-right { text-align: right; }
