:root {
    --bg-main: #0B0F19; /* Slate 950ish */
    --bg-pane: rgba(30, 41, 59, 0.4);
    --border-color: rgba(71, 85, 105, 0.5);
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --accent-blue: #3B82F6; /* Indigo/Blue */
    --accent-blue-glow: rgba(59, 130, 246, 0.2);
    --accent-green: #10B981;
    --terminal-bg: #030712;
    --terminal-text: #10B981;
    --terminal-tool: #F59E0B; /* Amber for tool calls */
}

[data-theme="light"] {
    --bg-main: #F8FAFC; 
    --bg-pane: rgba(255, 255, 255, 0.7);
    --border-color: rgba(203, 213, 225, 0.8);
    --text-main: #0F172A;
    --text-muted: #64748B;
    --terminal-bg: #F1F5F9;
    --terminal-text: #059669;
    --terminal-tool: #D97706;
}

/* Theme Button */
.theme-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}
.theme-btn:hover {
    background: rgba(128,128,128,0.1);
    color: var(--text-main);
}


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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.05), transparent 25%);
    transition: background-color 0.4s ease, color 0.4s ease;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.logo {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.header-title {
    font-weight: 500;
    color: var(--text-muted);
}

.primary-btn {
    background-color: var(--accent-blue);
    color: #fff;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px var(--accent-blue-glow);
}

.primary-btn:hover {
    background-color: #2563EB;
    transform: translateY(-1px);
}

.primary-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    box-shadow: none;
    color: var(--text-muted);
}

/* Workspace Layout */
.workspace {
    display: flex;
    gap: 1.5rem;
    flex: 1;
    min-height: 0; /* Important for flex-child scrolling */
}

.pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-pane);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.pane-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.badge {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
}

.badge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Left Pane: Document */
.document-container {
    flex: 1;
    background: #ffffff;
    color: #0f172a;
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.mock-pdf .pdf-header {
    text-align: center;
    margin-bottom: 2rem;
}

.mock-pdf .pdf-header p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.mock-pdf .pdf-body p {
    margin-bottom: 0.5rem;
}

.mock-pdf .messy-notes {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-left: 4px solid #cbd5e1;
    font-family: 'Architects Daughter', cursive, sans-serif; 
    /* simulated messy output */
}

/* The "Eyes" Scanner Effect */
.scanner-bar {
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 10px;
    background: var(--accent-blue);
    box-shadow: 0 0 30px 10px rgba(59, 130, 246, 0.5);
    opacity: 0;
    z-index: 10;
}

@keyframes scanAction {
    0% { top: 0%; opacity: 1; }
    50% { top: 100%; opacity: 1; }
    100% { top: 0%; opacity: 1; }
}

.scanner-active {
    animation: scanAction 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Right Pane: Terminal & Data */
.right-pane {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.terminal-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.terminal-log {
    flex: 1;
    background: var(--terminal-bg);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: background-color 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.log-entry { margin: 0; }
.log-vision { color: var(--accent-blue); }
.log-reasoning { color: var(--text-main); }
.log-tool { color: var(--terminal-tool); font-weight: 600; }
.log-success { color: var(--accent-green); }

.database-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.9rem;
}

.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table th {
    background: rgba(255,255,255,0.05);
    font-weight: 600;
    color: var(--text-muted);
}

.empty-state {
    text-align: center !important;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem !important;
}

/* Footer */
.app-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 1.5rem;
    margin-top: auto;
    font-size: 0.8rem;
    color: #475569;
}

.pulse-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green);
    animation: pulse 2s infinite;
    opacity: 0.2;
}

.pulse-indicator.running {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 8px var(--accent-green); }
    50% { transform: scale(1.5); box-shadow: 0 0 15px var(--accent-green); }
    100% { transform: scale(1); box-shadow: 0 0 8px var(--accent-green); }
}

/* Typing Effect Cursor */
.type-cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background: var(--text-main);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
    margin-left: 4px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}
