@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&display=swap');

:root {
    --primary: #00ffcc;
    --accent: #ff0055;
    --bg-glass: rgba(10, 10, 12, 0.75);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #eeeeee;
    --text-muted: #aaaaaa;
}

body {
    margin: 0; padding: 0;
    background-color: #000;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    overflow: hidden; /* Evita scroll en el body */
    height: 100vh; width: 100vw;
}

/* --- CANVAS CONTAINER --- */
#canvas-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 0;
    display: flex; justify-content: center; align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
}

canvas {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

/* --- UI PANEL (Floating Glass) --- */
#ui-panel {
    position: absolute;
    top: 20px; left: 20px; bottom: 20px;
    width: 320px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0; /* Padding interno manejado por hijos */
    display: flex; flex-direction: column;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Estado oculto para Preview */
#ui-panel.hidden {
    transform: translateX(-120%);
}

.panel-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-glass);
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(0,0,0,0.2);
}

.panel-header h3 { margin: 0; color: var(--primary); font-size: 18px; letter-spacing: 1px; text-transform: uppercase; }

.panel-content {
    padding: 20px;
    overflow-y: auto; /* Scroll solo dentro del panel */
    flex-grow: 1;
}

/* Scrollbar fina */
.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

/* --- CONTROLES --- */
.section-title {
    font-size: 11px; font-weight: 700; letter-spacing: 2px;
    color: var(--text-muted); margin: 20px 0 10px 0;
    text-transform: uppercase; border-bottom: 1px solid #333; padding-bottom: 4px;
}
.section-title:first-child { margin-top: 0; }
select option {
    background-color: #1a1a1a; /* Fondo oscuro sólido */
    color: #ffffff;            /* Texto blanco */
    padding: 10px;
}

.control-group { margin-bottom: 12px; }
.control-row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }

label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 4px; }

input[type="text"], input[type="number"], select {
    background: rgba(255,255,255,0.05);
    border: 1px solid #444; color: #fff;
    padding: 8px; border-radius: 6px;
    width: 100%; box-sizing: border-box;
    font-family: inherit; font-size: 14px;
    transition: 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--primary); background: rgba(0,255,204,0.05); }

/* Range Sliders Custom */
input[type=range] {
    -webkit-appearance: none; width: 100%; background: transparent; margin: 8px 0;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 14px; width: 14px;
    border-radius: 50%; background: var(--primary);
    cursor: pointer; margin-top: -5px; box-shadow: 0 0 10px var(--primary);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%; height: 4px; cursor: pointer;
    background: #333; border-radius: 2px;
}

/* Botones */
.actions { display: flex; gap: 8px; margin-top: 20px; }
.btn {
    flex: 1; padding: 12px; border: none; border-radius: 6px;
    font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    cursor: pointer; font-family: inherit; font-size: 12px;
    transition: all 0.2s;
}
.btn.primary { background: var(--primary); color: #000; box-shadow: 0 0 15px rgba(0,255,204,0.2); }
.btn.primary:hover { background: #fff; box-shadow: 0 0 25px rgba(0,255,204,0.5); transform: translateY(-1px); }
.btn.secondary { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.btn.secondary:hover { background: rgba(255,255,255,0.2); border-color: #fff; }

/* --- BOTÓN PREVIEW FLOTANTE --- */
#preview-toggle {
    position: absolute; top: 20px; right: 20px;
    background: rgba(0,0,0,0.6); border: 1px solid var(--primary);
    color: var(--primary); padding: 8px 15px; border-radius: 20px;
    cursor: pointer; z-index: 101; font-weight: bold; font-size: 12px;
    backdrop-filter: blur(5px); display: flex; align-items: center; gap: 5px;
    transition: 0.3s;
}
#preview-toggle:hover { background: var(--primary); color: #000; }

/* --- OVERLAY DE RENDERIZADO --- */
#render-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); z-index: 200;
    display: none; flex-direction: column; justify-content: center; align-items: center;
}
.render-box { width: 300px; text-align: center; }
.progress-bar { width: 100%; height: 4px; background: #333; margin: 20px 0; border-radius: 2px; overflow: hidden; }
#progress-fill { width: 0%; height: 100%; background: var(--accent); transition: width 0.1s; box-shadow: 0 0 10px var(--accent); }

/* --- RESPONSIVE MOBILE --- */
@media (max-width: 768px) {
    #ui-panel {
        top: auto; bottom: 0; left: 0; width: 100%; height: 50vh;
        border-radius: 20px 20px 0 0; border-left: none; border-right: none;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.8);
    }
    #ui-panel.hidden { transform: translateY(110%); }
    .panel-content { padding-bottom: 40px; }
}