/* ==========================================
   LOBOTO-LLM ROASTING STATION CSS DESIGN
   ========================================== */

/* Design Tokens & Variables */
:root {
    --bg-color: #070512;
    --panel-bg: rgba(15, 12, 27, 0.55);
    --panel-border: rgba(255, 255, 255, 0.06);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accents - Cloud AI (Indigo/Pink) */
    --accent-indigo: #6366f1;
    --accent-violet: #8b5cf6;
    --accent-pink: #ec4899;
    --cloud-glow: rgba(99, 102, 241, 0.15);
    
    /* Accents - Local Coper (Orange/Red) */
    --accent-orange: #f97316;
    --accent-rust: #ea580c;
    --accent-red: #ef4444;
    --local-glow: rgba(249, 115, 22, 0.1);
    
    /* Utility States */
    --state-success: #10b981;
    --state-error: #f43f5e;
    --state-warning: #f59e0b;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'Fira Code', monospace;
}

/* Base resets & layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Background Grids & Orbs */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center center;
    z-index: -2;
    pointer-events: none;
}

.glow-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.4;
    z-index: -1;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-violet) 0%, transparent 80%);
    top: -100px;
    right: -100px;
    animation: floatOrb 20s infinite alternate ease-in-out;
}

.orb-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-orange) 0%, transparent 80%);
    bottom: -200px;
    left: -200px;
    animation: floatOrb 25s infinite alternate-reverse ease-in-out;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(60px, 40px) scale(1.1); }
}

/* Core Container */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* HEADER */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-container {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-md);
}

.logo-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px var(--accent-violet));
}

.brand-info h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-info .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.system-summary {
    display: flex;
    gap: 16px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.pulse-green {
    background-color: var(--state-success);
    box-shadow: 0 0 10px var(--state-success);
    animation: pulseGlow 1.5s infinite;
}

.pulse-red {
    background-color: var(--accent-orange);
    box-shadow: 0 0 10px var(--accent-orange);
    animation: pulseGlow 1s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; transform: scale(1.1); }
}

.summary-item .label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
}

.summary-item .value {
    font-size: 12px;
    font-weight: 600;
}

.text-orange {
    color: var(--accent-orange);
}

/* DASHBOARD GRID */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* PANEL CARDS */
.panel-card {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.local-panel {
    box-shadow: inset 0 0 30px rgba(249, 115, 22, 0.02), 0 12px 40px rgba(0, 0, 0, 0.3);
}

.cloud-panel {
    box-shadow: inset 0 0 30px rgba(99, 102, 241, 0.03), 0 12px 40px rgba(0, 0, 0, 0.3);
}

/* Panel Header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.panel-title-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.system-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.font-orange {
    color: var(--accent-orange);
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.1);
}

.font-indigo {
    color: var(--accent-indigo);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.1);
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
}

.panel-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.badge {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
}

.badge-orange {
    background: rgba(249, 115, 22, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.badge-indigo {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-indigo);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* TERMINAL WINDOW */
.terminal-container {
    border-radius: var(--border-radius-md);
    background: #020106;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 280px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

.local-term-border {
    border-color: rgba(249, 115, 22, 0.2);
}

.cloud-term-border {
    border-color: rgba(99, 102, 241, 0.25);
}

.terminal-header {
    background: rgba(15, 12, 27, 0.9);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.window-controls {
    display: flex;
    gap: 6px;
}

.win-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.win-dot.close { background-color: #ff5f56; }
.win-dot.minimize { background-color: #ffbd2e; }
.win-dot.maximize { background-color: #27c93f; }

.window-title {
    margin-left: 16px;
    font-size: 11px;
    color: var(--text-muted);
}

.terminal-body {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar for Terminals */
.terminal-body::-webkit-scrollbar {
    width: 6px;
}
.terminal-body::-webkit-scrollbar-track {
    background: transparent;
}
.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.terminal-line {
    word-break: break-all;
    white-space: pre-wrap;
    line-height: 1.5;
}

.terminal-line.system-msg {
    color: var(--text-muted);
}

.terminal-line.system-msg-cloud {
    color: var(--accent-indigo);
    opacity: 0.8;
}

.terminal-line.tool-log {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.05);
    padding: 4px 8px;
    border-left: 2px stroke #38bdf8;
    border-radius: 0 4px 4px 0;
}

.prompt-line {
    display: flex;
    gap: 8px;
    color: var(--text-primary);
}

.prompt-symbol {
    color: var(--accent-orange);
    font-weight: 600;
}

.prompt-symbol-cloud {
    color: var(--accent-indigo);
    font-weight: 600;
}

.cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent-orange);
}

.cursor-cloud {
    animation: blink 1s step-end infinite;
    color: var(--accent-indigo);
}

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

/* HARDWARE CONTROLS (LOCAL) */
.hardware-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 13px;
    font-weight: 700;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s ease;
}

.fill-orange { background-color: var(--accent-orange); }
.fill-red { background-color: var(--accent-red); }

/* SLIDER styling */
.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 500;
}

.slider-value {
    color: var(--accent-orange);
    font-weight: 600;
}

.neon-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    outline: none;
}

.neon-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.slider-orange::-webkit-slider-thumb {
    background: var(--accent-orange);
    box-shadow: 0 0 10px var(--accent-orange);
}

/* SWITCH styling */
.control-row {
    display: flex;
    align-items: center;
}

.switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
}

