/* ============================================================
   BNMC Demo — Global Styles
   ============================================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    color: #ddd;
}

#cesiumContainer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* UI chrome font/size scale. The Settings slider sets --ui-scale (default 2x);
   applied via `zoom` so each panel grows with its text. The Cesium canvas is
   deliberately excluded so the globe isn't magnified. */
:root { --ui-scale: 2; }
#topToolbar,
#btnZoomBuffalo,
#configPanel,
#controlPanel,
#playbackControls {
    zoom: var(--ui-scale);
}

/* University at Buffalo logo, bottom-center. It's the white variant, so it sits
   on a subtle dark pill to stay legible over light map imagery. Not scaled by
   --ui-scale. z-index below the panels (100), so the playback controls (also
   bottom-center, shown during results) take precedence over it. */
#siteLogo {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    height: 34px;
    width: auto;
    max-width: 90vw;
    padding: 5px 12px;
    background: rgba(10, 12, 18, 0.45);
    border-radius: 6px;
    z-index: 95;
    pointer-events: none;
}

/* Crosshair cursor during pick modes */
body.picking-mode #cesiumContainer {
    cursor: crosshair;
}

/* ============================================================
   Shared panel base
   ============================================================ */

.panel {
    position: absolute;
    background: rgba(20, 20, 30, 0.92);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 10px;
    color: #ddd;
    user-select: none;
    z-index: 100;
}

.panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #aac4e0;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.step-badge {
    display: block;        /* own line under the title so it's never clipped */
    margin-top: 3px;
    font-size: 10px;
    font-weight: 500;
    color: #80c8ff;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* ============================================================
   Top Toolbar: Settings + Zoom to Buffalo (top-left)
   ============================================================ */

#topToolbar {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    display: flex;
    gap: 10px;
}

.toolbar-btn {
    background: rgba(20, 20, 30, 0.92);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    padding: 6px 12px;
    color: #aac4e0;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Segoe UI', Arial, sans-serif;
    letter-spacing: 0.03em;
    transition: background 0.15s;
    white-space: nowrap;
}

.toolbar-btn:hover {
    background: rgba(40, 50, 70, 0.95);
}

#configPanel {
    display: none;
    top: 44px;
    left: 12px;
    width: 200px;
    z-index: 200;   /* sit above #controlPanel so an open Settings isn't covered */
}

#configPanel.visible {
    display: block;
}

.config-section-label {
    display: block;
    font-size: 10px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
    margin-top: 4px;
}

#imagerySelect {
    width: 100%;
    background: #2a3a50;
    color: #cce0ff;
    border: 1px solid #3a5070;
    border-radius: 4px;
    padding: 5px 6px;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 8px;
}

.config-row {
    margin-top: 4px;
}

.config-check-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #cce0ff;
    cursor: pointer;
    padding: 3px 0;
}

.config-check-label input[type="checkbox"] {
    accent-color: #80c8ff;
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ============================================================
   Control Panel (top-right)
   ============================================================ */

#controlPanel {
    top: 58px;   /* clears the Settings button above it */
    left: 12px;
    width: 260px;
}

#controlPanelBody {
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.25s ease;
    max-height: min(900px, calc(100vh - 90px));
}

#controlPanelBody.collapsed {
    max-height: 0;
}

.panel-title-text {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;   /* let the full title wrap instead of truncating */
    line-height: 1.25;
}

.panel-toggle-btn {
    background: none;
    border: none;
    color: #aac4e0;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}

/* Zoom to Buffalo (bottom-right corner) */
#btnZoomBuffalo {
    position: absolute;
    bottom: 8px;
    right: 12px;
    z-index: 100;
}

/* Simulated-time readout on the playback timeline */
.sim-time {
    font-size: 11px;
    color: #aac4e0;
    font-variant-numeric: tabular-nums;
    min-width: 62px;
    text-align: center;
    white-space: nowrap;
}

.btn {
    display: block;
    width: 100%;
    padding: 7px 10px;
    margin-bottom: 6px;
    background: #2a3a50;
    color: #cce0ff;
    border: 1px solid #3a5070;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    transition: background 0.15s, opacity 0.15s;
}

.btn:hover:not(:disabled) {
    background: #3a5070;
}

.btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.btn-analyze {
    background: #1a3d6e;
    border-color: #2a5da0;
    color: #80c8ff;
    margin-top: 4px;
}
.btn-analyze:hover:not(:disabled) {
    background: #2a5090;
}

.btn-new {
    background: #3d2a0a;
    border-color: #7a5a18;
    color: #f0d080;
}
.btn-new:hover:not(:disabled) {
    background: #5a3e10;
}

.btn-cancel {
    background: #3d1a1a;
    border-color: #7a2a2a;
    color: #f08080;
}
.btn-cancel:hover:not(:disabled) {
    background: #5a2020;
}

.btn-done {
    background: #1a3d1a;
    border-color: #2a6a2a;
    color: #80e080;
}
.btn-done:hover:not(:disabled) {
    background: #2a5a2a;
}

/* Two-button rows (Cancel/Back + Done/Next, and Back + Continue) */
#pickModeButtons,
#continueRow {
    display: none;
    gap: 6px;
    margin-bottom: 6px;
}

#pickModeButtons.visible,
#continueRow.visible {
    display: flex;
}

