/* =====================================================
   Tablica Odjazdów — Kiosk Departure Board
   ===================================================== */

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

:root {
    --bg:           #0d1e3d;
    --bg-header:    #091530;
    --bg-row-a:     #1a3060;
    --bg-row-b:     #152848;
    --bg-platform:  #0f2040;
    --gold:         #ffd700;
    --gold-dim:     #c9a900;
    --white:        #ffffff;
    --gray:         #8fa8c8;
    --delayed:      #ff5f5f;
    --on-time:      #4cd964;
    --font:         Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--white);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

/* ---- Board layout ---- */
#board {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* ---- Header ---- */
#board-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-header);
    padding: 10px 20px;
    border-bottom: 2px solid var(--gold);
    gap: 16px;
}

#title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 900;
    font-style: italic;
    color: var(--gold);
    letter-spacing: 1px;
    white-space: nowrap;
}

#station-label {
    flex: 1;
    text-align: center;
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: bold;
    color: var(--white);
    letter-spacing: 1px;
}

#clock {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---- Table ---- */
#departures-table {
    flex: 1;
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    overflow: hidden;
}

thead tr {
    background: var(--bg-header);
}

thead th {
    padding: 6px 10px;
    text-align: left;
    font-style: italic;
    color: var(--gold);
    font-size: clamp(0.65rem, 1vw, 0.85rem);
    border-bottom: 1px solid var(--gold-dim);
    white-space: nowrap;
    overflow: hidden;
}

thead th .lbl-pl {
    display: block;
    font-weight: 700;
}

thead th .lbl-en {
    display: block;
    font-weight: 400;
    opacity: 0.85;
}

/* Column widths — min-width gwarantuje czytelność też przy mniejszym oknie */
.col-time     { width: 8%;   min-width: 100px; text-align: center; }
.col-train    { width: 9%;   min-width: 95px;  text-align: center; }
.col-dest     { width: 18%;  min-width: 150px; }
.col-via      { /* reszta szerokości */ }
.col-platform { width: 7%;   min-width: 80px;  text-align: center; }

/* ---- Rows ---- */
tbody tr:nth-child(odd)  { background: var(--bg-row-a); }
tbody tr:nth-child(even) { background: var(--bg-row-b); }

tbody tr.departed {
    opacity: 0.45;
}

tbody tr.cancelled td.col-dest,
tbody tr.cancelled td.col-time {
    text-decoration: line-through;
    opacity: 0.6;
}

tbody td {
    padding: 8px 10px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    overflow: hidden;
}

/* ---- Time cell ---- */
td.col-time {
    text-align: center;
    white-space: nowrap;
}

.time-planned {
    display: block;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 900;
    line-height: 1.1;
    color: var(--white);
}

.time-real {
    display: block;
    font-size: clamp(0.85rem, 1.4vw, 1.1rem);
    font-weight: 700;
    color: var(--delayed);
    line-height: 1.1;
}

.delay-badge {
    display: inline-block;
    background: var(--delayed);
    color: #fff;
    font-size: 0.7em;
    padding: 1px 4px;
    border-radius: 3px;
    margin-left: 3px;
    vertical-align: middle;
}

/* ---- Train cell ---- */
td.col-train {
    text-align: center;
    white-space: nowrap;
}

.train-category {
    display: block;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    font-weight: 700;
    color: var(--gold);
    line-height: 1.2;
}

/* zachowana stara klasa dla wstecznej kompatybilności */
.train-name {
    display: block;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    font-weight: 700;
    color: var(--gold);
    line-height: 1.2;
}

.train-number {
    display: block;
    font-size: clamp(0.6rem, 1vw, 0.78rem);
    color: var(--gray);
    line-height: 1.2;
}

.train-carrier {
    display: block;
    font-size: clamp(0.55rem, 0.9vw, 0.72rem);
    color: var(--gray);
    opacity: 0.8;
    line-height: 1.1;
}

/* ---- Destination cell ---- */
td.col-dest {
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 700;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Via stations cell ---- */
td.col-via {
    font-size: clamp(0.72rem, 1.1vw, 0.9rem);
    color: var(--white);
    line-height: 1.3;
}

/* ---- Platform cell ---- */
td.col-platform {
    text-align: center;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    font-weight: 900;
    color: var(--white);
    border-left: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
}

.track-num {
    font-size: 0.55em;
    opacity: 0.7;
    white-space: nowrap;
}

/* ---- Status / messages ---- */
.msg-cell {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.1rem;
    color: var(--gray);
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,215,0,0.25);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

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

/* ---- Footer ---- */
#status-bar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-header);
    padding: 4px 14px;
    font-size: 0.72rem;
    color: var(--gray);
    border-top: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
}

#error-msg {
    color: var(--delayed);
    font-weight: 600;
}
