:root {
    /* Core Palette - Dark Mode Only */
    --bg-deep: #000000;
    --bg-surface: #09090b;
    --bg-panel: rgba(24, 24, 27, 0.8);
    --bg-elevated: #27272a;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #52525b;
    --text-accent: #e2e8f0;

    /* RGB Premium Accents */
    --accent-cyan: #22d3ee;
    --accent-magenta: #e879f9;
    --accent-blue: #60a5fa;
    --accent-purple: #a78bfa;
    --accent-gradient: linear-gradient(90deg, #22d3ee, #818cf8, #e879f9);
    --card-gradient: linear-gradient(145deg, rgba(16, 30, 45, 0.9), rgba(20, 20, 35, 0.9));
    
    /* Borders & Glass */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-glow: rgba(255, 255, 255, 0.15);
    --glass-blur: blur(20px);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Ambient RGB Background Effect */
.ambient-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: -1;
    background: 
        radial-gradient(circle at 15% 50%, rgba(6, 182, 212, 0.08), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(217, 70, 239, 0.06), transparent 40%);
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

/* Navigation / Sidebar */
.sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-gradient);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.1) 0%, transparent 100%);
    color: var(--accent-cyan);
    border-left: 2px solid var(--accent-cyan);
    text-shadow: 0 0 10px rgba(34, 211, 238, 0.4);
}

/* Main Content Area */
.main-stage {
    position: relative;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    overflow-y: auto;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.breadcrumbs {
    color: var(--text-muted);
    font-size: 13px;
    font-family: var(--font-mono);
}

.action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
}

/* The Prompt Editor Card */
.editor-card {
    flex-grow: 1;
    background: linear-gradient(160deg, #111827, #0f1219);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 20px;
    padding: 0;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.editor-card:focus-within {
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(6, 182, 212, 0.2);
    border-color: rgba(6, 182, 212, 0.2);
}

/* Stunning Gradient Header for Card */
.editor-card-header {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 50%, rgba(147, 51, 234, 0.15) 100%);
    padding: 32px 32px 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.editor-card-body {
    padding: 24px 32px 32px 32px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.editor-title {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 28px;
    font-weight: 700;
    width: 100%;
    outline: none;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.editor-title::placeholder {
    color: var(--text-muted);
}

.editor-textarea {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-family: var(--font-mono);
    font-size: 16px;
    line-height: 1.7;
    resize: none;
    outline: none;
    width: 100%;
    min-height: 200px;
}

.editor-textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Footer Stats in Editor */
.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: var(--space-md);
    margin-top: var(--space-md);
    color: var(--text-muted);
    font-size: 12px;
    font-family: var(--font-mono);
}

/* Right Control Panel */
.control-deck {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    overflow-y: auto;
}

.deck-section {
    margin-bottom: 32px;
}

.deck-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-weight: 600;
}

/* Custom Range Slider */
.slider-group {
    margin-bottom: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.range-input {
    width: 100%;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    appearance: none;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-cyan);
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
    transition: transform 0.1s;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent-cyan);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--bg-elevated);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--accent-blue);
}

.toggle-knob {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-switch.active .toggle-knob {
    transform: translateX(16px);
}

/* Primary Generate Button */
.btn-generate {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    padding: 14px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: auto;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(217, 70, 239, 0.4);
}

.btn-generate::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.btn-generate:hover::before {
    left: 100%;
}

/* Chips/Tags */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.tag:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.tag.selected {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-color: transparent;
    color: #000;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(34, 211, 238, 0.3);
}

/* History List in Sidebar */
.history-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.history-title {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 80px 1fr 280px;
    }
    .logo-text { display: none; }
    .nav-text { display: none; }
    .nav-item { justify-content: center; padding: 16px 0; }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: auto;
    }
    .sidebar, .control-deck {
        display: none; /* Simplification for wireframe focus on editor */
    }
}
