/* ST-GNN Traffic Visualizer Styling stylesheet */

:root {
    --bg-dark: #070A13;
    --bg-card: rgba(22, 30, 49, 0.85);
    --border-card: rgba(0, 240, 255, 0.15);
    --border-card-hover: rgba(0, 240, 255, 0.35);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --color-blue: #00F0FF;
    --color-purple: #9061FF;
    --color-green: #10B981;
    --color-yellow: #F59E0B;
    --color-red: #EF4444;
    
    --glow-blue: 0 0 15px rgba(0, 240, 255, 0.25);
    --glow-purple: 0 0 15px rgba(144, 97, 255, 0.25);
    --glow-red: 0 0 15px rgba(239, 68, 68, 0.3);
    
    --font-header: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 10% 20%, rgba(112, 0, 255, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(0, 240, 255, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: rgba(0, 240, 255, 0.1);
    border: 1.5px solid var(--color-blue);
    border-radius: 12px;
    box-shadow: var(--glow-blue);
}

.logo-text h1 {
    font-family: var(--font-header);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #00F0FF 0%, #B800FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.header-badges {
    display: flex;
    gap: 15px;
}

.badge {
    display: flex;
    flex-direction: column;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    min-width: 110px;
}

.badge .badge-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.badge .badge-value {
    font-family: var(--font-header);
    font-size: 13px;
    font-weight: 600;
}

.glow-blue { border-color: rgba(0, 240, 255, 0.3); box-shadow: 0 0 10px rgba(0, 240, 255, 0.1); }
.glow-purple { border-color: rgba(144, 97, 255, 0.3); box-shadow: 0 0 10px rgba(144, 97, 255, 0.1); }
.glow-green { border-color: rgba(16, 185, 129, 0.3); box-shadow: 0 0 10px rgba(16, 185, 129, 0.1); }
.glow-amber { border-color: rgba(245, 158, 11, 0.3); box-shadow: 0 0 10px rgba(245, 158, 11, 0.1); }

/* Model Selector Card */
.card-model {
    border-color: rgba(245, 158, 11, 0.2);
}
.card-model h2 {
    color: var(--color-yellow);
}
.card-model select {
    border-color: rgba(245, 158, 11, 0.3);
}
.card-model select:focus {
    border-color: var(--color-yellow);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.15);
}
.model-info {
    margin-top: 8px;
}
.model-info .meta-item span {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* Workspace Grid */
.workspace-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 20px;
    flex-grow: 1;
}

@media (max-width: 1200px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* Sidebar & Cards */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    border-color: var(--border-card-hover);
}

.card h2 {
    font-family: var(--font-header);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    letter-spacing: -0.2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    color: var(--text-primary);
}

/* Control Elements */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.control-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

select {
    background: #0D1424;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:focus {
    border-color: var(--color-blue);
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.2);
}

.button-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(90deg, #00F0FF 0%, #7000FF 100%);
    border: none;
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(112, 0, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.scene-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.meta-item span:first-child {
    color: var(--text-secondary);
}

.meta-item .val {
    font-weight: 600;
    color: var(--color-blue);
}

/* Playback Elements */
.timeline-container {
    margin-bottom: 20px;
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

.timeline-labels .marker-obs {
    color: var(--color-purple);
}

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

.timeline-slider {
    background: linear-gradient(to right, var(--color-purple) 37.5%, rgba(255, 255, 255, 0.1) 37.5%);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-blue);
    cursor: pointer;
    box-shadow: 0 0 10px var(--color-blue);
    border: 2px solid #000;
    transition: transform 0.1s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.timeline-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
}

#lbl-time-seconds {
    color: var(--text-primary);
}

.phase-obs {
    color: var(--color-purple);
    font-weight: 600;
}

.phase-pred {
    color: var(--color-yellow);
    font-weight: 600;
}

.playback-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-blue);
}

.btn-play {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-blue);
    border: none;
    color: #070A13;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-blue);
    transition: all 0.2s;
}

