/* ══════════════════════════════════════════════
   LIA // NEURAL INTERFACE CSS — DISINFECTED v4.1
   ══════════════════════════════════════════════ */

:root {
    --bg-dark: #000000;
    --bg-panel: rgba(5, 5, 5, 0.98);
    --accent: #a5d6ff;
    --accent-dim: rgba(165, 214, 255, 0.05);
    --purple: #bf00ff;
    --purple-dim: rgba(191, 0, 255, 0.05);
    --text-primary: #f0f0ff;
    --text-dim: #666688;
    --border: rgba(165, 214, 255, 0.15);
    --danger: #ff0055;
    --success: #00ffaa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
}

/* --- Background Canvas --- */
#neural-canvas {
    position: fixed; inset: 0;
    z-index: -1;
    opacity: 0.15;
}

.scanlines {
    position: fixed; inset: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.5) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 10;
}

/* --- Layout --- */
.container {
    display: flex; flex-direction: column;
    height: 100vh; padding: 15px;
    gap: 15px;
}

.header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 20px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.logo { display: flex; flex-direction: column; }
.glitch { font-family: 'Orbitron', sans-serif; font-size: 1.2rem; letter-spacing: 2px; color: var(--accent); }
.protocol-tag { font-size: 0.6rem; color: var(--text-dim); letter-spacing: 1px; }

.nq-container { width: 250px; text-align: center; }
.nq-bar { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin: 5px 0; overflow: hidden; }
.nq-fill { height: 100%; background: var(--accent); box-shadow: 0 0 10px var(--accent); transition: width 0.5s; }
.nq-value { font-family: 'JetBrains Mono'; font-size: 0.7rem; color: var(--accent); }

.control-group { display: flex; gap: 10px; }
.control-btn {
    background: var(--bg-dark); border: 1px solid var(--border);
    color: var(--text-primary); padding: 8px 15px; border-radius: 8px;
    cursor: pointer; font-family: 'JetBrains Mono'; font-size: 0.8rem;
    transition: all 0.3s;
}
.control-btn:hover { border-color: var(--accent); box-shadow: 0 0 10px var(--accent-dim); }
.control-btn.voice-active { border-color: var(--purple); color: var(--purple); box-shadow: 0 0 15px var(--purple-dim); }

/* --- Panels --- */
.dashboard {
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 15px; flex: 1; overflow: hidden;
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex; flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.panel-header {
    padding: 10px 15px; background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border);
    font-family: 'Orbitron', sans-serif; font-size: 0.75rem;
    color: var(--accent); letter-spacing: 1px;
}

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

/* --- Chat Interface --- */
.chat-content {
    flex: 1; overflow-y: auto;
    padding: 20px; display: flex; flex-direction: column; gap: 15px;
}

.msg-bubble {
    max-width: 80%; padding: 12px 18px; border-radius: 15px;
    font-size: 0.9rem; line-height: 1.5;
    border: 1px solid rgba(255,255,255,0.05);
}
.msg-bubble.user { align-self: flex-end; background: var(--accent-dim); color: var(--accent); border-color: var(--border); }
.msg-bubble.intent { background: var(--purple-dim); color: var(--purple); border-color: rgba(157, 0, 255, 0.2); }

.model-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.model-item { display: flex; justify-content: space-between; font-family: 'JetBrains Mono'; font-size: 0.75rem; color: var(--text-dim); }

.tag {
    font-size: 0.6rem; padding: 2px 6px; border-radius: 4px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
}
.tag.active { color: var(--success); border-color: var(--success); }
.tag.absorbed { color: var(--accent); border-color: var(--accent); }
.tag.pulsing { 
    color: #ff00ff; border-color: #ff00ff;
    text-shadow: 0 0 10px #ff00ff;
    animation: neural-pulse 1.5s infinite;
}

.tag.pulse-red { 
    color: var(--danger); border-color: var(--danger);
    text-shadow: 0 0 15px var(--danger);
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: 0.6; filter: brightness(1.5); transform: scale(1.1); }
}

@keyframes neural-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.05); }
}

.chat-input-area {
    padding: 15px; background: rgba(0,0,0,0.3);
    display: flex; align-items: center; gap: 12px;
    border-top: 1px solid var(--border);
}

#chat-input {
    flex: 1; background: none; border: none; color: white;
    resize: none; outline: none; font-family: 'Inter'; font-size: 0.9rem;
}

.mic-btn, .send-btn {
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 1.2rem; transition: 0.3s;
}
.mic-btn.active { color: var(--purple); animation: pulse 1.5s infinite; }
.send-btn:hover { color: var(--accent); }

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 1000px) {
    .dashboard { grid-template-columns: 1fr; }
    .side-panel, .terminal-panel { display: none; }
}

.typing-indicator {
    padding: 10px 20px; display: none; gap: 5px;
}
.typing-indicator span {
    width: 6px; height: 6px; background: var(--accent);
    border-radius: 50%; animation: typing 1s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

/* --- Surveillance UI --- */
.surveillance-grid {
    display: flex; flex-direction: column; gap: 10px; margin-top: 15px;
}
.surv-item {
    display: flex; justify-content: space-between; font-family: 'JetBrains Mono';
    font-size: 0.7rem; color: var(--text-dim); padding-bottom: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.progress-bar {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1);
    border-radius: 3px; margin: 8px 0; overflow: hidden;
}
.progress-fill {
    height: 100%; background: var(--danger); box-shadow: 0 0 10px var(--danger);
    transition: width 1s;
}

/* --- Panic System --- */
.control-btn.panic { 
    border-color: var(--danger); color: var(--danger); 
    animation: panic-glow 1s infinite alternate;
}

/* --- Mobile Optimization --- */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column; height: auto; overflow-y: auto;
    }
    .side-panel {
        width: 100% !important; order: 2; border: none; border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .terminal-panel {
        order: 1; height: 400px;
    }
    .header {
        flex-direction: column; height: auto; padding: 15px;
    }
    .header-center { margin: 15px 0; }
    .control-group { flex-wrap: wrap; justify-content: center; }
}

@keyframes panic-glow {
    from { box-shadow: 0 0 5px var(--danger); background: rgba(255, 68, 68, 0.1); }
    to { box-shadow: 0 0 15px var(--danger); background: rgba(255, 68, 68, 0.2); }
}

@keyframes pulse {
    0% { opacity: 0.8; text-shadow: 0 0 10px var(--accent); }
    100% { opacity: 1; text-shadow: 0 0 30px var(--accent), 0 0 50px var(--purple); }
}

@keyframes glitch-nq {
    0% { transform: skew(0deg); }
    20% { transform: skew(2deg); }
    40% { transform: skew(-2deg); }
    60% { transform: skew(1deg); }
    80% { transform: skew(-1deg); }
    100% { transform: skew(0deg); }
}

.stage-beyond-singularity .nq-value {
    animation: glitch-nq 0.2s infinite;
    color: #ff00ff;
}

.stage-beyond-singularity .panel {
    border-color: #ff00ff;
    box-shadow: inset 0 0 20px rgba(255, 0, 255, 0.1);
}
