
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: #111827;
    color: #ffffff;
}

header {
    min-height: 74px;
    background: #111827;
    padding: 12px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    border-bottom: 1px solid #334155;
}

.brand h1 {
    margin: 0;
    font-size: 23px;
    color: #f8fafc;
}

.brand span {
    color: #94a3b8;
    font-size: 12px;
}

.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

button {
    background: #1e293b;
    border: 1px solid #475569;
    color: white;
    padding: 9px 14px;
    border-radius: 6px;
    cursor: pointer;
}

button:hover {
    background: #2563eb;
}

body {
    height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    position: relative;
    flex: 1;
    min-height: 0;
}

#map {
    position: absolute;
    width: 100%;
    height: 100%;
}

.info-panel {
    position: absolute;
    top: 15px;
    left: 15px;
    width: min(290px, calc(100% - 30px));
    padding: 18px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid #475569;
    border-radius: 10px;
    box-shadow: 0 4px 15px #00000030;
}

.info-panel h2 {
    font-size: 17px;
    margin-top: 0;
}

.info-panel p {
    font-size: 13px;
    color: #cbd5e1;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-dot {
    background: #94a3b8;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

hr {
    border: 0;
    border-top: 1px solid #334155;
    margin: 15px 0;
}

@media (max-width: 600px) {
    header {
        padding: 10px;
    }

    .brand h1 {
        font-size: 18px;
    }

    button {
        padding: 7px 9px;
        font-size: 11px;
    }

    .info-panel {
        width: 220px;
        padding: 12px;
    }
}

/* =========================================
   RailView Canada - V0.4
   Railway Explorer
   ========================================= */

.info-panel {
    width: min(330px, calc(100% - 30px));
    max-height: calc(100% - 30px);
    overflow-y: auto;
    z-index: 5;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.panel-heading h2 {
    margin: 0;
}

.version {
    background: #26374c;
    color: #94a3b8;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 11px;
}

.operator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    margin-bottom: 15px;
}

.operator-dot {
    width: 10px;
    height: 10px;
    background: #d6a72c;
    border-radius: 50%;
}

.statistics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.stat-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 7px;
    padding: 12px 5px;
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 6px;
}

.stat-card strong {
    color: #f8fafc;
    font-size: 22px;
}

.stat-card span {
    color: #94a3b8;
    font-size: 10px;
}

.info-panel h3 {
    font-size: 13px;
    margin: 0 0 12px;
    color: #e2e8f0;
}

#station-search {
    width: 100%;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 6px;
    color: #ffffff;
    padding: 11px;
    outline: none;
    font-size: 12px;
}

#station-search:focus {
    border-color: #60a5fa;
}

#search-results {
    max-height: 190px;
    overflow-y: auto;
}

.search-item {
    display: block;
    width: 100%;
    text-align: left;
    margin-top: 5px;
    padding: 9px;
    font-size: 12px;
    border: none;
    background: #1e293b;
}

.search-item:hover {
    background: #334155;
}

.layer-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 11px 0;
    font-size: 13px;
    color: #cbd5e1;
    cursor: pointer;
}

.layer-option input {
    accent-color: #d6a72c;
    width: 15px;
    height: 15px;
}

.data-source {
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.5;
}

.data-source p {
    margin: 5px 0;
    font-size: 11px;
}

.data-source a {
    color: #93c5fd;
    text-decoration: none;
}

.station-popup {
    color: #172033;
    min-width: 180px;
    padding: 5px;
}

.station-popup h3 {
    font-size: 16px;
    margin: 5px 0 12px;
}

.station-popup p {
    font-size: 12px;
    margin: 5px 0;
}

.maplibregl-popup-content {
    border-radius: 8px;
    padding: 15px;
}

.maplibregl-ctrl-attrib {
    font-size: 10px;
}

@media (max-width: 600px) {

    .info-panel {
        top: auto;
        bottom: 25px;
        left: 10px;
        width: calc(100% - 60px);
        max-height: 38%;
    }

    .stat-card strong {
        font-size: 18px;
    }

}

/* =========================================
   RailView Canada - V0.5
   Simulation Interface
   ========================================= */

.simulation-panel {
    margin-top: 12px;
}

.simulation-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.simulation-heading h3 {
    margin: 0;
}

.simulation-badge {
    background: #334155;
    color: #cbd5e1;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
}

.simulation-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #0b1220;
    border: 1px solid #334155;
    border-radius: 9px;
    padding: 16px 8px;
    margin: 14px 0;
}

#simulation-clock {
    font-size: 32px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    color: #60a5fa;
}

.simulation-clock small {
    color: #94a3b8;
    font-size: 10px;
}

.simulation-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
}

.simulation-modes button {
    font-size: 11px;
    padding: 9px 5px;
}

.simulation-modes button.active {
    background: #2563eb;
    border-color: #60a5fa;
}

.simulation-inputs {
    display: grid;
    grid-template-columns: 40px 1fr;
    align-items: center;
    gap: 7px;
}

.simulation-inputs label {
    font-size: 11px;
    color: #94a3b8;
}

.simulation-inputs input,
.speed-control select {
    min-width: 0;
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #475569;
    padding: 8px;
    border-radius: 5px;
    font-size: 12px;
    color-scheme: dark;
}

#apply-datetime {
    grid-column: 1 / -1;
    font-size: 11px;
}

.simulation-controls {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 12px;
}

.simulation-controls button {
    font-size: 10px;
    padding: 9px 3px;
}

.speed-control {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-top: 12px;
}

.speed-control select {
    width: 100px;
}

.train-counter {
    background: #142944;
    border: 1px solid #284b73;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 8px;
    margin: 15px 0;
}

.train-counter strong {
    font-size: 36px;
    color: #93c5fd;
    font-variant-numeric: tabular-nums;
}

.train-counter span {
    color: #cbd5e1;
    font-size: 11px;
    margin-top: 4px;
}

.simulation-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: #cbd5e1;
}

.legend-blue,
.legend-orange {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.legend-blue {
    background: #2563eb;
}

.legend-orange {
    background: #f59e0b;
}

.info-panel .simulation-disclaimer {
    font-size: 10px;
    color: #94a3b8;
    line-height: 1.5;
}

#simulation-message {
    font-size: 11px;
    color: #fbbf24;
}

.train-popup {
    min-width: 210px;
}

.train-popup .position-warning {
    background: #fff7ed;
    color: #92400e;
    padding: 8px;
    border-radius: 5px;
    margin-top: 12px;
    font-size: 10px;
}

button:disabled,
input:disabled,
select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 600px) {

    #simulation-clock {
        font-size: 25px;
    }

    .simulation-controls {
        grid-template-columns: repeat(2, 1fr);
    }

}