#pickModeButtons .btn,
#continueRow .btn {
    flex: 1;
    margin: 0;
}

/* Status / info message */
#statusMsg {
    font-size: 11px;
    color: #f0c080;
    min-height: 16px;
    margin-bottom: 6px;
    text-align: center;
    white-space: normal;
    line-height: 1.4;
}

/* "Waiting for the facilitator…" caption under a gated advance button */
#gateWaiting {
    font-size: 11px;
    color: #8a97a8;
    font-style: italic;
    text-align: center;
    margin-top: 8px;
    letter-spacing: 0.02em;
}

/* Loading spinner text */
#analyzeSpinner {
    display: none;
    font-size: 11px;
    color: #80c8ff;
    text-align: center;
    margin-bottom: 6px;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ============================================================
   Playback Controls (bottom-center)
   ============================================================ */

#playbackControls {
    display: none;
    bottom: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    max-width: calc(100vw - 24px);
    padding: 10px 14px;
}

#playbackControls.visible {
    display: block;
}

.playback-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;      /* keep controls inside the panel instead of overflowing */
    gap: 8px;
    margin-bottom: 8px;
}

.playback-row:last-child {
    margin-bottom: 0;
}

/* Playback buttons must NOT be full-width — override .btn base rule */
.playback-row .btn {
    width: auto;
    display: inline-block;
    margin-bottom: 0;
    flex-shrink: 0;
    white-space: nowrap;   /* never wrap to a 2nd line (kept buttons uneven height) */
}

.btn-play {
    min-width: 64px;
    padding: 6px 10px;
}

.btn-restart {
    min-width: 64px;
    padding: 6px 10px;
}

.scrubber-label {
    font-size: 10px;
    color: #666;
    flex-shrink: 0;
    white-space: nowrap;
}

#scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: #3a5070;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #80c8ff;
    cursor: pointer;
}

#scrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #80c8ff;
    cursor: pointer;
    border: none;
}

.speed-label {
    font-size: 11px;
    color: #888;
    flex-shrink: 0;
}

#speedSelect {
    background: #2a3a50;
    color: #cce0ff;
    border: 1px solid #3a5070;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Camera buttons */
.camera-buttons {
    display: flex;
    gap: 6px;
    flex: 1;
}

.btn-cam {
    flex: 1;
    margin-bottom: 0;
    padding: 5px 8px;
    font-size: 11px;
    background: #2a2a3a;
    border-color: #4a4a6a;
    color: #c0c0e0;
}

.btn-cam.active {
    background: #2a3d6e;
    border-color: #4a6da0;
    color: #80c8ff;
}

.btn-cam:hover:not(:disabled) {
    background: #3a3a5a;
}

/* ============================================================
   Results walkthrough (mode-by-mode reveal, inside #controlPanel)
   ============================================================ */

#resultSection {
    display: none;
    margin-top: 4px;
}

.result-mode-row {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.result-mode-row:first-child {
    padding-top: 0;
}

.result-mode-row-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-mode-row-head input[type="checkbox"] {
    accent-color: #80c8ff;
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

.result-mode-icon {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
}

.result-mode-label {
    flex: 1;
    font-weight: 600;
    font-size: 12px;
    color: #e0e0e0;
}

.result-mode-swatch {
    width: 22px;
    height: 4px;
    border-radius: 2px;
    flex-shrink: 0;
}

.result-mode-row-times {
    display: flex;
    gap: 16px;
    margin-top: 4px;
    padding-left: 28px;
}

.result-time-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.result-time-value {
    font-size: 12px;
    color: #e0e0e0;
    font-weight: 500;
}

/* Public Transit four-phase journey */
.pt-timeline {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 4px 6px;
    margin-top: 6px;
    padding-left: 28px;
}

.pt-phase {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 44px;
}

.pt-phase-icon {
    font-size: 14px;
    line-height: 1.2;
}

.pt-phase-value {
    font-size: 11px;
    font-weight: 500;
    color: #e0e0e0;
    white-space: nowrap;
}

.pt-phase-label {
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pt-phase.is-zero {
    opacity: 0.4;
}

.pt-phase-sep {
    align-self: center;
    color: #666;
    font-size: 12px;
    padding-top: 6px;
}

.pt-total {
    margin-top: 6px;
    padding-left: 28px;
    font-size: 12px;
    font-weight: 600;
    color: #e0e0e0;
}

.pt-caption {
    margin-top: 2px;
    padding-left: 28px;
    font-size: 9px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Chart */
#resultChart {
    margin-top: 10px;
}

.result-chart-svg {
    width: 100%;
    height: auto;
    display: block;
}

.chart-grid {
    stroke: rgba(255,255,255,0.12);
    stroke-width: 1;
}

.chart-axis-text {
    fill: #888;
    font-size: 7px;
}

.chart-value-label {
    fill: #e0e0e0;
    font-size: 7.5px;
    font-weight: 600;
}

.chart-bar-wait {
    opacity: 0.4;
}

.chart-bar-travel {
    opacity: 1;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 6px;
    font-size: 10px;
    color: #aaa;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chart-legend-swatch {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #888;
    flex-shrink: 0;
}

.chart-legend-wait {
    opacity: 0.4;
}

.chart-legend-travel {
    opacity: 1;
}
