/* Paleta de colores moderna (Tema Oscuro Profesional) */
:root {
    --bg-app: #1e1e1e;
    --bg-sidebar: #252526;
    --bg-header: #2d2d2d;
    --bg-tab: #1e1e1e;
    --text-main: #cccccc;
    --text-title: #ffffff;
    --text-muted: #858585;
    --accent-blue: #007acc;
    --accent-blue-hover: #005f9e;
    --accent-green: #2ea043;
    --accent-green-hover: #238636;
    --accent-red: #da3633;
    --accent-red-hover: #b32d2a;
    --border-color: #3c3c3c;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }

body { 
    height: 100vh; 
    background-color: var(--bg-app); 
    color: var(--text-main); 
    overflow: hidden;
}

/* Personalizar Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-sidebar); }
::-webkit-scrollbar-thumb { background: #424242; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #4f4f4f; }

/* Contenedor Principal */
.app-container { display: flex; height: 100vh; width: 100vw; }

/* BARRA LATERAL */
.sidebar { 
    width: 280px; 
    background: var(--bg-sidebar); 
    display: flex; 
    flex-direction: column; 
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 15px 20px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1.1rem;
    color: var(--text-title);
    font-weight: 600;
}

.sidebar-content {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
}

.section-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
    margin: 15px 0 10px 5px;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
}

/* Listas de proyectos y archivos */
#project-list { list-style: none; }
#project-list li { margin-bottom: 5px; }

/* BOTONES */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    transition: all 0.2s ease;
}

.btn-primary { background: var(--accent-blue); }
.btn-primary:hover { background: var(--accent-blue-hover); }
.btn-success { background: var(--accent-green); padding: 6px 15px; width: auto; font-size: 0.85rem;}
.btn-success:hover { background: var(--accent-green-hover); }
.btn-danger { background: var(--accent-red); }
.btn-danger:hover { background: var(--accent-red-hover); }
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); color: var(--text-title); }

/* ÁREA DEL EDITOR (Corregido para evitar que el texto empuje la cabecera) */
.editor-area { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    background: var(--bg-app); 
    overflow: hidden; 
}

.editor-header { 
    background: var(--bg-header); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid var(--border-color);
    padding-right: 15px;
    flex-shrink: 0; /* Asegura que la cabecera NUNCA se encoja */
}

.tabs { display: flex; height: 100%; }
.tab {
    padding: 12px 20px;
    background: var(--bg-tab);
    color: var(--text-title);
    border-top: 2px solid var(--accent-blue);
    border-right: 1px solid var(--border-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-wrapper { 
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    min-height: 0; /* Obliga al contenedor a respetar el tamaño de la pantalla */
    overflow: hidden; 
}

.CodeMirror { 
    flex-grow: 1;
    height: 100% !important; 
    font-size: 15px; 
    font-family: 'Consolas', 'Courier New', monospace; 
}

/* RESPONSIVE MÓVIL */
@media (max-width: 768px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: 40vh; border-right: none; border-bottom: 1px solid var(--border-color); }
    .editor-area { height: 60vh; }
    .editor-header { padding: 5px; }
}