:root {
    --sbb-red:    #eb0000;
    --sbb-blue:   #2d327d;
	--sbb-orange: #E84E10;
    --sob-green:  #7BA55B;
    --sob-blue:   #1A527F;
    --board-bg:   #0a1a4a;
    --board-row:  #0d2060;
    --board-alt:  #0a1a4a;
    --board-head: #0d2060;
    --text-main:  #ffffff;
    --text-via:   #a0b8d8;
    --text-dim:   #6080a0;
    --night-gold: #d4af37;
    --border:     rgba(200,200,200,0.09);
    --header-bg:  #061030;
    --pifas-bg:   #ED702D;
    --pifas-searchbar: #d7d7d7;
    --pifas-timenav: #eef;
    --live-red:   #ff3b30;
	--plat-change:#fcbb00;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
	scrollbar-gutter: stable;
}
body {
    font-family: "SBB Web", "Helvetica Neue", Arial, sans-serif;
    background: var(--board-bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* HEADER */
#app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 10px;
    flex-wrap: wrap;
}

#header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#btn-home {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 5px 10px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 1.1em;
    line-height: 1;
    transition: background 0.15s;
}
#btn-home:hover { background: rgba(255,255,255,0.22); }

#app-title,
#app-title a {
    color: white;
    font-size: 1.05em;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    text-decoration: none;
}

#header-center {
    flex: 1;
    text-align: center;
}
#live-clock {
    font-family: monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 1px;
    color: var(--text-main);
}


#header-right {
    display: flex;
    gap: 7px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}



/*#stop-input {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 6px 10px;
    border-radius: 2px;
    font-size: 0.9em;
    width: 100%;
}*/

#stop-input {
	width: 100%;
	padding: 10px;
	box-sizing:
	border-box;
	border: 1px solid #888;
	font-size: 16px;
	border-radius: 4px;
}


#stop-input::placeholder { color: rgba(255,255,255,0.35); }
#stop-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.5);
}

/* Autocomplete-Dropdown */
#stop-dropdown {
    position: absolute;
    top: 125px;
	padding: 10px 0;
	left: 10px;
	right: 10px;
    min-width: 90%;
    background: var(--board-bg);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 2px;
    list-style: none;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    max-height: 260px;
    overflow-y: auto;
}
#stop-dropdown.hidden { display: none; }
#stop-dropdown li {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.9em;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
#stop-dropdown li:last-child { border-bottom: none; }
#stop-dropdown li:hover { background: rgba(255,255,255,0.1); }
.dd-id {
    font-size: 0.78em;
    color: var(--text-dim);
    font-family: monospace;
    flex-shrink: 0;
}

/* Datum + Zeit Picker */

/* Stop-Suche */
#stop-search-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.00);
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0);
}

#btn-add-fav {
    background: var(--night-gold);
    border: 1px solid rgba(255,255,255,0);
    padding: 9px 9px;
    border-radius: 4px;
    transition: background 0.2s;
}

#btn-add-fav:hover {
    background: var(--sbb-red);
}

#datetime-picker {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 4px;
}


#date-input,
#time-input {
    outline: none;
	border-radius: 4px;
	flex: auto;
    padding: 8px;
	width: 30%;
	border: 1px solid #888;
	font-size: 10px;
	border-radius: 4px;
	background: white; cursor: pointer;
}

#btn-datetime-clear {
    background: #444;
    border: 1px solid #444;
	border-radius: 4px;
    color: var(--text-main);
    padding: 8px;
	width: 25%;
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1;
    transition: background 0.15s;
	font-weight: bold;
}

#btn-datetime-clear:hover {
	background: var(--sob-green);
}

/* Refresh-Button */
#btn-refresh {
    background: var(--sbb-red);
    border: 1px solid var(--sbb-red);
    color: white;
	font-weight: bold;
    padding: 8px;
	width: 25%;
	flex: auto;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
#btn-refresh:hover {
	background: var(--sbb-blue);
	border: 1px solid var(--sbb-blue);
}

/*  FAVORITENLEISTE  */
#fav-bar {
    display: flex;
    gap: 6px;
    padding: 4px 14px;
    background: #07163a;
    overflow-x: auto;
    position: sticky;
    top: 46px;
    z-index: 15;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}
#fav-bar::-webkit-scrollbar { display: none; }


