* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
}

#app {
    display: flex;
    width: 100vw;
    height: 100vh;
}

#viewer-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#three-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================
   LEFT LAYERS PANEL
   ============================================ */
.layers-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 92px; /* Leave room for timeline (60px) + status bar (32px) */
    width: 280px;
    background: rgba(30, 30, 30, 0.95);
    border-right: 1px solid #444;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 200;
    overflow: hidden;
}

.layers-panel.collapsed {
    transform: translateX(-280px);
}

/* External toggle button for collapsed layers panel */
#layers-panel-toggle {
    position: fixed;
    left: 0;
    top: 10px;
    width: 24px;
    height: 60px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
    z-index: 201;
}

#layers-panel-toggle:hover {
    background: rgba(50, 50, 50, 0.95);
    color: #fff;
}

.layers-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(40, 40, 40, 0.8);
    border-bottom: 1px solid #444;
}

.layers-panel-header h3 {
    font-size: 14px;
    color: #ddd;
    margin: 0;
}

.panel-collapse-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
}

.panel-collapse-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.layers-panel-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Tree Control */
.tree-control {
    padding: 8px 0;
}

.tree-loading,
.tree-error {
    padding: 20px;
    text-align: center;
    color: #888;
}

.tree-folder {
    user-select: none;
}

.folder-header {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.folder-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.folder-toggle {
    width: 16px;
    font-size: 10px;
    color: #888;
    margin-right: 4px;
}

.folder-icon {
    margin-right: 6px;
    font-size: 14px;
}

.folder-label {
    font-size: 13px;
    color: #ccc;
}

.folder-children {
    /* Indentation handled by inline paddingLeft */
}

/* Aircraft item */
.tree-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.tree-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tree-item.selected {
    background: rgba(0, 102, 204, 0.3);
}

.aircraft-checkbox {
    margin-right: 6px;
}

.aircraft-icon {
    margin-right: 6px;
    font-size: 14px;
}

.aircraft-label {
    font-size: 12px;
    color: #ddd;
    flex: 1;
}

.aircraft-duration {
    font-size: 10px;
    color: #888;
    margin-left: 8px;
}

/* ============================================
   RIGHT CONTROLS PANEL
   ============================================ */
#controls-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 92px; /* Leave room for timeline (60px) + status bar (32px) */
    width: 280px;
    background: rgba(30, 30, 30, 0.95);
    border-left: 1px solid #444;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 200;
    overflow-y: auto;
}

#controls-panel.collapsed {
    transform: translateX(280px);
}

/* Panel toggle button */
#panel-toggle {
    position: fixed;
    right: 280px;
    top: 10px;
    width: 24px;
    height: 60px;
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #444;
    border-right: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
    transition: right 0.3s ease;
    z-index: 201;
}

#panel-toggle:hover {
    background: rgba(50, 50, 50, 0.95);
    color: #fff;
}

#panel-toggle.collapsed {
    right: 0;
}

/* Version number */
.version-tag {
    text-align: right;
    font-size: 10px;
    color: #666;
    padding: 5px 10px 0;
}

/* Collapsible section */
.panel-section {
    border-bottom: 1px solid #333;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    background: rgba(40, 40, 40, 0.5);
    user-select: none;
}

.section-header:hover {
    background: rgba(50, 50, 50, 0.5);
}

.section-header h3 {
    font-size: 12px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.section-toggle {
    color: #666;
    font-size: 10px;
    transition: transform 0.2s;
}

.panel-section.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section-content {
    padding: 10px 12px;
    display: block;
}

.panel-section.collapsed .section-content {
    display: none;
}

/* Form controls */
button {
    background: #0066cc;
    color: white;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.2s;
}

button:hover {
    background: #0052a3;
}

button:active {
    background: #004080;
}

input[type="range"] {
    width: 100%;
    margin: 6px 0;
}

input[type="checkbox"] {
    margin-right: 8px;
}

label {
    display: block;
    margin: 6px 0;
    font-size: 13px;
}

select {
    width: 100%;
    padding: 6px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 13px;
}

/* Telemetry display */
#telemetry-display,
#frame-center-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

#telemetry-display div,
#frame-center-display div {
    margin: 3px 0;
    display: flex;
    justify-content: space-between;
}

#telemetry-display span,
#frame-center-display span {
    color: #4CAF50;
    font-weight: bold;
}

/* Value highlights */
.value-highlight {
    color: #4CAF50;
    font-weight: bold;
}

/* Small helper text */
small {
    color: #666;
    font-size: 10px;
    display: block;
    margin-top: 2px;
}

/* ============================================
   BOTTOM TIMELINE BAR
   ============================================ */
#timeline-bar {
    position: fixed;
    bottom: 32px;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(20, 20, 20, 0.95);
    border-top: 1px solid #444;
    z-index: 150;
    display: flex;
    align-items: center;
    padding: 0 15px;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 15px;
}

.timeline-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-speed select {
    width: 70px;
    padding: 4px;
    font-size: 12px;
}

.timeline-scrubber-container {
    flex: 1;
    position: relative;
    margin: 0 15px;
}

.timeline-scrubber-container input[type="range"] {
    width: 100%;
    margin: 0;
}

.timeline-markers {
    position: absolute;
    top: 22px;
    left: 0;
    right: 0;
    height: 6px;
    pointer-events: auto;
}

/* Video extent tracks (like Premiere timeline channels) */
.timeline-video-extent {
    position: absolute;
    border-radius: 1px;
    opacity: 0.5;
    cursor: pointer;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.timeline-video-extent:hover {
    opacity: 0.8;
}

.timeline-video-extent.selected {
    opacity: 1;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}

/* Deprecated - kept for backwards compatibility */
.timeline-marker {
    position: absolute;
    height: 100%;
    border-radius: 2px;
    opacity: 0.6;
}

.timeline-time-display {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 180px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.timeline-date {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 2px;
}

.timeline-utc,
.timeline-pacific {
    display: flex;
    gap: 8px;
}

.time-label {
    color: #888;
}

#timeline-utc-time {
    color: #FFD700;
    font-weight: bold;
}

#timeline-pacific-time {
    color: #4CAF50;
}

.timeline-duration {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
}

/* ============================================
   STATUS BAR
   ============================================ */
#status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(0, 0, 0, 0.9);
    padding: 0 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #ccc;
    border-top: 1px solid #333;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#cursor-info {
    color: #4CAF50;
}

#camera-heading {
    color: #FFD700;
    font-weight: bold;
}
