﻿/* Importamos la fuente IBM Plex Mono desde Google Fonts de forma correcta */
@import url('https://googleapis.com');

body {
    font-family: 'IBM Plex Mono', monospace;
    background-color: #000000; /* Negro profundo de monitor apagado */
    color: #33ff33; /* Verde fósforo brillante */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    margin: 0;
    min-height: 100vh;
}

/* --- MODIFICACIONES EN CONTENEDOR Y NUEVO PANEL INFERIOR --- */

.container {
    background: #020502;
    padding: 24px;
    box-shadow: 0 0 15px rgba(51, 255, 51, 0.15);
    max-width: 1100px;
    width: 100%;
    border: 2px solid #33ff33;
    display: flex;
    flex-wrap: wrap; 
    gap: 24px;
}

.bottom-panel {
    width: 100%; 
    border-top: 2px dashed #33ff33;
    padding-top: 20px;
    margin-top: 10px;
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap; 
}

.panel-section {
    background: #000000;
    border: 1px solid #11aa11;
    padding: 14px;
    box-sizing: border-box;
}

.flex-presets { flex: 2; min-width: 300px; }
.flex-files   { flex: 1.2; min-width: 240px; }
.flex-data    { flex: 1.5; min-width: 260px; }

.presets-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.presets-grid button {
    padding: 8px !important;
    font-size: 0.75rem !important;
    margin: 0 !important;
}

.data-card-new {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #11aa11;
}


h1 {
    font-size: 1.4rem; 
    margin-top: 0;
    margin-bottom: 12px; /* Espacio mínimo y controlado antes del gráfico */
    text-align: center;
    color: #33ff33;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 2px dashed #33ff33;
    padding-bottom: 6px;
    width: 100%;
}

/* Estilo retro estricto para el cartel emergente */
#status {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000000;
    background-color: #33ff33; /* Fondo verde fósforo brillante */
    padding: 5px 12px;
    border: 2px solid #000000;
    box-shadow: 0 0 25px rgba(51, 255, 51, 0.7);
    pointer-events: none; /* No interrumpe los clics o arrastres del usuario */
}

/* --- VISOR COMPACTO Y CONTROLADO --- */
.main-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 600px; /* Reducido de 660px a 500px para compactar la UI en escritorio */
    flex: 0 0 600px;
    box-sizing: border-box;
}

/* Contenedor que limita el escalado visual pero preserva el aspecto */
.canvas-container {
    position: relative;
    margin: 0;
    background: #000000;
    border: 2px solid #33ff33;
    width: 100%;
    max-width: 600px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* El lienzo se adapta al contenedor sin alterar su resolución interna */
#fractalCanvas {
    position: relative;
    top: 0 !important;
    left: 0 !important;
    cursor: grab;
    background: #000000;
    width: 100% !important;
    height: auto !important;
    display: block;
    z-index: 1;
}

#axisCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
    z-index: 2;
    background: transparent !important;
}

/* El panel inferior se acopla estrictamente al nuevo ancho del canvas */
.bottom-panel {
    width: 100%; 
    max-width: 600px;
    border-top: 2px dashed #33ff33;
    padding-top: 14px;
    margin-top: 0px;
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-wrap: wrap;
}

#fractalCanvas:active {
    cursor: grabbing;
}

canvas {
    display: block;
    cursor: grab;
    background: #000000;
}

canvas:active {
    cursor: grabbing;
}

/* Columna Derecha: Panel de comandos */
.side-panel {
    flex: 1;
    min-width: 320px;
    display: flex;
    flex-direction: column;
}

.control-group {
    margin-bottom: 14px;
}

label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #11aa11; /* Verde atenuado para etiquetas legibles */
    text-transform: uppercase;
}

.label-val {
    color: #33ff33;
}

input[type="number"], select {
    width: 100%;
    padding: 8px;
    border: 1px solid #33ff33;
    border-radius: 0px;
    box-sizing: border-box;
    background: #000000;
    color: #33ff33;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.9rem;
}

input[type="number"]:focus, select:focus {
    background-color: #050a05;
    outline: 1px solid #33ff33;
}

input[type="range"] {
    width: 100%;
    margin: 4px 0;
    background: #000000;
    accent-color: #33ff33;
}

.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Botones nítidos estilo consola */
button {
    flex: 1;
    padding: 10px;
    border: 1px solid #33ff33;
    background: #000000;
    color: #33ff33;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: bold;
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.1s;
}

button:hover {
    background: #33ff33;
    color: #000000; /* Invierte colores en hover */
}

button:active {
    background: #11aa11;
    color: #000000;
}

/* Sobrescribimos estilos inline del HTML sin romper el rendimiento visual */
button.secondary {
    background: #000000 !important;
    color: #33ff33 !important;
    border: 1px dashed #33ff33 !important;
    box-shadow: none !important;
}

button.secondary:hover {
    background: #33ff33 !important;
    color: #000000 !important;
    border-style: solid !important;
}