.switch-container input {
    accent-color: var(--accent-orange);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* CLOUD STATS (RIGHT) */
.cloud-stats {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.stat-box-cloud {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(99, 102, 241, 0.05);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.text-indigo {
    color: #818cf8;
}

.text-magenta {
    color: var(--accent-pink);
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.25);
}

.stat-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.agent-tool-logs {
    background: #020106;
    border: 1px solid rgba(99, 102, 241, 0.1);
    border-radius: 8px;
    padding: 12px;
    height: 105px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-title {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 4px;
}

.log-lines {
    font-size: 11px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.log-line {
    display: flex;
    gap: 8px;
    align-items: center;
}

.log-timestamp {
    color: var(--text-muted);
}

.log-tool {
    color: #10b981;
}

.log-target {
    color: #6366f1;
}

.log-empty {
    color: var(--text-muted);
    font-style: italic;
}

/* CONTROLS & COPE BOARD (BOTTOM) */
.bottom-controls {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.section-title-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-violet);
    margin-bottom: 12px;
}

.section-title-bar h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cope Grid */
.cope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.cope-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-md);
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 10px;
    outline: none;
}

.cope-card:hover {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.1);
}

.cope-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
}

.card-author {
    color: var(--text-muted);
}

.card-tag {
    color: var(--accent-orange);
    font-weight: 600;
}

.cope-card:hover .card-tag {
    color: var(--accent-pink);
}

.cope-card-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Action inputs */
.input-action-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .input-action-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

.custom-input-wrapper {
    flex-grow: 1;
    display: flex;
    background: #020106;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 30px;
    padding: 4px 4px 4px 16px;
    align-items: center;
    transition: var(--transition-smooth);
}

.custom-input-wrapper:focus-within {
    border-color: var(--accent-violet);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.custom-input-wrapper input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 8px 0;
}

.custom-input-wrapper input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    border-radius: 30px;
    padding: 10px 24px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-violet) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-red) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.25);
    white-space: nowrap;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
    animation: jitter 0.15s infinite;
}

@keyframes jitter {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    20% { transform: translate(-1px, 1px) rotate(-0.5deg); }
    40% { transform: translate(1px, -1px) rotate(0.5deg); }
    60% { transform: translate(-1px, -1px) rotate(0.5deg); }
    80% { transform: translate(1px, 1px) rotate(-0.5deg); }
}

/* LOBOTOMATOR COMPARISON DRAWER */
.lobotomator-drawer {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.architecture-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .architecture-grid {
        grid-template-columns: 1fr;
    }
}

.arch-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.arch-box h3 {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
}

.local-arch h3 {
    color: var(--accent-orange);
}

.cloud-arch h3 {
    color: var(--accent-indigo);
}

.code-preview {
    font-size: 11px;
    color: var(--text-secondary);
    background: #020106;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 14px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

/* MELTDOWN OVERLOAD STATES */
body.overloaded .glow-orb.orb-2 {
    background: radial-gradient(circle, var(--accent-red) 0%, transparent 80%);
    width: 800px;
    height: 800px;
    opacity: 0.6;
}

body.overloaded {
    animation: screenShake 0.1s infinite alternate;
}

@keyframes screenShake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    100% { transform: translate(-1px, -1px) rotate(0deg); }
}

/* APP FOOTER */
.app-footer {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    line-height: 1.5;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
