:root {
    --bg-void: #07090f;
    --bg-panel: rgba(13, 17, 23, 0.85);
    --border-glow: rgba(99, 179, 237, 0.15);
    --accent-threat: #ff4d4d;
    --accent-warning: #eab308;
    --accent-safe: #00e5a0;
    --accent-blue: #3b82f6;
    --text-main: #e2e8f0;
    --text-muted: #64748b;
    --font-mono: 'JetBrains Mono', monospace;
    --font-ui: 'Inter', sans-serif;
}

body {
    margin: 0;
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, transparent 50%);
    background-attachment: fixed;
}

.app-layout {
    display: grid;
    grid-template-areas: 
        "header header header"
        "sidebar main detail"
        "footer footer footer";
    grid-template-columns: 80px 1fr 400px;
    grid-template-rows: 60px 1fr 40px;
    height: 100vh;
    gap: 15px;
    padding: 15px;
    box-sizing: border-box;
}

.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    will-change: transform, opacity;
}

.slide-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.slide-in.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.top-bar { grid-area: header; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
.sidebar { grid-area: sidebar; display: flex; flex-direction: column; align-items: center; padding-top: 20px; }
.main-panel { grid-area: main; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; padding: 20px;}
.detail-panel { grid-area: detail; padding: 20px; display: flex; flex-direction: column; gap: 20px; overflow-y: auto; }
.bottom-bar { grid-area: footer; display: flex; align-items: center; padding: 0 20px; border-radius: 6px; }

h1 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: 1px; }
.highlight { color: var(--accent-blue); }
.mono-text { font-family: var(--font-mono); }
.text-glow { text-shadow: 0 0 8px var(--accent-safe); color: var(--accent-safe); }
.logo-area { display: flex; align-items: center; gap: 10px; }

.system-status { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--accent-safe); letter-spacing: 1px;}
.status-dot { width: 8px; height: 8px; background: var(--accent-safe); border-radius: 50%; box-shadow: 0 0 10px var(--accent-safe); animation: pulse 2s infinite; }

nav { display: flex; flex-direction: column; gap: 20px; width: 100%; align-items: center; }
.nav-item { background: transparent; border: none; color: var(--text-muted); cursor: pointer; padding: 10px; border-radius: 8px; transition: all 0.2s; border-left: 2px solid transparent; }
.nav-item:hover { color: var(--text-main); transform: scale(1.1); }
.nav-item.active { color: var(--accent-blue); border-left-color: var(--accent-blue); background: rgba(59, 130, 246, 0.1); }

