* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background-color: #1a1a1a;
    color: #f0f0f0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: fit-content;
    margin: 0 auto;
    background-color: #2a2a2a;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Modern header */
.header {
    display: block;
    padding: 18px 20px;
    margin-bottom: 22px;
    border-radius: 8px;
    background: linear-gradient(180deg, rgb(255 255 255 / 8%), rgb(0 0 0 / 7%));
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.02);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 26px;
    color: #f6f6f6;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.title-wrap h1 {
    margin: 0;
    color: #f6f6f6;
    font-size: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-info {
    display: flex;
    gap: 12px;
    align-items: baseline;
    font-size: 13px;
    color: #bdbdbd;
}

.header-sub {
    color: #d0d0d0;
    font-weight: 600;
}


.header-divider {
    height: 1px;
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 2px;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.controls input,
.controls select,
.controls button {
    padding: 10px 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    border: 1px solid #444;
    background-color: #333;
    color: #f0f0f0;
    border-radius: 5px;
}

.controls input {
    flex: 1;
    min-width: 200px;
}

.controls button {
    background-color: #3b3b3b;
    color: #f6f6f6;
    cursor: pointer;
    transition: background-color 0.18s, box-shadow 0.18s;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.controls button:hover {
    background-color: #4a4a4a;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}



.error {
    background-color: #ff4444;
    color: white;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.stationboard {
    overflow-x: auto;
    margin-top: 8px;
    border-radius: 10px;
    padding: 8px;
}

table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 14px;
    max-width: 100%;
}

thead th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    user-select: none;
    position: relative;
    background: rgb(62, 62, 62);
}

thead th:hover {
    background: rgb(72, 72, 72);
}

thead th.sortable::after {
    content: ' ⇅';
    opacity: 0.3;
    font-size: 12px;
}

thead th.sort-asc::after {
    content: ' ▲';
    opacity: 1;
}

thead th.sort-desc::after {
    content: ' ▼';
    opacity: 1;
}

.filter-row th {
    padding: 0;
    background: rgba(255, 255, 255, 0.02);
}

/* Modernized filter selects to match site look-and-feel */
.filter-select {
    width: 100%;
    padding: 6px 30px 6px 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background-color: #222;
    color: #e6eef8;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23ffffff' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: box-shadow .12s, border-color .12s, background-color .12s;
}

.filter-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
    background-color: #222;
}

/* Small view toggle control styling */
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.view-toggle .toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    padding: 6px;
    border-radius: 8px;
    background: #2a2a2a;
    border: 1px solid rgba(255,255,255,0.03);
    color: #cfd6d8;
    cursor: pointer;
}

.view-toggle .toggle-btn svg { display: block; }

.view-toggle .toggle-btn.active {
    background: #3c3c3c;
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}



tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.18s, transform 0.12s;
    background: rgba(255, 255, 255, 0.01);
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.45);
}

tbody tr.hidden {
    display: none;
}

td {
    color: #e6eef8;
    vertical-align: middle;
}

th,
td {
    white-space: nowrap;
}

.status {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-icon {
    font-size: 16px;
}

.on-time {
    color: #4caf50;
}

.delayed-minor {
    color: #ff9800;
}

.delayed-major {
    color: #f44336;
}

.footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #444;
    color: #888;
    font-size: 12px;
}

.refresh-status {
    margin-top: 6px;
    color: #bdbdbd;
    font-size: 13px;
    display: inline-block;
}

/* Wenn das Element in den Controls steht: volle Zeile und rechtsbündig */
.controls .refresh-status {
    flex-basis: 100%;
    text-align: right;
}

.loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 13px;
    color: #bdbdbd;
    background: transparent;
}

.spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Custom sortable and filterable table implementation */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 6px;
}

.on-time .badge {
    background: rgba(76, 175, 80, 0.12);
    color: #4caf50;
}

.delayed-minor .badge {
    background: rgba(255, 152, 0, 0.10);
}

.delayed-major .badge {
    background: rgba(244, 67, 54, 0.08);
    color: #f44336;
}

/* Responsive tweaks (desktop/tablet) — mobile/card view is now toggleable via JS */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    table {
        font-size: 12px;
    }

    th,
    td {
        padding: 8px 4px;
        white-space: normal;
    }
}

/* Card view styles — applied when .card-view is present on .stationboard */
.stationboard.card-view {
    overflow-x: hidden;
}

.stationboard.card-view table,
.stationboard.card-view thead,
.stationboard.card-view tbody,
.stationboard.card-view th,
.stationboard.card-view td,
.stationboard.card-view tr {
    display: block;
}

.stationboard.card-view thead {
    display: none;
}

.stationboard.card-view tbody tr {
    display: block;
    margin: 10px 0;
    padding: 10px 12px;
    background: rgba(0,0,0,0.12);
    border-radius: 8px;
    box-shadow: none;
}

.stationboard.card-view td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 6px;
    border: none;
    white-space: normal;
    color: #d7d7d7;
}

.stationboard.card-view td::before {
    content: attr(data-label);
    color: #9aa0a3;
    flex: 1 1 auto;
    text-align: left;
    margin-right: 12px;
    font-size: 12px;
}

.stationboard.card-view td strong { font-weight: 600; }

.stationboard.card-view .status { justify-content: flex-end; }
