:root {
    --bg-base: #0f172a;
    --bg-mesh: radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.15), transparent 25%),
               radial-gradient(circle at 85% 30%, rgba(168, 85, 247, 0.15), transparent 25%);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-purple: #8b5cf6;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
}

.background-mesh {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-mesh);
    z-index: -1;
}

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

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Header */
header {
    padding: 1.5rem 2rem;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.gradient-text {
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.status-indicator {
    position: relative;
    width: 12px; height: 12px;
}

.pulse-dot {
    position: absolute;
    width: 100%; height: 100%;
    background: var(--accent-red);
    border-radius: 50%;
    z-index: 2;
    transition: background 0.3s ease;
}

.pulse-dot.online { background: var(--accent-green); }

.pulse-ring {
    position: absolute;
    width: 100%; height: 100%;
    background: var(--accent-red);
    border-radius: 50%;
    z-index: 1;
    animation: pulsate 2s infinite ease-out;
}
.online + .pulse-ring {
    background: var(--accent-green);
}

@keyframes pulsate {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

.controls {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.model-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

select {
    background: rgba(15, 23, 42, 0.8);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

select:hover {
    border-color: var(--accent-blue);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.status-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.badge {
    /* Base badge styles */
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
}
.badge-info { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.badge-active { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-stopped { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.badge-pull { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }


/* Main Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 1.5rem;
    min-height: 70vh;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Charts */
.chart-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chart-container {
    padding: 1.5rem;
    flex: 1;
    position: relative;
    min-height: 300px;
}

.legend-filter {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
}
.dot.l1 { background: #3b82f6; }
.dot.perc { background: #10b981; }
.dot.adv { background: #f59e0b; }

/* Terminal */
.log-section {
    height: 350px;
    display: flex;
    flex-direction: column;
}

.badge-live {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: blink 2s infinite;
}

@keyframes blink { 50% { opacity: 0.5; } }

.terminal-container {
    flex: 1;
    background: #000;
    padding: 1rem;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #e2e8f0;
    line-height: 1.5;
}

.terminal-line { margin-bottom: 0.2rem; word-break: break-all; }
.cmd-prompt { color: #10b981; margin-right: 0.5rem; }
.log-error { color: #ef4444; }
.log-warn { color: #f59e0b; }
.log-info { color: #3b82f6; }

.terminal-input-container {
    display: flex;
    align-items: center;
    background: #000;
    padding: 0.75rem 1rem;
    border-top: 1px solid #222;
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
}

.terminal-input-container .cmd-prompt {
    color: #3b82f6;
    font-weight: bold;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

#btn-send-cmd {
    background: #1e293b;
    color: #94a3b8;
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

#btn-send-cmd:hover {
    background: #334155;
    color: white;
}

/* Gallery */
.gallery-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gallery-grid {
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    overflow-y: auto;
    flex: 1;
}

.gallery-item {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item .overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    gap: 1rem;
    padding: 3rem;
    text-align: center;
}

.spinner {
    width: 30px; height: 30px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Custom scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }
