/* ==========================================
   1. VARIÁVEIS DARK NEON (FISHCHROM CORE)
   ========================================== */
:root {
    --neon-blue: #00e5ff;   /* MS Whale */
    --neon-orange: #ff9f43; /* GC Marlin */
    --neon-teal: #1de9b6;   /* HPLC Shark */
    
    --bg-body: #050505;     /* Fundo Absoluto */
    --bg-panel: #111111;    /* Lateral/Módulos */
    --bg-module: #1a1a1a;   /* Cards internos */
    
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --border-color: #333333;
    
    --success: #00ff9d;
    --danger: #ff4444;
}

/* ==========================================
   2. RESET E ESTRUTURA BASE
   ========================================== */
* { box-sizing: border-box; font-family: 'Segoe UI', Roboto, sans-serif; }

body {
    margin: 0;
    background-color: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Mantém o scroll apenas nos painéis necessários */
}

/* ==========================================
   3. HEADER GLOBAL
   ========================================== */
.app-header {
    background-color: #000;
    border-bottom: 2px solid #333; /* Cor alterada via inline no HTML por instrumento */
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 55px;
    flex-shrink: 0;
    z-index: 100;
}

.brand { font-weight: bold; font-size: 1.2rem; letter-spacing: 1px; }
.model { margin-left: 10px; font-size: 0.8rem; background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; }

/* ==========================================
   4. LAYOUT PRINCIPAL
   ========================================== */
.main-layout { display: flex; flex: 1; height: calc(100vh - 55px); overflow: hidden; }

.side-panel {
    width: 340px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 15px;
    overflow-y: auto;
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    flex-shrink: 0;
}

.display-area {
    flex: 1;
    display: flex; 
    flex-direction: column; 
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-body);
}

/* ==========================================
   5. MÓDULOS E ENTRADA DE DADOS
   ========================================== */
.module {
    background: var(--bg-module);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 12px;
}

.module h3 {
    margin: 0 0 12px 0; 
    font-size: 0.8rem; 
    text-transform: uppercase;
    border-bottom: 1px solid #444; 
    padding-bottom: 5px;
}

.input-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.input-row label { font-size: 0.8rem; color: #bbb; }

input, select {
    background: #252525;
    border: 1px solid #444;
    color: white;
    padding: 6px;
    border-radius: 3px;
    width: 125px;
}

input:focus, select:focus { border-color: var(--neon-teal); outline: none; }

/* ==========================================
   6. GRID DO GRADIENTE (O FIX DEFINITIVO)
   ========================================== */
/* Alinhamento Tempo | A | B | C | D | X */
.grad-grid-container, .grad-grid-layout, .grad-grid-fixed {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr 35px; 
    gap: 5px;
    align-items: center;
    margin-bottom: 5px;
    width: 100%;
}

.grad-grid-container span, .grad-grid-layout span {
    font-size: 0.65rem;
    font-weight: bold;
    color: var(--text-muted);
    text-align: center;
}

.grad-grid-container input, .grad-grid-layout input {
    width: 100% !important;
    padding: 5px !important;
    text-align: center;
    font-size: 0.8rem;
}

/* Bomba Quaternária - Modo Isocrático */
.solvent-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #222;
    padding: 10px;
    border-radius: 5px;
}
.solv-input-group label { color: var(--neon-teal); font-size: 0.7rem; font-weight: bold; margin-bottom: 3px; display: block; }
.solv-input-group input { width: 100% !important; text-align: center; }

/* ==========================================
   7. DISPLAYS E GRÁFICOS
   ========================================== */
.detector-status {
    background: #000;
    border: 1px solid #444;
    padding: 12px; 
    border-radius: 5px;
    display: flex; 
    justify-content: space-between;
    font-family: monospace; 
    font-size: 0.95rem;
}

.canvas-container {
    background: #000;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 10px;
    flex: 1; 
    min-height: 320px;
    position: relative;
}

/* Tabelas */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: #222; color: #aaa; padding: 10px; text-align: left; border-bottom: 2px solid #333; }
td { padding: 8px 10px; border-bottom: 1px solid #222; color: #ddd; }

/* ==========================================
   8. BOTÕES E AÇÕES
   ========================================== */
.action-zone { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }

button { 
    cursor: pointer; 
    font-weight: bold; 
    border-radius: 4px; 
    padding: 12px; 
    text-transform: uppercase; 
    border: none; 
    transition: 0.2s;
}

.btn-inject { color: #000; background-color: var(--neon-teal); } 
.btn-inject:hover { filter: brightness(1.2); }

.btn-stop { background: #222; color: var(--danger); border: 1px solid var(--danger); }
.btn-stop:hover { background: var(--danger); color: #fff; }

.btn-add { 
    background: transparent; 
    border: 1px dashed #555; 
    color: #888; 
    width: 100%; 
    padding: 10px; 
    font-size: 0.75rem;
}
.btn-add:hover { border-color: #fff; color: #fff; }

.btn-dashboard { 
    background: transparent; 
    border: 1px solid rgba(255,255,255,0.3); 
    color: #fff; 
    padding: 6px 15px; 
    border-radius: 20px; 
    font-size: 0.75rem;
    width: auto;
}

.btn-remove-step, .btn-del-node, .btn-del-step {
    background: #331111;
    color: #ff4444;
    border: 1px solid #ff4444;
    height: 26px;
    width: 100%;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
   9. RESPONSIVIDADE MOBILE
   ========================================== */
@media (max-width: 768px) {
    body { height: auto; overflow-y: auto; }
    .main-layout { flex-direction: column; height: auto; overflow: visible; }
    .side-panel { width: 100%; border-right: none; border-bottom: 2px solid #333; padding-bottom: 25px; }
    .display-area { padding: 10px; }
    .detector-status { flex-direction: column; text-align: center; gap: 8px; }
    
    /* Melhora o toque no celular */
    input, select, button { min-height: 45px; }
    .btn-remove-step, .btn-del-node { min-height: 30px; }
    
    /* Garante que o gráfico não suma */
    .canvas-container { min-height: 280px; }
    
    /* No mobile, o grid do gradiente permite rolagem lateral se necessário */
    #gradUI { overflow-x: auto; padding-bottom: 10px; }
    .grad-grid-container { min-width: 320px; }
}

/* Scrollbars Dark */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #444; }