/* Tarjeta de datos: Monitoreo nítido del sistema */
.data-card {
    background: #000000;
    border: 1px solid #33ff33;
    border-radius: 0px;
    padding: 12px;
    margin-top: 18px;
    font-size: 0.8rem;
    color: #11aa11;
}

.data-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.data-row:last-child {
    margin-bottom: 0;
}

.data-row span:last-child {
    color: #33ff33;
    font-weight: bold;
}


/* Asegura que el contenedor no rompa el paralelo en pantallas de escritorio */
.container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

/* --- NUEVOS RETOQUES DE ICONOS Y BLOQUES COLAPSABLES --- */

/* Estilo para los botones compactos de iconos debajo del grafico */
.camera-icons-row button {
    flex: 0 1 auto;
    font-size: 1.1rem !important;
    padding: 6px 12px !important;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Clases de utilidad para el colapsado/expandido via JS */
.collapsible-section {
    transition: opacity 0.15s ease, max-height 0.15s ease;
    max-height: 2000px; /* Suficientemente grande para el contenido desplegado */
    opacity: 1;
    overflow: hidden;
}

.collapsible-section.collapsed {
    max-height: 0px !important;
    opacity: 0 !important;
    margin-top: 0px !important;
    margin-bottom: 0px !important;
    pointer-events: none;
}

/* Modificacion para que los selects y checkbox convivan bien en linea */
#lowRezCheck {
    width: auto !important;
    cursor: pointer;
}

/* Reposicionamiento estricto y limpio para el cartel de telemetría de cómputo */
.canvas-container #status {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    margin: 0 !important;
    z-index: 100 !important; /* Flota encima de los dos canvas */
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    letter-spacing: 1px;
    border-radius: 0px;
}
/* Feedback retro para el botón de donaciones del footer */
footer a[href*="ko-fi"]:hover {
    background: #33ff33 !important;
    color: #000000 !important;
    box-shadow: 0 0 10px rgba(51, 255, 51, 0.4);
}

/* --- COMPORTAMIENTO MÓVIL GLOBAL (VERTICAL Y HORIZONTAL) --- */
@media (max-width: 900px) {
    body {
        padding: 0;
        overflow-x: hidden;
    }

    .container {
        flex-direction: column !important;
        padding: 8px; /* Colchón perimetral seguro */
        border: none;
        box-shadow: none;
        background: #000000;
        gap: 12px;
        box-sizing: border-box;
        width: 100%;
    }
    
    /* La columna izquierda se adapta al ancho disponible */
    .main-column {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
        gap: 8px;
    }

    /* El canvas no explota, se contiene dentro del ancho del teléfono */
    .canvas-container {
        width: 100% !important;
        max-width: 100% !important;
        border: 2px solid #33ff33;
        box-sizing: border-box;
    }

    .camera-icons-row {
        width: 100% !important;
        max-width: 100% !important;
        padding: 4px 0;
        box-sizing: border-box;
        background: transparent;
        border-bottom: none;
    }

    /* BLINDAJE DE PANELES FLOTANTES */
    .side-panel {
        position: relative !important;
        width: 100% !important;
        min-width: 100% !important;
        box-sizing: border-box;
    }

    /* PRESERVACIÓN TOTAL DE TU SISTEMA DE DESPLIEGUE FLOTANTE ORIGINAL */
    #mathSection, #artSection {
        position: absolute !important;
        top: -9999px; /* Forzamos desaparición absoluta del flujo visual */
        left: 0;
        width: 100% !important; /* Corregido: toma el 100% de la pantalla sin desbordar */
        background: #020502;
        border: 2px solid #33ff33;
        z-index: 500 !important; /* Capa superior absoluta */
        box-sizing: border-box;
        padding: 16px;
    }

    /* Cuando pierden la clase .collapsed se clavan fijas en pantalla completa intactas */
    #mathSection:not(.collapsed), #artSection:not(.collapsed) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        overflow-y: auto !important;
        box-shadow: 0 0 30px rgba(51, 255, 51, 0.5);
    }

    .bottom-panel {
        max-width: 100% !important;
        padding: 0;
        box-sizing: border-box;
    }
}

/* --- AJUSTE DE AIRE EXTRA CUANDO SE ACUESTA EL CELULAR --- */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        padding: 6px;
        box-sizing: border-box;
    }
    .main-column {
        padding: 0 8px;
    }
    .camera-icons-row {
        justify-content: center;
        border: 1px dashed #11aa11;
        margin-top: 4px;
        padding: 6px 12px !important;
    }
}

/* Ajuste de margen para que la regla quede pegada al borde inferior del contenedor del canvas */
#previewSliderContainer {
    padding: 2px 0;
    background: #000000;
}

/* Evitamos que el input range se desfase visualmente */
#animPreviewSlider {
    box-sizing: border-box;
    height: 14px;
}
