/* TrainDispo – Design nach dem Original von TrainCompany (2012er Basis + Screenshots des aktuellen Spiels) */
@font-face { font-family: 'PTSans'; src: url('fonts/pt-sans-regular.woff') format('woff'); font-weight: normal; font-style: normal; }
@font-face { font-family: 'PTSans'; src: url('fonts/pt-sans-bold.woff') format('woff'); font-weight: bold; font-style: normal; }
@font-face { font-family: 'PTSans'; src: url('fonts/pt-sans-italic.woff') format('woff'); font-weight: normal; font-style: italic; }

:root {
  --page-bg: rgba(226, 172, 0, 0.8);         /* Ginstergelb (2012) */
  --page-ink: #1a1a1a;
  --bg-lines: 0.3;
  --container: #000;
  --card: #2f2f2f;
  --card-light: #5f5f5f;
  --ink: #f0f0f0;
  --muted: #a8a8a8;
  --line: #4a4a4a;
  --gold: #e2ac00;
  --green: #3ddc3d;
  --red: #ff3b3b;
  --link: #8f9bff;
  --input: #333;
  font-family: "PTSans", "Helvetica", sans-serif;
  font-size: 15px;
}
:root[data-design="dark"] {
  --page-bg: #121212;
  --page-ink: #d8d8d8;
  --bg-lines: 0.06;
}
* { box-sizing: border-box; }
html { background: #fff; }
body { margin: 0; min-height: 100vh; background-color: var(--page-bg); color: var(--ink); padding: 1px 0 20px; }
:root[data-design="dark"] body { background-color: #121212; }
:root[data-design="dark"] html { background: #121212; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.green { color: var(--green); }
.red { color: var(--red); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

#backgroundImg { z-index: -1; position: fixed; inset: 0; opacity: var(--bg-lines); overflow: hidden; pointer-events: none; }
#backgroundImg img { width: 100%; min-width: 1200px; }
:root[data-design="dark"] #backgroundImg img { filter: invert(1); }

/* Kopf */
#logoHead { margin: 18px auto 10px; font-size: 2.3em; color: var(--page-ink); text-shadow: 0 0 5px rgba(0,0,0,.5); text-align: center; }
:root[data-design="dark"] #logoHead { text-shadow: 0 0 6px rgba(226,172,0,.35); }
#naviContainer { width: fit-content; max-width: calc(100% - 20px); margin: 0 auto 14px; border-radius: 3px;
  background: linear-gradient(to bottom, #3e3e3e 0%, #4c4c4c 50%, #3e3e3e 100%); box-shadow: 0 0 5px rgba(0,0,0,.4); }
#naviContainer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; }
#naviContainer li { margin: 0 3px; min-width: 110px; text-align: center; border-left: dotted 1px #6b6b6b; border-right: dotted 1px #6b6b6b; }
#naviContainer li:first-child { border-left: none; }
#naviContainer li:last-child { border-right: none; }
#naviContainer a { display: block; padding: 5px 10px; color: #fff; text-decoration: none; transition: background-color .6s, color .6s; }
#naviContainer li:hover a, #naviContainer a.active { background: #fff; color: #000; }

#statusBlock { position: fixed; top: 0; right: 20px; z-index: 1200; color: #fff; padding: 3px 15px 5px; border-radius: 0 0 6px 6px;
  background: linear-gradient(to bottom, #3e3e3e 0%, #4c4c4c 50%, #3e3e3e 100%); box-shadow: 0 0 5px rgba(0,0,0,.65); font-size: 15px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; max-width: 420px; }
#statusBlock .ico { font-size: 14px; }
.status-btn { background: none; border: none; padding: 0 2px; cursor: pointer; font-size: 15px; position: relative; }
.badge { position: absolute; top: -4px; right: -8px; background: #d22929; color: #fff; border-radius: 8px; font-size: 10px; padding: 0 4px; font-weight: bold; }
#statusBlockBig { display: none; list-style: none; margin: 4px 0 0; padding: 0; width: 100%; font-size: 13px; }
#statusBlock:hover #statusBlockBig { display: block; }
#statusBlockBig li { border-top: 1px solid #6b6b6b; padding: 4px 0; color: #ddd; }

/* Hauptcontainer */
#mainContainer { background: var(--container); margin: 0 auto; width: calc(100% - 120px); max-width: 1900px; border-radius: 4px; box-shadow: 0 0 15px rgba(0,0,0,.65); min-height: 300px; padding: 14px 20px 20px; }
.loading { text-align: center; padding: 60px; color: var(--muted); }
#infoFoot { text-align: center; color: var(--page-ink); opacity: .7; font-size: 12px; margin-top: 10px; }
#infoFoot a { color: inherit; text-decoration: underline; }
.head-stats { text-align: center; margin: 0 0 12px; display: flex; gap: 26px; justify-content: center; flex-wrap: wrap; }
.head-stats b { font-weight: bold; }
.head-stats:empty { display: none; }
.page-cols { display: flex; gap: 22px; align-items: flex-start; }
#side { width: 285px; flex: none; position: sticky; top: 10px; }
#content { flex: 1; min-width: 0; }
#side h2 { font-size: 1.25em; margin: 14px 0 10px; }
#side p, #side li { color: #e6e6e6; line-height: 1.45; }
#side ul { padding-left: 22px; }
#side hr, .hr { border: none; border-top: 1px solid var(--line); margin: 10px 0; }
.side-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.side-row label { flex: 1; }
.side-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* Formulare */
input, select { background: var(--input); color: #eee; border: 1px solid #666; border-radius: 2px; padding: 3px 6px; }
input::placeholder { color: #888; }
input[type=search], .side-search { width: 100%; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: #fff; }
.tc-button { cursor: pointer; border: 1px solid #222; border-radius: 4px; padding: 4px 12px; color: #fff; background: linear-gradient(#6a6a6a, #484848); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.tc-button:hover:not(:disabled) { background: linear-gradient(#7a7a7a, #555); }
.tc-button:disabled { opacity: .45; cursor: not-allowed; }
.tc-button.go { background: linear-gradient(#2f8a3a, #1e6328); border-color: #134a1a; }
.tc-button.go:hover:not(:disabled) { background: linear-gradient(#37a043, #237030); }
.tc-button.small { padding: 2px 8px; font-size: 13px; }
.link-btn { background: none; border: none; color: var(--link); cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.info-i { display: inline-block; background: #2f6fd6; color: #fff; font-size: 11px; font-weight: bold; width: 15px; height: 15px; line-height: 15px; text-align: center; border-radius: 2px; vertical-align: 1px; margin-left: 4px; }
.Error { border: solid 1px #6f0202; background-color: #d22929; color: #fff; border-radius: 5px; margin: 10px 0; padding: 6px 8px; }
.Success { border: solid 1px #60e114; background-color: #036d2a; color: #fff; border-radius: 5px; margin: 8px auto 12px; padding: 6px 10px; max-width: 560px; }
.Notice { border: solid 1px #8a6a00; background-color: #5a4500; color: #fff; border-radius: 5px; margin: 8px 0; padding: 6px 8px; }

/* Anmeldung */
.auth { max-width: 460px; margin: 10px auto; }
.auth h2 { margin-top: 0; }
.auth-tabs { display: flex; gap: 6px; margin: 12px 0; }
.auth-tabs button { flex: 1; background: #222; border: 1px solid #444; padding: 6px; cursor: pointer; border-radius: 3px; }
.auth-tabs button.active { background: #fff; color: #000; }
#auth-form { display: flex; flex-direction: column; gap: 10px; }
#auth-form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }

/* Raster */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 560px), 1fr)); }
.grid.offers { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid.shop { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.grid.units { grid-template-columns: repeat(auto-fill, minmax(min(100%, 470px), 1fr)); align-items: stretch; }
.empty { color: var(--muted); padding: 20px 0; }

/* Zugfahrt-Karte */
.jcard { background: var(--card); position: relative; padding: 10px 10px 12px; min-height: 140px; }
.jcard .progress { position: absolute; top: 0; left: 0; height: 4px; background: var(--gold); }
.jcard .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.jcard h3 { font-size: 1em; margin: 0 0 8px; }
.jcard h3 a { color: var(--ink); }
.jcard p { margin: 0 0 10px; color: #e6e6e6; }
.jcard .money { display: flex; justify-content: space-between; margin: 6px 0; }
.jcard .line { margin: 6px 0; }
.jcard .right .top { text-align: right; margin-bottom: 4px; }
.jcard ul { margin: 4px 0; padding-left: 26px; max-height: 190px; overflow: auto; }
.jcard li { margin: 3px 0; list-style: circle; }
.deadline-neg { color: var(--red); }
.jcard.done { opacity: .92; }

/* Angebotskarte (Aufträge) */
.offer { background: var(--card); padding: 12px 14px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.offer h3 { margin: 0; font-size: 1.02em; }
.offer h3 a { color: var(--ink); }
.offer .quote { position: relative; padding: 10px 18px; color: #e6e6e6; }
.offer .quote::before, .offer .quote::after { position: absolute; font-size: 2.2em; color: #cfcfcf; font-family: Georgia, serif; line-height: 1; }
.offer .quote::before { content: '“'; left: 0; top: -2px; }
.offer .quote::after { content: '”'; right: 0; bottom: -12px; }
.offer .caps { font-size: 1.05em; }
.offer .facts { color: #e6e6e6; }
.offer .facts2 { color: var(--muted); font-size: .95em; }
.offer .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; }
.offer .reason { color: #ff8a80; font-size: .88em; text-align: right; }
.offer .with { color: var(--muted); font-size: .85em; }

/* Fahrzeuge */
.unit { background: var(--card-light); display: grid; grid-template-columns: 1fr 1.15fr; gap: 0; padding: 10px; position: relative; }
.unit.selected { outline: 2px solid var(--gold); }
.unit.busy { opacity: .92; }
.unit .vlist { padding-right: 12px; border-right: 1px dotted #222; }
.unit .vlist div { display: flex; align-items: baseline; gap: 6px; margin: 2px 0; }
.unit .vlist .vi { width: 20px; display: inline-block; text-align: center; }
.unit .vlist .wagon { color: #9d7cff; }
.unit .vlist i { color: #d0d0d0; }
.unit .specs { padding-left: 12px; line-height: 1.45; }
.unit .specs b { font-weight: bold; }
.unit .corner { display: flex; justify-content: flex-end; gap: 6px; align-items: center; font-size: .92em; margin: -2px 0 4px; text-align: right; }
.unit .unit-name { font-weight: bold; margin-bottom: 4px; display: block; }
.unit .err { color: #ffd0cc; font-size: .9em; margin-top: 6px; }
.flags { letter-spacing: 1px; }
.cc { font-size: .72em; vertical-align: 1px; color: #e6e6e6; margin: 0 1px; }

.shopcard { background: var(--card-light); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.shopcard .head { display: flex; justify-content: space-between; gap: 10px; }
.shopcard .head b { font-size: 1.02em; }
.shopcard .specs2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 12px; }
.shopcard .warn { color: #ff4d4d; }
.shopcard .qty { display: flex; justify-content: flex-end; align-items: center; gap: 6px; color: #d8d8d8; margin-top: auto; }
.shopcard .qty input { width: 56px; text-align: right; }

/* Karte */
.map-wrap { position: relative; background: #1e2a3a; margin-bottom: 0; }
.map-wrap .map { height: 520px; background: #1e2a3a; }
.map-wrap.tall .map { height: calc(100vh - 210px); min-height: 480px; }
.map-wrap.fullscreen { position: fixed; inset: 0; z-index: 3000; }
.map-wrap.fullscreen .map { height: 100vh; }
.tc-fullscreen { width: 34px; height: 34px; border: none; background: none; cursor: pointer; padding: 0; margin: 6px 0 0 4px; }
.tc-fullscreen span { display: block; width: 26px; height: 26px; margin: 4px; background: #1c7bd9; color: #fff; transform: rotate(45deg); border: 2px solid #fff; border-radius: 3px; font-size: 16px; line-height: 22px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.leaflet-container { font-family: inherit; background: #1e2a3a; }
.leaflet-bar a { background: #2f2f2f; color: #eee; border-bottom-color: #444; }
.leaflet-bar a:hover { background: #444; color: #fff; }
.leaflet-control-attribution { background: rgba(0,0,0,.6) !important; color: #aaa !important; font-size: 10px; }
.leaflet-control-attribution a { color: #ccc; }
.tc-popup .leaflet-popup-content-wrapper, .tc-popup .leaflet-popup-tip { background: #2f2f2f; color: #eee; }
.leaflet-tooltip.tc-tip { background: #2f2f2f; color: #eee; border-color: #555; }
.leaflet-tooltip-top.tc-tip:before { border-top-color: #2f2f2f; }

/* Zugfahrt-Details */
.detail-stats { display: flex; gap: 30px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.detail-cols { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.4fr); gap: 16px; align-items: start; }
.vbox { background: var(--card-light); padding: 10px 14px; }
.vbox div { margin: 3px 0; }
table.tt { width: 100%; border-collapse: collapse; background: #000; border: 1px solid #777; }
table.tt td { padding: 6px 10px; border-bottom: 3px solid #fff; vertical-align: top; }
table.tt tr.mid td { border-bottom: none; background: #5f5f5f; }
table.tt tr.passed td:first-child { box-shadow: inset 4px 0 0 #ff2a2a; }
table.tt tr.pass td { color: #c8c8c8; padding-top: 2px; padding-bottom: 2px; font-size: .95em; }
table.tt .act { margin-left: 6px; }
table.tt td.time { width: 120px; white-space: nowrap; }

/* Planer */
.planner h4 { margin: 14px 0 6px; color: #ddd; }
table.plan { width: 100%; border-collapse: collapse; }
table.plan th { text-align: left; color: var(--muted); font-weight: normal; border-bottom: 1px solid var(--line); padding: 4px; }
table.plan td { padding: 4px; border-bottom: 1px solid #262626; }
table.plan .r { text-align: right; }
table.plan input { width: 52px; text-align: right; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 3px 16px; background: #1b1b1b; padding: 10px 12px; margin: 10px 0; }
.totals .sum { font-weight: bold; border-top: 1px solid var(--line); padding-top: 4px; }
.waypoints { list-style: none; margin: 0; padding: 0; }
.waypoints li { display: flex; gap: 8px; align-items: center; padding: 2px 0; }
.waypoints .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff1a1a; border: 2px solid #ff1a1a; flex: none; }
.waypoints li.via .dot { background: transparent; }
.waypoints .wname { flex: 1; }
.autocomplete { position: relative; }
.autocomplete .list { position: absolute; z-index: 20; left: 0; right: 0; background: #2f2f2f; border: 1px solid #555; max-height: 240px; overflow: auto; }
.autocomplete .list div { padding: 4px 8px; cursor: pointer; }
.autocomplete .list div:hover { background: #444; }
.apply-box { background: #1b1b1b; padding: 10px 12px; margin-top: 10px; }
.apply-box ul { margin: 0 0 8px; padding-left: 18px; color: #ff8a80; }

/* Tabellen */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; background: #1b1b1b; color: #ddd; font-weight: normal; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 6px 8px; border-bottom: 1px solid #262626; }
table.list tr.me td { background: #2a2400; }
table.list .r { text-align: right; }

/* Benachrichtigungen */
.toasts { position: fixed; top: 44px; right: 20px; z-index: 2500; display: flex; flex-direction: column; gap: 8px; width: 520px; max-width: calc(100% - 40px); }
.noti { background: linear-gradient(#4a4a4a, #3c3c3c); color: #fff; border-radius: 4px; padding: 8px 34px 8px 12px; position: relative; box-shadow: 0 0 6px rgba(0,0,0,.6); animation: slide .25s ease-out; }
.noti .t { font-weight: bold; font-size: 1.05em; }
.noti .when { color: #bbb; font-size: .85em; margin-left: 8px; }
.noti .x { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 3px; border: 1px solid #999; background: #2a2a2a; color: #fff; cursor: pointer; line-height: 16px; padding: 0; font-size: 12px; }
.noti .text { margin-top: 2px; }
@keyframes slide { from { transform: translateY(-8px); opacity: 0; } }
.notif-panel { position: fixed; top: 44px; right: 20px; z-index: 2400; width: 520px; max-width: calc(100% - 40px); max-height: 75vh; overflow: auto; background: #000; border: 1px solid #555; border-radius: 4px; padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 0 15px rgba(0,0,0,.65); }

@media (max-width: 1000px) {
  #mainContainer { width: calc(100% - 16px); padding: 10px; }
  .page-cols { flex-direction: column; }
  #side { width: 100%; position: static; }
  .jcard .cols, .detail-cols, .unit { grid-template-columns: 1fr; }
  .unit .vlist { border-right: none; border-bottom: 1px dotted #222; padding-bottom: 8px; }
  .unit .specs { padding-left: 0; padding-top: 8px; }
  #statusBlock { right: 6px; }
}

/* Seite „Zugeinheit wählen“ */
.unit.dim { opacity: .55; }
.unit .pick-foot { grid-column: 1 / -1; margin-top: auto; padding-top: 8px; display: flex; justify-content: flex-end; }
.unit .pick-foot .reason { color: #ff8a80; font-size: .88em; text-align: right; }
.pl-unit { align-items: center; gap: 8px; }
.group-head { grid-column: 1 / -1; margin: 6px 0 -2px; font-size: 1.05em; }
ul.groups { list-style: none; padding: 0; margin: 4px 0 8px; }
ul.groups li { display: flex; justify-content: space-between; padding: 2px 0; }

#side.hidden { display: none; }
.backlink { margin: 0 0 8px; }
