/* ============================================================
   GLOBAL COLOR PALETTE & VARIABLES
   ============================================================ */
:root {
    --color-orange: #FF6600;    /* Primary Brand Color */
    --color-cyan: #00FFFF;      /* Secondary Accent Color */
    --color-black: #000000;     /* Pure Black */
    --color-dark-gray: #111111; /* Background Gray */
    --color-panel-gray: #222222;/* Sidebar/Panel Gray */
    --color-text-light: #cccccc;/* Readable Light Gray */
    --color-border: #444444;    /* Subtle Borders */
}

/* ============================================================
   BASE LAYOUT
   ============================================================ */
body { 
	margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* El scroll solo estará dentro del menú */
    background: var(--color-dark-gray); 
    color: var(--color-text-light); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}

body.espera { cursor: wait; }

.main-layout {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 3D Viewport Area */
#viewer { 
    background: var(--color-black); /* Tu variable pure black */
    position: absolute;		
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1; 
}

/* ============================================================
   SIDEBAR & CONTAINERS
   ============================================================ */
#sidebar { 
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    z-index: 10; 
    /* Usamos el tono de tu variable panel-gray con opacidad */
    background: rgba(34, 34, 34, 0.85); 
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    
    display: flex;
    flex-direction: column; 
    border-right: 1px solid var(--color-border); /* Respetando tu variable */
    color: white;
    box-shadow: 5px 0 15px rgba(0,0,0,0.5);
}
#sidebar.procesando {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(0.5);
    transition: all 0.3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
}

.brand-logo {
    width: 80%;      /* Ocupa todo el ancho del contenedor */
    height: auto;     /* La altura se ajusta para mantener la proporción */
    display: block;   /* Elimina el pequeño espacio extra debajo de las imágenes inline */
}

/* Scrollable Controls Area */
#controls-container {
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 20px; 
    box-sizing: border-box;
    /* Tus estilos de scrollbar */
    scrollbar-width: thin;
    scrollbar-color: #333 var(--color-dark-gray);
}

/* ============================================================
   UI COMPONENTS (Sections & Labels)
   ============================================================ */
details.sect {
    background: #2a2a2a;
    margin-bottom: 10px;
    border-left: 2px solid var(--color-orange);
    overflow: hidden;
}

summary {
    padding: 12px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
    outline: none;
    user-select: none;
}

.sect-content {
    padding: 15px;
    border-top: 1px solid var(--color-border);
}

label { 
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px; 
    color: #bbb; 
    margin-top: 12px;
    margin-bottom: 4px;
}

/* Dependent visibility system */
.chk:has(input:not(:checked)) + .esclavo { display: none; }

.esclavo {
    margin-left: 5px;
    padding: 5px 10px;
    border-left: 2px solid #333;
    margin-top: 5px;
}

/* ============================================================
   FORM INPUTS (Numbers, Text, Selects)
   ============================================================ */
/* Shared Text/Select Styles */
input[type="text"], 
select { 
    width: 100%; 
    padding: 8px; 
    background: #333; 
    border: 1px solid var(--color-border); 
    color: white; 
    border-radius: 4px; 
    box-sizing: border-box;
    font-size: 10px;
    margin-top: 5px;
    cursor: pointer;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23FF6600' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

select:focus, input[type="text"]:focus {
    border-color: var(--color-cyan);
    outline: none;
}

/* Numeric Inputs (.val-input) */
.val-input {
    background: #1a1a1a;
    border: 1px solid #333;
    color: var(--color-cyan); /* Highlight values in Cyan */
    width: 65px;
    padding: 3px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    font-weight: bold;
    text-align: right;
    transition: all 0.2s ease;
}

.val-input:focus {
    border-color: var(--color-orange);
    background: #000;
    outline: none;
    box-shadow: 0 0 5px rgba(255, 102, 0, 0.3);
}

/* Hide Spinners in Numeric Inputs */
.val-input::-webkit-inner-spin-button, 
.val-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.val-input[type=number] { -moz-appearance: textfield; }

/* ============================================================
   CONTROLS (Sliders & Checkboxes)
   ============================================================ */
input[type="checkbox"], 
input[type="range"] {
    accent-color: var(--color-orange) !important;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    display: block;
    margin: 10px 0;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--color-orange); 
    margin-top: -6px;
}

.chk { 
    font-size: 11px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 5px;
}

/* ============================================================
   BUTTONS & FOOTER
   ============================================================ */
#footer-actions {
    padding: 15px;
    background: rgba(26, 26, 26, 0.9); /* Basado en tu color de botones */
    box-sizing: border-box;
    flex-shrink: 0; 
    border-top: 1px solid var(--color-border); /* Tu variable */
}

button { 
    width: 100%; 
    padding: 10px; 
    margin-top: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    border: none; 
    border-radius: 6px; 
    color: white; 
    text-transform: uppercase; 
    transition: 0.2s ease; 
}

button:hover { filter: brightness(1.2); }

.btn-sync { background: #007bff; }
.btn-reset { background: #dc3545; }
.btn-gen { background: var(--color-orange); }
.btn-dl { background: #f39c12; }

/* Status & Dimensions Info */
#floating-footer {
    position: fixed;
    top: 0;
    right: 0;
    text-align: right;
    font-size: 11px;
    padding: 15px 25px;
    z-index: 2000;
    pointer-events: none; /* Permite rotar el 3D aunque el mouse esté aquí */
}

#status { 
    color: var(--color-cyan); /* Tu variable Cyan */
    font-weight: bold; 
}

#stl-dimensions .label { color: var(--color-text-light); }
#stl-dimensions .value { color: var(--color-orange); } /* Tu variable Orange */

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */
#controls-container::-webkit-scrollbar { width: 6px; }
#controls-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}
#controls-container::-webkit-scrollbar-thumb:hover { background: var(--color-orange); }