.btn-play:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.slider-group {
    background: rgba(0, 0, 0, 0.15);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.slider-header span {
    font-weight: 600;
    color: var(--color-blue);
}

.hidden {
    display: none !important;
}

/* Global Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.metric-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.metric-box .num {
    font-family: var(--font-header);
    font-size: 18px;
    font-weight: 700;
}

.metric-box .label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 3px;
    font-weight: 600;
}

.text-blue { color: var(--color-blue); }
.text-purple { color: var(--color-purple); }
.text-red { color: var(--color-red); }
.text-green { color: var(--color-green); }

.model-architecture-info h3 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.model-architecture-info ul {
    list-style: none;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.model-architecture-info ul li strong {
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Visualizer Card */
.visualizer-card {
    display: flex;
    flex-direction: column;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header-flex h2 {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 500;
}

.legend-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-item .dot.obs { background-color: var(--color-purple); }

.legend-item .line {
    width: 14px;
    height: 3px;
    border-radius: 1px;
}

.legend-item .line.gt { background-color: var(--color-green); }
.legend-item .line.pred { background-color: var(--color-yellow); border-top: 1.5px dashed var(--color-yellow); background: none; height: 0; }
.legend-item .line.cv { background-color: var(--text-muted); border-top: 1.5px dotted var(--text-muted); background: none; height: 0; }
.legend-item .line.edge { background-color: rgba(0, 240, 255, 0.5); border-top: 1px dashed rgba(0, 240, 255, 0.5); background: none; height: 0; }

.canvas-wrapper {
    position: relative;
    background: #0A0D16;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
}

#highway-canvas {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
}

.canvas-instructions {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Canvas Overlay / Loader */
.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 10, 19, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 240, 255, 0.1);
    border-top: 3px solid var(--color-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: var(--glow-blue);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Telemetry Dashboard Grid */
.telemetry-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .telemetry-grid {
        grid-template-columns: 1fr;
    }
}

.selected-vid-pill {
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid var(--color-blue);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--color-blue);
    box-shadow: var(--glow-blue);
}

.telemetry-meta {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.meta-row {
    display: flex;
    gap: 15px;
}

.meta-row .cell {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.meta-row .cell .lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.meta-row .cell .val {
    font-size: 14px;
    font-weight: 700;
    margin-top: 2px;
    font-family: var(--font-header);
    color: var(--text-primary);
}

.prediction-comparison h3 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.metrics-table th {
    color: var(--text-muted);
    font-weight: 600;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.metrics-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Safety Panel */
.safety-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 1px solid;
    transition: all 0.3s;
}

.safety-banner.safe {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--color-green);
}

.safety-banner.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--color-yellow);
}

.safety-banner.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--color-red);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);
    animation: pulse-red 2s infinite alternate;
}

@keyframes pulse-red {
    0% { border-color: rgba(239, 68, 68, 0.4); }
    100% { border-color: rgba(239, 68, 68, 0.8); }
}

.banner-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-text h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.banner-text p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.ttc-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 10px;
}

.ttc-chart-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.ttc-current {
    font-weight: 700;
    font-family: var(--font-header);
    color: var(--color-blue);
}

.ttc-bar-chart {
    height: 70px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    padding-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ttc-bar-wrapper {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.ttc-bar-wrapper::before {
    content: attr(data-val);
    position: absolute;
    top: -16px;
    font-size: 8px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-primary);
}

.ttc-bar-wrapper:hover::before {
    opacity: 1;
}

.ttc-bar {
    width: 100%;
    border-radius: 2px 2px 0 0;
    transition: height 0.3s ease, background-color 0.3s;
}

.ttc-bar.safe {
    background-color: var(--color-green);
    opacity: 0.65;
}

.ttc-bar.warning {
    background-color: var(--color-yellow);
    opacity: 0.8;
}

.ttc-bar.danger {
    background-color: var(--color-red);
    opacity: 0.95;
}

.ttc-bar-wrapper:hover .ttc-bar {
    opacity: 1;
}

.ttc-chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 6px;
    font-weight: 500;
}
