:root {
    /* Brand Colors - Container Blue Theme */
    --primary: #2563EB;
    --primary-hover: #3B82F6;
    --accent: #F59E0B;
    --accent-hover: #D97706;
    
    /* Semantic Colors */
    --success: #10B981;
    --success-light: rgba(16, 185, 129, 0.1);
    --warning: #F59E0B;
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger: #EF4444;
    --danger-light: rgba(239, 68, 68, 0.1);
    --info: #3B82F6;
    
    /* Backgrounds & Surfaces */
    --bg-base: #0F172A; /* Slate 900 */
    --bg-surface: #1E293B; /* Slate 800 */
    --bg-surface-hover: #334155; /* Slate 700 */
    --border: #334155;
    
    /* Text */
    --text-main: #F8FAFC; /* Slate 50 */
    --text-muted: #94A3B8; /* Slate 400 */
    
    /* Docker Keywords */
    --kw-from: #8B5CF6; /* Violet */
    --kw-run: #EC4899; /* Pink */
    --kw-copy: #10B981; /* Emerald */
    --kw-add: #10B981;
    --kw-cmd: #F59E0B; /* Amber */
    --kw-entrypoint: #F59E0B;
    --kw-expose: #06B6D4; /* Cyan */
    --kw-env: #3B82F6; /* Blue */
    --kw-workdir: #6366F1; /* Indigo */
    --kw-user: #8B5CF6;
    --kw-arg: #3B82F6;
    
    /* Layout */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

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

/* Utilities */
.hidden { display: none !important; }
.text-primary { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.w-full { width: 100%; }

/* Glassmorphism */
.glassmorphism {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-panel {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    height: 64px;
    flex-shrink: 0;
    z-index: 10;
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

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

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Main Content Split Layout */
.main-content {
    flex-grow: 1;
    overflow: hidden;
    padding: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    height: 100%;
}

@media (min-width: 1024px) {
    .split-layout {
        grid-template-columns: 40% 60%;
    }
}

/* Left Pane: Editor */
.editor-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.pane-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
}

.pane-header h2, .pane-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.pane-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.editor-container {
    display: flex;
    flex-grow: 1;
    position: relative;
    background: #020617; /* Slate 950 */
    overflow: hidden;
}

.line-numbers {
    padding: 1rem 0.5rem;
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: right;
    min-width: 2.5rem;
    user-select: none;
    line-height: 1.6;
    overflow-y: hidden;
}

.code-input, .code-display {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 1rem;
    resize: none;
    outline: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-display {
    display: block;
    margin: 0;
}

.pane-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.2);
}

/* Right Pane: Analysis */
.analysis-pane {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    flex-shrink: 0;
}

.stat-card {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    flex-grow: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    height: 100%;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Layer Visualization */
.layers-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stages-wrapper {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow-y: auto;
    height: 100%;
}

.stage-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
}

.stage-header {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.stage-header::after {
    content: '';
    flex-grow: 1;
    height: 1px;
    background: var(--border);
}

.layer-stack {
    display: flex;
    flex-direction: column;
    /* Reverse order to look like a stack visually */
    flex-direction: column-reverse;
    gap: 4px;
}

.layer-block {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.layer-block:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    background: var(--bg-surface-hover);
}

/* Layer Types */
.layer-block.type-from { border-left: 4px solid var(--kw-from); }
.layer-block.type-run { border-left: 4px solid var(--kw-run); }
.layer-block.type-copy, .layer-block.type-add { border-left: 4px solid var(--kw-copy); }
.layer-block.type-cmd, .layer-block.type-entrypoint { border-left: 4px solid var(--kw-cmd); }
.layer-block.type-env { border-left: 4px solid var(--kw-env); }
.layer-block.type-workdir { border-left: 4px solid var(--kw-workdir); }

.layer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.layer-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
    overflow: hidden;
}

.layer-cmd {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.layer-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.layer-creates-layer {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.2);
}

.layer-creates-layer.yes {
    color: var(--accent);
    border: 1px solid var(--accent-light);
}

.layer-creates-layer.no {
    color: var(--text-muted);
}

.layer-cache {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.cache-good { color: var(--success); }
.cache-bad { color: var(--danger); }
.cache-neutral { color: var(--text-muted); }

.layer-lint {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--warning-light);
    border-radius: 4px;
    border-left: 2px solid var(--warning);
    font-size: 0.8rem;
    color: var(--text-main);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

/* Linting View */
.lint-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lint-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lint-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    gap: 1rem;
}

.lint-item.warning { border-left: 4px solid var(--warning); }
.lint-item.error { border-left: 4px solid var(--danger); }
.lint-item.info { border-left: 4px solid var(--info); }

.lint-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.lint-item.warning .lint-icon { color: var(--warning); }
.lint-item.error .lint-icon { color: var(--danger); }
.lint-item.info .lint-icon { color: var(--info); }

.lint-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.lint-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.lint-content code {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: #020617;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: block;
    word-break: break-all;
}

/* Optimized View */
.optimized-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.optimized-editor-container {
    flex-grow: 1;
    background: #020617;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Syntax Highlighting */
.hl-kw { color: var(--primary-hover); font-weight: bold; }
.hl-str { color: var(--success); }
.hl-arg { color: var(--accent); }
.hl-comment { color: var(--text-muted); font-style: italic; }

/* Buttons & Badges */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}
.btn-outline:hover { background-color: var(--bg-surface-hover); }

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-surface);
    color: var(--text-muted);
}
.badge.warning { background: var(--warning-light); color: var(--warning); }
.badge.success { background: var(--success-light); color: var(--success); }

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 500;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
