/* General Body and Typography */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #121212;
    color: #e0e0e0;
    overflow: hidden;
}

/* Preloader */
#preloader-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.5s;
}
#preloader-modal h2 {
    font-size: 2.5rem;
    color: #fff;
}
#preloader-modal p {
    max-width: 600px;
    text-align: center;
    line-height: 1.6;
    color: #ccc;
}
#start-button {
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: background-color 0.3s;
}
#start-button:hover {
    background: #0056b3;
}

/* Main UI Controls */
.view-controls {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(40, 40, 40, 0.8);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    z-index: 100;
}
.visualization-toggle label {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.visualization-toggle input[type="radio"] {
    display: none;
}
.visualization-toggle input[type="radio"]:checked + label {
    background-color: #007bff;
    color: white;
}
.toggle-switch {
    margin-left: 20px;
}
.toggle-switch .toggle-label {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}
.toggle-switch .toggle-input {
    display: none;
}
.toggle-switch .toggle-input:checked + .toggle-label {
    background-color: #28a745;
    color: white;
}

/* Filter Controls */
#filter-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(40, 40, 40, 0.8);
    padding: 15px;
    border-radius: 8px;
    z-index: 100;
    max-width: 300px;
}
.filter-group {
    margin-bottom: 10px;
}
.filter-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #e0e0e0;
}
#filter-controls select {
    width: 100%;
    padding: 8px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    border-radius: 4px;
    max-height: 150px;
}
#clear-filters {
    width: 100%;
    margin: 10px 0;
    padding: 8px;
    background: #555;
    color: #fff;
    border: 1px solid #666;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}
#clear-filters:hover {
    background: #666;
}
.stats {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #555;
    color: #ccc;
    font-size: 0.9rem;
}
.stats span {
    display: block;
}

/* Canvas Container */
#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Video Overlay */
#video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Increased z-index to ensure it's above all other elements */
    pointer-events: all; /* Ensure the overlay captures all mouse events */
}

/* Add styles for when overlay is active */
body.modal-open {
    overflow: hidden;
}

body.modal-open .view-controls,
body.modal-open #filter-controls,
body.modal-open #canvas-container,
body.modal-open #debug-panel,
body.modal-open #debug-open-btn {
    pointer-events: none;
    filter: blur(2px);
}

.overlay-content {
    background: #282828;
    padding: 20px;
    border-radius: 8px;
    max-width: 80vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    pointer-events: auto; /* Re-enable pointer events for the modal content */
}
.overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    margin-bottom: 15px;
}
#overlay-title {
    margin: 0;
    font-size: 1.5rem;
}
#overlay-close {
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
    transition: color 0.3s;
}
#overlay-close:hover {
    color: #fff;
}
#overlay-video {
    width: 100%;
    max-height: 60vh;
}
.overlay-info {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #ccc;
}
.overlay-info p {
    margin: 5px 0;
}

/* Debug Panel */
#debug-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #444;
    border-radius: 8px;
    width: 400px;
    max-height: 300px;
    z-index: 101;
    display: none; /* Initially hidden */
    flex-direction: column;
}
.debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #333;
    border-bottom: 1px solid #444;
}
.debug-header h4 {
    margin: 0;
}
#debug-toggle-btn {
    background: #555;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}
#debug-content {
    padding: 10px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    flex-grow: 1;
}
#debug-open-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #333;
    color: white;
    border: 1px solid #555;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    z-index: 100;
    display: block; /* Initially visible */
} 