/* assets/style.css - Dark Theme for LiDAR Surveillance Dashboard & TimelineJS */

:root {
    --bg-main: #0b0f17;
    --bg-card: #131b2e;
    --bg-card-hover: #1c2742;
    --bg-card-active: #233254;
    --border-color: #24324f;
    --border-bright: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.25);
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-purple: #8b5cf6;
    --accent-rose: #f43f5e;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-md: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(59, 130, 246, 0.15);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Bar */
.navbar {
    background: linear-gradient(180deg, #182238 0%, #0f172a 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #1d4ed8 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: 0 0 15px var(--accent-blue-glow);
}

.brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: #ffffff;
}

.brand-text p {
    font-size: 12px;
    color: var(--text-secondary);
}

.nav-badges {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-status {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-status .pulse {
    width: 8px;
    height: 8px;
    background-color: var(--accent-emerald);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-emerald);
    animation: pulse-anim 2s infinite;
}

@keyframes pulse-anim {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Dashboard Grid (3 Columns) */
.dashboard-container {
    display: grid;
    grid-template-columns: 340px 1fr 340px;
    gap: 16px;
    padding: 16px;
    height: 580px;
    min-height: 520px;
}

/* Common Card Styling */
.panel-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.panel-header {
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title i {
    color: var(--accent-blue);
}

.panel-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

/* Column 1: Date Filter & Record List */
.filter-box {
    margin-bottom: 12px;
}

.form-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

.input-date {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.input-date:focus {
    border-color: var(--accent-blue);
}

.date-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.chip-btn {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.chip-btn:hover, .chip-btn.active {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
}

.stats-summary-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-item {
    background-color: rgba(11, 15, 23, 0.5);
    padding: 8px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stat-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-blue);
}

.stat-lbl {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Records List */
.records-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.record-item {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease-in-out;
}

.record-item:hover {
    background-color: var(--bg-card-hover);
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateX(2px);
}

.record-item.active {
    background-color: var(--bg-card-active);
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.rec-time {
    font-size: 13px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.rec-meta {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Badges */
.badge-class {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: capitalize;
}

.badge-class.car { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-class.truck { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-class.bus { background: rgba(139, 92, 246, 0.15); color: #c084fc; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-class.motorcycle { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-class.unknown { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }

/* Column 2: Image Viewer */
.image-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #070a0f;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.image-viewer-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease-in-out;
}

.image-overlay-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(11, 15, 23, 0.95) 0%, rgba(11, 15, 23, 0) 100%);
    padding: 16px 16px 10px 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.image-info {
    font-size: 12px;
}

.image-info .img-title {
    font-weight: 600;
    color: #ffffff;
}

.image-info .img-sub {
    color: var(--text-secondary);
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
}

.btn-icon {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
}

/* Column 3: Metadata Panel */
.meta-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.meta-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
}

.meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-row:last-child {
    border-bottom: none;
}

.meta-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-label i {
    color: var(--accent-blue);
    width: 14px;
}

.meta-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.speed-meter {
    margin-top: 6px;
    background-color: var(--bg-card);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.speed-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-emerald) 0%, var(--accent-amber) 60%, var(--accent-rose) 100%);
    width: 0%;
    transition: width 0.4s ease;
}

/* TimelineJS Integration Area */
.timeline-section {
    padding: 0 16px 16px 16px;
    height: 260px;
    margin-top: 8px;
}

#timeline-embed {
    width: 100%;
    height: 100%;
    min-height: 240px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    background-color: #0d1322 !important;
    position: relative;
}

/* Knight Lab TimelineJS Dark Overrides */
.tl-timeline {
    background-color: #0d1322 !important;
    font-family: 'Inter', sans-serif !important;
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
}

/* Completely hide TimelineJS upper storyslider, slide preview header, media, and text cards */
#timeline-embed .tl-storyslider,
#timeline-embed .tl-slider-container-mask,
#timeline-embed .tl-slider-container,
#timeline-embed .tl-slider-background-container,
#timeline-embed .tl-slide,
#timeline-embed .tl-slide-content,
#timeline-embed .tl-media,
#timeline-embed .tl-text,
#timeline-embed .tl-text-content,
#timeline-embed .tl-slide-titleslide,
#timeline-embed .tl-header,
#timeline-embed .tl-header-title,
#timeline-embed .tl-slide-content-container,
#timeline-embed .tl-slide-title,
#timeline-embed .tl-timenav .tl-timegroup-message {
    display: none !important;
    height: 0 !important;
    max-height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Expand timeline track (timenav) to fill 100% of container */
#timeline-embed .tl-timenav {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    background-color: #0f172a !important;
    border-top: none !important;
}

.tl-timegroup {
    background-color: #1e293b !important;
}

.tl-headline-title {
    color: #ffffff !important;
}

.tl-caption {
    color: #94a3b8 !important;
    font-size: 11px !important;
}

.tl-marker {
    background-color: #1e293b !important;
}

.tl-marker-active .tl-headline {
    color: var(--accent-blue) !important;
}

.timeline-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.timeline-slide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.meta-pill {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-pill strong {
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 1100px) {
    .dashboard-container {
        grid-template-columns: 300px 1fr;
        height: auto;
    }
    .panel-card:nth-child(3) {
        grid-column: span 2;
    }
}