.fav-btn {
    background: rgba(255,255,255,0.08);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.13);
    padding: 5px 13px;
    border-radius: 2px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.84em;
    letter-spacing: 0.02em;
    transition: background 0.15s;
    flex-shrink: 0;
}
.fav-btn:hover { background: rgba(255,255,255,0.18); }
.fav-btn.active {
    background: var(--sbb-red);
    border-color: var(--sbb-red);
    color: white;
}
.fav-btn[data-confirm="true"] {
    animation: pulse-red 1s infinite;
    color: white !important;
    border-color: #ff4d4d !important;
}

/*@media screen and (max-width: 440px) {
	#fav-bar {
		gap: 2px;
		font-size: .7em;
		padding: 1px 14px;
	}
	.fav-btn {
		background: rgba(255,255,255,0.08);
    	color: var(--text-main);
    	border: 1px solid rgba(255,255,255,0.13);
    	padding: 3px 6px;
	}
}
*/

@keyframes pulse-red {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* FILTERLEISTE */
#filter-bar {
    display: flex;
    align-items: center;
    gap: 5px;
	padding: 8px 14px;
    background: #081540;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;

    gap: 10px;
    flex-wrap: wrap;
}
}
#filter-bar::-webkit-scrollbar { display: none; }

.filter-label {
    font-size: 0.75em;
    color: var(--text-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 4px;
    flex-shrink: 0;
}

.filter-btn {
    background: rgba(255,255,255,0.07);
    color: var(--text-via);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 4px 11px;
    border-radius: 2px;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.78em;
    letter-spacing: 0.02em;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.filter-btn:hover { background: rgba(255,255,255,0.14); color: white; }
.filter-btn.active {
    background: rgba(255,255,255,0.22);
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.time-controls {
    background: var(--pifas-timenav);
	display: flex;
	justify-content: center;
	border: 1px solic #ccc;
	margin: 10px 0px;
}

.time-controls button {
	width: 100%;
	padding: 7px;
	border:none;
	background: transparent;
	font-size: 14px;
	font-weight: bold;
	color: var(--sbb-blue);
	cursor: pointer;
}
/*  STATUS  */
#status-message {
    padding: 4px 14px;
    font-size: 0.73em;
    color: var(--text-dim);
    min-height: 20px;
    letter-spacing: 0.03em;
}
.status-error { color: var(--sbb-red) !important; }
.status-info  { color: var(--text-via) !important; }

/* TABELLE */
.departure-table {
    width: 100%;
    border-collapse: collapse;
}

.departure-table thead tr {
    background: var(--board-head);
    border-bottom: 2px solid rgba(255,255,255,0.15);
}

.departure-table thead th {
    padding: 10px 14px;
    font-size: 0.6em;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    text-align: left;
}
.th-platform { text-align: right !important; }


.departure-table tbody tr {
    border-bottom: 2px solid var(--border);
}

.dep-row.row-odd {
    background: var(--board-row);
}

.dep-row.row-even {
    background: var(--board-alt);
}

.departure-table tbody .dep-row:hover { 
    background: #1a3a7a !important; 
}



.departure-table tbody tr:hover { background: #1a3a7a; }

.departure-table td {
    padding: 2px 8px;
    vertical-align: middle;
}

/* Zeitspalte */
.col-time { width: 55px; white-space: nowrap; }
.time { font-weight: 400; font-size: 1.1em; letter-spacing: 0.02em; }
.delay-badge {
    display: inline-block;
    font-size: 0.74em;
    color: var(--sbb-red);
    font-weight: 400;
    vertical-align: baseline;
}

/* Produktspalte */
.col-line {
	width: 50px;
	text-align: center;
	vertical-align: middle; }
.line-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.line-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-weight: 500;
    font-size: 0.88em;
    letter-spacing: 0.01em;
    background: #445;
    color: white;
    min-width: 44px;
    text-align: center;
    border: 1px solid #000;
    font-style: normal;
}
/* Fernverkehr â€“ rot */
.line-badge[data-type="ICE"], .line-badge[data-type="EXT"] { background: var(--sbb-red); font-style: italic; font-weight: 400;}
.line-badge[data-type="IC"],
.line-badge[data-type="IR"],
.line-badge[data-type="NJ"],
.line-badge[data-type="EN"]  { background: var(--sbb-red); }
.line-badge[data-type="EC"]  { background: var(--sbb-red); font-style: italic; }
.line-badge[data-type="TGV"] { background: var(--sbb-red); font-style: italic; }
.line-badge[data-type="RJ"]  { background: var(--sbb-red); }
.line-badge[data-type="RJX"] { background: var(--sbb-red); }

.line-badge[data-type="VAE"] { background: var(--sob-blue); color: var(--sob-green); }

.line-badge[data-type="PE"] { background: var(--sbb-red); font-style: italic; }
.line-badge[data-type="LIX"],
.line-badge[data-type="IRLEX"],
.line-badge[data-type="IRLIX"],
.line-badge[data-type="GPX"] { background: var(--sbb-red); font-style: italic; }
/* Regional â€“ weiss/rot */
.line-badge[data-type="RE"],
.line-badge[data-type="IRE"] { background: white; color: var(--sbb-red); }
/* S-Bahn â€“ weiss/schwarz */
.line-badge[data-type="S"],
.line-badge[data-type="R"],
.line-badge[data-type="RB"],
.line-badge[data-type="TER"],
.line-badge[data-type="CC"] { background: white; color: black; }
/* Nahverkehr */
.line-badge[data-type="T"],
.line-badge[data-type="BP"],
.line-badge[data-type="EXB"],
.line-badge[data-type="B"] { background-color: var(--sbb-blue); color: white }
.line-badge[data-type="EV"] { background-color: var(--sbb-orange); color: #000; }
.line-badge[data-type="M"] { background-color: #005198; color: #fff }
/* Nacht */
.line-badge[data-type="SN"]  { border: 1px solid #000; background-color: #000; color: #fcbb00; }
.line-badge[data-type="BN"] { border: 1px solid #fcbb00; background-color: #000; color: #fff; }
.line-badge[data-type="N"]   { background: #000; color: var(--night-gold); border: 1px solid var(--night-gold); }
/* Schiff */
.line-badge[data-type="BAT"],
.line-badge[data-type="FAE"] { background: #1a6ea8; }
/* Bergbahn */
.line-badge[data-type="FUN"],
.line-badge[data-type="ASC"],
.line-badge[data-type="GB"]  { background: #7f7d32; }
.line-badge[data-type="PB"]  { background: #2e7d32; }

.journey-num, .journey-num a {
    font-size: 0.78em;
    color: var(--text-dim);
    font-family: monospace;
    text-align: center;
    letter-spacing: 0.04em;
	text-decoration: none;
}

/* Zielspalte */
.destination {
	font-weight: 400;
	font-size: 1em;
}
.via { font-size: 0.65em;
	  color: var(--text-via);
	  letter-spacing: 0.005em;
}
.station-hint {
	font-size: 0.5em;
	color: var(--text-via);
	margin-top: 2px;
	font-style: italic;
}

/* Gleisspalte */
.col-platform {
	width: 90px;
	text-align: right;
	font-weight: 400;
	font-size: 1em;
	padding-right: 18px; }
.plat-change {
    background: var(--plat-change) !important;
    color: #000 !important;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 2px;
    display: inline-block;
}

/* Aktive Zeile */
.dep-row { cursor: pointer; }
.dep-row.active { background: #1a3a7a !important; }

/*  PERLSCHNUR */
.chain-row { background: #07163a !important; }

.chain {
    display: flex;
    flex-direction: column;
    padding: 8px 16px 4px;
}

.chain-stop {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/*  Dot-Spalte  */
.chain-dot-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 18px;
    flex-shrink: 0;
}

/* Wrapper für Dot + eventuellen roten Live-Punkt an der Station */
.chain-dot-wrapper {
    position: relative;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chain-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.28);
    flex-shrink: 0;
}
.dot-current {
    background: white;
    width: 13px;
    height: 13px;
    box-shadow: 0 0 6px rgba(255,255,255,0.55);
}

/* Roter Live-Punkt an einer Station */
.dot-train-live {
    position: absolute;
    top: 4.77px;
    right: 4.77px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--live-red);
    border: 1.5px solid #07163a;
    box-shadow: 0 0 6px rgba(255, 59, 48, 0.8), 0 0 12px rgba(255, 59, 48, 0.4);
    animation: pulse-live 1.6s ease-in-out infinite;
    z-index: 2;
}

/* â”€â”€â”€ Linie zwischen zwei Stationen â”€â”€â”€ */
.chain-line-wrapper {
    position: relative;
    width: 2px;
    flex: 1;
    min-height: 18px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chain-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255,255,255,0.13);
}

/* Roter Live-Punkt unterwegs (mittig auf der Linie) */
.dot-train-between {
    position: absolute;
    top: 50%;
    left: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--live-red);
    border: 1.5px solid #07163a;
    box-shadow: 0 0 7px rgba(255, 59, 48, 0.9), 0 0 14px rgba(255, 59, 48, 0.4);
    animation: pulse-live 1.6s ease-in-out infinite;
    z-index: 2;
    margin-left: -4.5px;
    margin-top: -4.5px;
}

@keyframes pulse-live {
    0%   { box-shadow: 0 0 4px rgba(255, 59, 48, 0.9), 0 0 8px rgba(255, 59, 48, 0.4); }
    50%  { box-shadow: 0 0 9px rgba(255, 59, 48, 1),   0 0 18px rgba(255, 59, 48, 0.6); }
    100% { box-shadow: 0 0 4px rgba(255, 59, 48, 0.9), 0 0 8px rgba(255, 59, 48, 0.4); }
}

/* â”€â”€â”€ Zeitspalte in der Perlschnur â”€â”€â”€ */
.chain-times {
    width: 68px;
    flex-shrink: 0;
    font-size: 1em;
    color: var(--text-via);
    padding-top: 2px;
    line-height: 1.55;
}
.time-row {
    display: flex;
    align-items: baseline;
    white-space: nowrap;
    gap: 5px;
    font-size: 0.9em;
}
.time-row .label {
    color: var(--text-dim);
    font-size: 0.8em;
    flex-shrink: 0;
    width: 14px;
}

/* VerspÃ¤tete Zeit in der Perlschnur */
.time-delayed {
    color: var(--sbb-red);
    font-weight: 600;
}

/* VerspÃ¤tungs-Badge in der Perlschnur */
.chain-delay {
    font-size: 0.82em;
    color: var(--sbb-red);
    font-weight: 600;
    margin-left: -1px;
    letter-spacing: 0;
}

/* â”€â”€â”€ Info-Spalte â”€â”€â”€ */
.chain-info {
    display: flex;
    flex-direction: column;
    padding-bottom: 10px;
    margin-left: 1px;
    flex: 1;
}
.chain-name {
    font-size: 1em;
    font-weight: 200;
    color: white;
}
.chain-platform {
    font-size: 0.83em;
    color: var(--text-dim);
    margin-top: 1px;
}
.chain-current .chain-name { font-weight: 700; }

/* Klickbare Halte */
.chain-clickable { cursor: pointer; transition: background 0.12s; }
.chain-clickable .chain-name { text-decoration: none; }
.chain-clickable:hover .chain-name { color: var(--sob-green); }

.chain-empty {
    color: rgba(255,255,255,0.3);
    font-size: 0.83em;
    padding: 8px 16px;
}

/* JourneyRef & Betreiber-Footer */
.chain-meta-footer {
    padding: 8px 16px 12px;
    font-size: 0.72em;
    color: var(--text-dim);
    font-family: monospace;
    letter-spacing: 0.02em;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: 4px;
    word-break: break-all;
    line-height: 1.6;
}
.meta-journeyref { color: rgba(255,255,255,0.45); }
.meta-sep        { color: rgba(255,255,255,0.2); margin: 0 4px; }
.meta-operator   { color: var(--text-via); }

/* Sonstiges */
.empty {
    color: rgba(255,255,255,0.3);
    text-align: center;
    padding: 40px 20px;
    font-size: 0.9em;
}

.sit-info-popup {
	display: none;
	position: absolute;
	z-index: 100;
	background: white;
	color: black;
	border: 2px solid #e60000;
	padding: 6px;
	border-radius: 6px;
	width: flex;
	left: -200px;
	top: 50px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	font-size: 0.85em;
	white-space: normal;"
}

.page-footer {
	text-decoration: none;
	padding: 8px 14px;
	margin-top: auto;
	border-top: 1px solid var(--border);
	background: var(--header-bg);
}

.page-footer a, a:hover, a:visited, a:active {
	color: var(--sbb-red);
	text-decoration: none;
 }