/* ==============================================================================
   SolarSim WebGPU Design System
   Modern dark-space aesthetics, glassmorphism, glowing telemetry badges
   ============================================================================== */

:root {
    --bg-dark: #07090f;
    --panel-bg: rgba(14, 18, 30, 0.75);
    --panel-border: rgba(255, 255, 255, 0.12);
    --panel-glow: rgba(0, 180, 255, 0.15);
    
    --accent-blue: #00d2ff;
    --accent-cyan: #3a7bd5;
    --accent-purple: #9d50bb;
    --accent-gold: #f6d365;
    --accent-emerald: #00f2fe;

    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --btn-primary: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --btn-danger: linear-gradient(135deg, #f857a6 0%, #ff5858 100%);
    --btn-secondary: rgba(255, 255, 255, 0.08);

    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-ui);
    color: var(--text-primary);
}

/* 3D WebGPU Canvas */
#webgpu-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
}

/* Glassmorphism Surface Utility */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45), inset 0 1px 1px 0 rgba(255, 255, 255, 0.1);
    border-radius: 14px;
}

/* UI Overlay Container */
#ui-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 340px 1fr 380px;
    padding: 18px;
    gap: 16px;
}

#ui-container > * {
    pointer-events: auto;
}

/* Top Status Bar */
#top-bar {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
}

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

.pulse-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #00ffaa;
    box-shadow: 0 0 12px #00ffaa;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.logo-group h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge-gpu, .badge-cpp {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.badge-gpu {
    background: linear-gradient(135deg, #00d2ff, #00f2fe);
    color: #051329;
}

.badge-cpp {
    background: linear-gradient(135deg, #654ea3, #eaafc8);
    color: #fff;
}

.telemetry-bar {
    display: flex;
    gap: 12px;
}

.stat-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.6px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-value.good {
    color: #00ffaa;
}

/* Controls Panel (Left Drawer) */
#controls-panel {
    grid-row: 2;
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.panel-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge-pill {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(0, 210, 255, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 210, 255, 0.3);
    font-weight: 600;
}

/* Buttons */
.playback-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--btn-primary);
    box-shadow: 0 4px 14px rgba(0, 210, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 210, 255, 0.45);
}

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

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

.btn-danger {
    background: var(--btn-danger);
}

.btn-danger:hover {
    box-shadow: 0 4px 14px rgba(255, 88, 88, 0.35);
}

.btn-sm {
    padding: 6px 8px;
    font-size: 0.76rem;
    border-radius: 6px;
}

.camera-presets-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 2px;
}

.camera-hints {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.4;
    margin-top: 4px;
}

.camera-hints b {
    color: var(--accent-blue);
}

/* Control Rows */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label-with-val {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.control-val {
    font-family: var(--font-mono);
    color: var(--accent-blue);
    font-weight: 500;
}

/* Select Dropdown */
.select-styled {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 10px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    transition: border 0.2s;
}

.select-styled:focus {
    border-color: var(--accent-blue);
}

.select-styled option {
    background-color: #0d1222;
    color: #fff;
}

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

.slider-styled::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-blue);
    transition: transform 0.15s;
}

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

/* Toggle Grid */
.toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.toggle-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: background 0.2s;
}

.toggle-card:hover {
    background: rgba(255, 255, 255, 0.07);
}

.camera-hints {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: 6px;
}

/* Astronomical Telemetry Dossier (Right Panel) */
#target-info-card {
    grid-row: 2;
    grid-column: 3;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.target-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.target-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.badge-type {
    font-size: 0.72rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.3);
}

.dossier-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.dossier-item {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.dossier-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.dossier-val {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
    margin-top: 2px;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-card {
    max-width: 480px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: center;
}

.modal-card h2 {
    font-size: 1.3rem;
}

.modal-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    #ui-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        overflow-y: auto;
    }
    #controls-panel {
        grid-column: 1;
        grid-row: 2;
    }
    #target-info-card {
        grid-column: 1;
        grid-row: 3;
    }
}
