/* SILENOS 3/styles.css */

/* =========================================
   0. FUENTES PERSONALIZADAS
   ========================================= */
/* Cargamos el archivo de fuente local que subiste */
 

/* =========================================
   1. VARIABLES Y ESTILOS BASE
   ========================================= */
:root {
    --bg-color: #e0e5ec;
    --shadow-light: #b3b3b300;
    --shadow-dark: #a3b1c600;
    --selection-blue: rgba(59, 131, 246, 0.171);
    --sidebar-width: 350px; /* Ancho fijo para las 3 columnas */
}

body {
    background-color: var(--bg-color);
    overflow: hidden;
    /* APLICAMOS LA FUENTE DE EMOJIS PRIMERO PARA FORZARLA */
    font-family: system-ui, sans-serif;
    user-select: none;
    margin: 0;
}

/* =========================================
   2. ESTILOS NEOMORFISTAS (UI GENERAL)
   ========================================= */

/* Botón/Elemento Saliente (Outset) */
.neumorph-out {
    background: var(--bg-color);
    box-shadow: 9px 9px 16px rgba(163,177,198,0.6), 
               -9px -9px 16px rgba(255, 255, 255, 0);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* Botón Pequeño */
.neumorph-btn {
    background: var(--bg-color);
    box-shadow: 5px 5px 10px #b8b9be00, -5px -5px 10px #ffffff00;
    border-radius: 12px;
    transition: all 0.2s ease;
}
.neumorph-btn:active, .neumorph-btn.active {
    box-shadow: inset 5px 5px 10px #b8b9be00, inset -5px -5px 10px #ffffff00;
}
.neumorph-btn:hover {
    transform: translateY(-2px);
}

/* Controles de ventana (min/max/close) */
.neumorph-control {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 50%;
    box-shadow: 3px 3px 6px #b8b9be00, -3px -3px 6px #ffffff00;
    cursor: pointer;
    transition: all 0.2s ease;
}
.neumorph-control:active {
    box-shadow: inset 2px 2px 5px #b8b9be00, inset -2px -2px 5px #ffffff5b;
}

/* Elemento Hundido (Inset) */
.neumorph-in {
    background: var(--bg-color);
    box-shadow: inset 6px 6px 12px #b8b9be00, inset -6px -6px 12px #ffffff25;
    border-radius: 16px;
}

/* =========================================
   3. ESCRITORIO Y VENTANAS
   ========================================= */
/* Evitar que los iconos se vean planos al rotar si decides añadir inclinación */
.desktop-icon-btn {
    backface-visibility: hidden;
}
/* Icono de Escritorio */
.desktop-icon-btn {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    box-shadow: 6px 6px 12px #b8b9be00, -6px -6px 12px #ffffff36;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.desktop-icon-btn:active {
    box-shadow: inset 4px 4px 8px #b8b9be00, inset -4px -4px 8px #ffffff;
    transform: scale(0.95);
}

/* Selección */
 
.icon-selected span {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #1d4ed8 !important;
}
/* SILENOS 3/styles.css - ACTUALIZACIÓN SELECTOR */

.selection-box {
    position: fixed; /* Cambiado a fixed para ignorar scrolls accidentales y capas 3D */
    background: rgba(59, 131, 246, 0.25);
    border: 1.5px solid rgba(59, 131, 246, 0.8);
    border-radius: 2px;
    pointer-events: none; /* Crucial: para que no interfiera con los eventos de mouse */
    z-index: 999999; /* Máxima prioridad sobre ventanas e iconos 3D */
    box-sizing: border-box;
}

/* Asegurar que los iconos seleccionados tengan un estilo claro en el entorno 3D */
.icon-selected .desktop-icon-btn {
    box-shadow: inset 4px 4px 8px #b8b9be, inset -4px -4px 8px #ffffff !important;
    border: 2px solid #3b82f6 !important;
    transform: scale(0.98);
}

/* Estructura Ventana */
.window {
    position: absolute;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    overflow: hidden;
    min-width: 300px;
    min-height: 200px;
}
.window.maximized {
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    box-shadow: none;
}
.window-header { cursor: grab; }
.window-header:active { cursor: grabbing; }

/* Animaciones */
.pop-in { animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes popIn {
    0% { transform: scale(0.8) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.pop-out { animation: popOut 0.2s ease forwards; }
@keyframes popOut {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    100% { transform: scale(0.9) translateY(10px); opacity: 0; }
}

/* Scrollbars */
.content-area::-webkit-scrollbar { width: 8px; }
.content-area::-webkit-scrollbar-track { background: #e0e5ec; }
.content-area::-webkit-scrollbar-thumb { background: #a3b1c6; border-radius: 4px; }

/* Archivos y Carpetas */
#desktop-files-layer { position: absolute; top: 0; left: 0; right: 0; bottom: 0; }
.folder-window-content { background: #f0f2f5; }
.ghost-item { pointer-events: none; opacity: 0.7; z-index: 9999; }

/* Data Viewer */
#dv-textarea { font-family: 'Consolas', 'Monaco', monospace; line-height: 1.5; }
#dv-textarea:focus { box-shadow: inset 8px 8px 16px #b8b9be, inset -8px -8px 16px #ffffff; }

/* =========================================
   4. ESTILOS PROGRAMADOR (LAYOUT & SIDEBAR)
   ========================================= */

.prog-wrapper {
    display: flex;
    height: 100%;
    width: 100%;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'SilenosEmojis', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* También aquí por si acaso */
    overflow: hidden;
}

/* --- BARRA LATERAL (GRID 3 COLUMNAS) --- */
.prog-sidebar {
    width: 25%;
    max-width: 340px;
    min-width: 100px;
    background-color: #252526;
    border-right: 1px solid #454545;
    padding: 10px;
    display: grid; /* MODO GRID ACTIVADO */
    grid-template-columns: repeat(2, 1fr); /* 3 COLUMNAS */
    grid-auto-rows: min-content;
    gap: 8px;
    flex-shrink: 0;
    overflow-y: auto;
    align-content: start;
    z-index: 20;
}

/* --- FICHAS DE MÓDULOS EN LA BARRA LATERAL --- */
/* Unificamos estilos para .prog-draggable y .prog-palette-item por si usas uno u otro */
.prog-draggable, .prog-palette-item {
    background-color: #333333;
    border-left: 3px solid #007acc;
    color: white;
    padding: 8px 4px;
    border-radius: 4px;
    cursor: grab;
    user-select: none;
    font-weight: 500;
    
    /* Disposición vertical para que quepan en el grid */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    transition: transform 0.1s, background-color 0.1s;
    font-size: 0.75rem;
    min-height: 60px; /* Cuadrados */
    word-break: break-word;
    margin: 0; /* Reseteamos márgenes antiguos */
}

.prog-draggable:hover, .prog-palette-item:hover {
    transform: translateY(-2px);
    background-color: #3f3f3f;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.prog-draggable:active, .prog-palette-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* =========================================
   5. ESTILOS CANVAS (NODOS Y CONEXIONES)
   ========================================= */

.prog-main {
    flex: 1; /* Ocupa el resto del espacio */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at center, #2a2a2a 0%, #1e1e1e 100%);
}

.prog-editor-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #1e1e1e;
    /* Patrón de fondo opcional para guiar la vista */
    background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 20px 20px;
}

.prog-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
}

.prog-connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

/* --- ESTILO DE LOS NODOS EN EL CANVAS --- */
.prog-node {
    position: absolute;
    width: 200px;
    background: #252526;
    border: 1px solid #454545;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.prog-node-header {
    padding: 6px 10px;
    background: #333;
    border-bottom: 1px solid #222;
    border-radius: 7px 7px 0 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #aaa;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prog-node-close {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
}
.prog-node-close:hover { color: #ff5555; }

.prog-node-body {
    padding: 8px;
    font-size: 0.8rem;
    color: #ccc;
}

.prog-node input, .prog-node select, .prog-node textarea {
    width: 100%;
    background: #111;
    border: 1px solid #444;
    color: #eee;
    padding: 4px;
    margin-top: 4px;
    border-radius: 3px;
    font-size: 0.7rem;
    box-sizing: border-box; /* Importante para que no se salgan */
}

/* --- PUERTOS DE CONEXIÓN --- */
.prog-ports {
    display: flex;
    justify-content: space-between;
    padding: 0 4px 6px 4px;
    margin-top: auto;
}

.prog-port {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #555;
    border: 2px solid #252526;
    cursor: crosshair;
    transition: background 0.2s;
    position: relative;
    z-index: 5;
}

.prog-port:hover {
    background: #fff;
    transform: scale(1.2);
}

.prog-port-in { margin-left: -6px; }  /* Ajuste para que sobresalgan un poco */
.prog-port-out { margin-right: -6px; }

/* =========================================
   6. CONSOLA Y HERRAMIENTAS
   ========================================= */

.prog-console-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: rgba(0,0,0,0.9);
    color: #0f0;
    font-family: monospace;
    font-size: 0.7rem;
    padding: 8px;
    overflow-y: auto;
    z-index: 50;
    border-top: 1px solid #333;
}

.prog-log-line { margin-bottom: 4px; border-bottom: 1px solid #222; padding-bottom: 2px; }

.prog-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    gap: 8px;
}

.prog-btn-float {
    background: #2ea043;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Modal y Popups */
.prog-modal-bg { position:absolute; inset:0; background:rgba(0,0,0,0.8); z-index:200; display:flex; justify-content:center; align-items:center; }
.prog-modal { width: 600px; height: 500px; background: #252526; border: 1px solid #444; border-radius: 8px; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 10px 30px #000; }
.prog-modal-head { padding: 10px; background: #333; font-weight:bold; color:#ddd; display:flex; justify-content:space-between; }
.prog-modal-body { flex:1; padding:15px; overflow-y:auto; color:#ccc; font-size:0.85rem; }
.prog-tab-bar { display:flex; gap:10px; margin-bottom:15px; border-bottom:1px solid #444; }
.prog-tab { padding: 5px 10px; cursor:pointer; opacity:0.6; }
.prog-tab.active { opacity:1; border-bottom:2px solid #007acc; color:white; }

/* Controles dinámicos en nodos */
.prog-dynamic-controls { display: flex; justify-content: space-between; padding: 0 5px 5px 5px; margin-top: 5px; border-top: 1px dashed #333; padding-top: 5px; }
.prog-btn-add-port { background: transparent; border: 1px dashed #555; color: #666; font-size: 0.65rem; padding: 2px 6px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.prog-btn-add-port:hover { border-color: #007acc; color: #007acc; background: rgba(0, 122, 204, 0.1); }
/* --- NOTIFICACIONES DE PROCESOS (TOASTS) --- */
#process-list {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10000;
    pointer-events: none; /* Permite clicks a través del área vacía */
}

.process-toast {
    pointer-events: auto; /* Habilita clicks en la tarjeta */
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    border-left: 4px solid #2ea043; /* Verde ejecución */
    color: #e0e0e0;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    font-family: 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    min-width: 240px;
    animation: slideInRight 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
}

.process-toast.closing {
    animation: slideOutRight 0.3s ease forwards;
}

.process-loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: #2ea043;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.process-close-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.process-close-btn:hover {
    background: rgba(255, 50, 50, 0.2);
    color: #ff4444;
}

@keyframes slideInRight {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* SILENOS 3/styles.css */

/* =========================================
   ESTILOS 3D PARA ESCRITORIO (Z-ENVIRONMENT)
   ========================================= */

/* SILENOS 3/styles.css - ACTUALIZACIÓN DE RENDIMIENTO */

/* Forzar aceleración de hardware en el escritorio */
#desktop-area {
    perspective: 1200px;
    perspective-origin: center;
    overflow: hidden;
    background: radial-gradient(circle at center, #f0f2f5 0%, #e0e5ec 100%);
    /* Capa GPU */
    transform: translateZ(0); 
    backface-visibility: hidden;
}

#desktop-files-layer {
    transform-style: preserve-3d;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    /* Hint para el navegador */
    will-change: transform;
}

/* Optimización de iconos 3D */
.desktop-icon-3d {
    position: absolute;
    pointer-events: auto;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

/* Evitar repintados costosos en el texto de los iconos */
.desktop-icon-3d span {
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(1px); /* Asegura que el texto esté en su propia capa */
}

/* Desactivar efectos pesados en móviles o navegadores lentos */
@media (prefers-reduced-motion: reduce) {
    .desktop-icon-3d {
        transition: none !important;
    }
}