.scan-ring { position: relative; padding: 10px; border-radius: 50%; }
.scan-ring.active::before {
    content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent-blue);
    animation: ringPulse 2s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
}
.monitor-btn {
    background: linear-gradient(135deg, #1e293b, #0f172a); border: 1px solid var(--accent-blue);
    color: var(--text-main); padding: 20px 40px; border-radius: 30px; font-size: 16px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.3s;
    position: relative; overflow: hidden; box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}
.monitor-btn::after {
    content: ''; position: absolute; top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}
.monitor-btn.active { background: linear-gradient(135deg, #7f1d1d, #450a0a); border-color: var(--accent-threat); box-shadow: 0 0 30px rgba(239, 68, 68, 0.4); }
.monitor-btn.active::after { animation: btnSweep 2s infinite; }
.status-text { margin-top: 15px; font-size: 14px; color: var(--text-muted); font-family: var(--font-mono); text-align: center; }

.waveform-container {
    width: 90%; max-width: 600px; height: 150px; 
    background-image: repeating-linear-gradient(0deg, transparent, transparent 19px, rgba(99, 179, 237, 0.05) 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, rgba(99, 179, 237, 0.05) 20px);
    border: 1px solid var(--border-glow); border-radius: 8px; margin-top: 30px; position: relative; overflow: hidden;
}
canvas { width: 100%; height: 100%; }
.scanline {
    position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: rgba(0, 229, 160, 0.5);
    box-shadow: 0 0 10px var(--accent-safe); opacity: 0;
}
.scanline.active { animation: scanSweep 3s linear infinite; opacity: 1; }

.threat-header { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.threat-meter { display: flex; gap: 4px; height: 12px; }
.meter-segment { flex: 1; background: #1e293b; border-radius: 2px; transition: background 0.3s, box-shadow 0.3s; }
.meter-segment[data-active="true"][data-color="safe"] { background: var(--accent-safe); box-shadow: 0 0 8px var(--accent-safe); }
.meter-segment[data-active="true"][data-color="warning"] { background: var(--accent-warning); box-shadow: 0 0 8px var(--accent-warning); }
.meter-segment[data-active="true"][data-color="danger"] { background: var(--accent-threat); box-shadow: 0 0 8px var(--accent-threat); }

.module-title { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; margin-bottom: 10px; border-bottom: 1px solid var(--border-glow); padding-bottom: 5px; }
.terminal-box { background: #000; padding: 15px; border-radius: 6px; border: 1px solid #1e293b; min-height: 80px; }
.terminal-text { font-family: var(--font-mono); color: var(--accent-safe); font-size: 13px; line-height: 1.5; }
.cursor { display: inline-block; width: 8px; height: 15px; background: var(--accent-safe); vertical-align: middle; margin-left: 4px; animation: blink 1s step-end infinite; }

.forensic-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.forensic-table th { text-align: left; color: var(--text-muted); font-size: 10px; border-bottom: 1px solid var(--border-glow); padding-bottom: 8px; }
.forensic-table td { padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.vector-label { font-weight: 700; color: var(--text-muted); width: 30%; }
.detail-text { color: #94a3b8; font-size: 12px; line-height: 1.4; }

.badge { padding: 4px 8px; border-radius: 4px; font-weight: 700; font-size: 11px; font-family: var(--font-mono); display: inline-block; }
.badge.safe { background: rgba(0, 229, 160, 0.1); border: 1px solid var(--accent-safe); color: var(--accent-safe); }
.badge.warning { background: rgba(234, 179, 8, 0.1); border: 1px solid var(--accent-warning); color: var(--accent-warning); }
.badge.danger { background: rgba(255, 77, 77, 0.1); border: 1px solid var(--accent-threat); color: var(--accent-threat); }
.entities-cell { display: flex; flex-wrap: wrap; gap: 5px; }

.footer-data { display: flex; gap: 30px; font-size: 12px; color: var(--text-muted); width: 100%; justify-content: space-between; }
.demo-btn { margin-top: 20px; background: transparent; border: 1px dashed var(--text-muted); color: var(--text-muted); padding: 5px 15px; border-radius: 4px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.demo-btn:hover { color: var(--text-main); border-color: var(--text-main); }

.hidden { display: none !important; }
.logs-panel { grid-area: main / main / detail / detail; padding: 30px; overflow-y: auto; }
.table-container { margin-top: 20px; background: #000; padding: 15px; border-radius: 8px; border: 1px solid #1e293b; overflow-x: auto; }
.full-width { width: 100%; min-width: 500px; }
.full-width th, .full-width td { padding: 15px; text-align: left; }
.log-time { color: var(--accent-blue); font-family: var(--font-mono); font-size: 12px; }
.log-snippet { font-style: italic; color: var(--text-muted); font-size: 13px; max-width: 400px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes ringPulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes btnSweep { 0% { left: -100%; } 100% { left: 200%; } }
@keyframes scanSweep { 0% { transform: translateY(0); } 100% { transform: translateY(150px); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@media (max-width: 768px) {
    body { height: auto; min-height: 100vh; overflow-y: auto; }
    .app-layout {
        grid-template-areas: "header" "sidebar" "main" "detail" "footer";
        grid-template-columns: 1fr; 
        grid-template-rows: auto; 
        height: auto; overflow: visible; padding: 10px; gap: 12px;
    }
    .sidebar { flex-direction: row; justify-content: space-around; width: 100%; padding: 5px; margin-top: 5px; }
    nav { flex-direction: row; gap: 5px; }
    .nav-item { flex: 1; display: flex; justify-content: center; border-left: none; border-bottom: 2px solid transparent; padding: 12px 0; border-radius: 6px 6px 0 0; }
    .nav-item.active { border-left-color: transparent; border-bottom-color: var(--accent-blue); background: linear-gradient(0deg, rgba(59, 130, 246, 0.15) 0%, transparent 100%); }
    .panel { margin-bottom: 5px; }
    .main-panel { padding: 30px 10px; }
    .detail-panel, .logs-panel { overflow-y: visible; height: auto; max-height: none; }
    .footer-data { flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; }
    #actionPanel > div { flex-direction: column; gap: 20px; }
}