:root {
    --bg-glass: rgb(245, 245, 237);
    --bg-glass-hover: rgb(235, 235, 227);
    --border-glass: rgba(0, 0, 0, 0.15); 
    --text-primary: #111111; 
    --text-secondary: #555555; 
    --accent-main: #0078D7; 
    --accent-hover: #005A9E;
    --font-main: Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-drag: none;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #020617;
    font-family: var(--font-main);
    color: var(--text-primary);
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

header .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 4px;
}

/* --- MAIN CONTAINER (GLOBAL HUD) --- */
#main-panel {
    position: absolute;
    top: 24px;
    left: 24px;
    width: 380px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    /* cream colored background chosen */
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    padding: 10px;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.2) transparent;
}

    #main-panel::-webkit-scrollbar {
        width: 6px;
    }

    #main-panel::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.2);
        border-radius: 3px;
    }

/* --- GLOBAL CONTENT MANAGEMENT --- */
#main-panel-content {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Maintains space between logo and windows */
}

    #main-panel-content.hidden {
        display: none; /* Hides the entire HUD */
    }

/* --- LOGO --- */
.panel-logo {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

    .panel-logo img {
        max-width: 100%;
        height: auto;
        max-height: 80px;
        object-fit: contain;
        user-select: none;
        pointer-events: none;
    }

/* --- SINGLE DROP-DOWN MENUS --- */
.window-panel {
    background: rgba(0, 0, 0, 0.03); /* Slightly darker than the cream to create a contrast */
    border: 1px solid var(--border-glass);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
}

.window-header {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-glass);
    user-select: none;
}

    .window-header:hover {
        background: rgba(0, 0, 0, 0.08);
    }

    .window-header.closed {
        border-bottom: none;
    }

    .window-header h3 {
        margin: 0;
        font-size: 13px;
        font-weight: bold;
        color: var(--text-primary);
        letter-spacing: 0.5px;
    }

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

.window-content {
    padding: 16px;
    display: block;
}

    .window-content.hidden {
        display: none;
    }

/* Form Controls */
.control-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.03); /* Light background for curtains */
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

    select:hover, select:focus {
        background: rgba(0, 0, 0, 0.06);
        border-color: var(--accent-main);
    }

    select option {
        background: var(--bg-glass);
        color: var(--text-primary);
    }

/* Sliders */
.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: rgba(0, 0, 0, 0.08); /* Light dark badge background */
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.15); /* Gray track */
    outline: none;
    cursor: pointer;
}

    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        width: 16px;
        height: 16px;
        border-radius: 50%;
        background: var(--accent-main);
        transition: transform 0.1s, background 0.1s;
    }

        input[type="range"]::-webkit-slider-thumb:hover {
            background: var(--accent-hover);
            transform: scale(1.1);
        }

/* Checkbox Toggle styling */
.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

    .checkbox-group input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: var(--accent-main);
        cursor: pointer;
    }

    .checkbox-group label {
        cursor: pointer;
        font-size: 13px;
    }

/* Interactive Compass */
.compass-wrapper {
    display: flex;
    justify-content: center;
    padding: 10px 0;
}

.compass {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: none;
    border: none;
    cursor: crosshair;
    display: flex;
    justify-content: center;
    align-items: center;
}

.compass-base {
    position: absolute;
    width: 125%;
    height: 125%;
    pointer-events: none;
}

.compass-arrow {
    position: absolute;
    width: 80%;
    height: auto;
    z-index: 2;
    pointer-events: none;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

/* cams */
.camera-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

button {
    background: rgba(0, 0, 0, 0.05); /* Light buttons that use light theme */
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 2px;
    font-family: var(--font-main);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.1s;
}

    button:hover {
        background: rgba(0, 0, 0, 0.1);
        border-color: rgba(0,0,0,0.3);
    }

    button.active {
        background: var(--accent-main);
        border-color: var(--accent-main);
        color: #ffffff; 
    }

.help-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Leggenda Vector Field */
#wind-legend {
    margin-top: 8px;
}

.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    transition: background 0.2s;
}

    .legend-item:hover {
        background: rgba(0, 0, 0, 0.06);
    }

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.legend-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* FPS Overlay */
#perf-overlay {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 12px;
    z-index: 10;
    font-family: monospace;
    font-size: 12px;
    color: #a1d1ff;
    pointer-events: none;
}




/* --- LOADING SCREEN --- */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-glass);
    z-index: 9999; /* the image will be the first to see */
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease-out, visibility 0.8s ease-out;
    opacity: 1;
    visibility: visible;
}

    /* dissolvence with loading complete */
    #loading-screen.fade-out {
        opacity: 0;
        visibility: hidden;
    }

.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}

.loader-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 8px;
}

.loader-bar-wrapper {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid var(--border-glass);
}

#loader-bar {
    width: 0%;
    height: 100%;
    background: var(--accent-main, #0078D7);
    border-radius: 3px;
    transition: width 0.3s ease-out;
}

.loader-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-family: var(--font-main, Arial, sans-serif);
    font-size: 13px;
}

#loader-percentage {
    color: var(--text-primary);
    font-weight: bold;
}

#loader-status {
    color: var(--text-secondary);
}