/* ============================================
   ThemeForge — AI Color Theme Generator
   A cyberpunk-noir aesthetic with neon accents
   ============================================ */

:root {
    /* Core palette - transitions for theme changes */
    --theme-transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    
    /* Core palette */
    --bg-deep: #0a0a0f;
    --bg-primary: #0d0d14;
    --bg-secondary: #12121c;
    --bg-tertiary: #181824;
    --bg-elevated: #1e1e2e;
    
    /* Text colors */
    --text-primary: #e4e4ef;
    --text-secondary: #9898a8;
    --text-muted: #5a5a6e;
    --text-dim: #3a3a4a;
    
    /* Accent colors - Electric neon */
    --accent-primary: #00f0ff;
    --accent-primary-dim: rgba(0, 240, 255, 0.15);
    --accent-primary-glow: rgba(0, 240, 255, 0.4);
    --accent-secondary: #ff006e;
    --accent-secondary-dim: rgba(255, 0, 110, 0.15);
    --accent-tertiary: #8b5cf6;
    --accent-success: #00ff88;
    --accent-warning: #ffaa00;
    --accent-error: #ff4466;
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(0, 240, 255, 0.3);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-primary-glow);
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
    transition: var(--theme-transition);
}

/* Apply theme transitions to key elements */
.app-header,
.control-panel,
.palette-panel,
.preview-section,
.btn,
.prompt-container,
.status-bar,
.toggle-btn,
.form-group input,
.form-group select,
.color-item,
.info-row,
.toast {
    transition: var(--theme-transition);
}

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

/* Electron draggable title bar region */
.electron-drag-region {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    -webkit-app-region: drag;
    z-index: 1000;
    pointer-events: none;
}

/* Make header buttons clickable over the drag region */
.app-header button,
.app-header a,
.app-header input,
.app-header select {
    -webkit-app-region: no-drag;
}

/* Ambient Background Effects */
.ambient-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.3;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-tertiary) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
    opacity: 0.15;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    padding-top: var(--space-lg);
    padding-left: 100px; /* Space for macOS traffic lights in Electron */
    background: rgba(13, 13, 20, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 100;
    -webkit-app-region: drag;
    min-height: 52px;
}

/* In web mode, restore normal padding */
@media (display-mode: browser) {
    .app-header {
        padding-left: var(--space-xl);
        padding-top: var(--space-md);
    }
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 10px var(--accent-primary-glow));
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: var(--space-sm);
}

/* Main Content Layout */
.main-content {
    display: grid;
    grid-template-columns: 340px 1fr 320px;
    gap: 0;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Panels */
.control-panel,
.palette-panel {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: rgba(13, 13, 20, 0.6);
    backdrop-filter: blur(20px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-tertiary) transparent;
}

.control-panel {
    border-right: 1px solid var(--border-subtle);
}

.palette-panel {
    border-left: 1px solid var(--border-subtle);
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.section-title svg {
    opacity: 0.6;
}

/* Prompt Input */
.prompt-container {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.prompt-container:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

#promptInput {
    width: 100%;
    min-height: 160px;
    padding: var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: none;
    outline: none;
}

#promptInput::placeholder {
    color: var(--text-muted);
}

.prompt-footer {
    display: flex;
    justify-content: flex-end;
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.char-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Image Upload Area */
.image-upload-area {
    position: relative;
    min-height: 120px;
    background: var(--bg-secondary);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--accent-primary);
    background: rgba(0, 240, 255, 0.03);
}

.image-upload-area.drag-over {
    border-color: var(--accent-primary);
    background: var(--accent-primary-dim);
    transform: scale(1.01);
}

.image-upload-area.has-image {
    border-style: solid;
    border-color: var(--border-strong);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    color: var(--text-muted);
    text-align: center;
    transition: all var(--transition-fast);
}

.image-upload-area:hover .upload-placeholder {
    color: var(--text-secondary);
}

.image-upload-area:hover .upload-placeholder svg {
    color: var(--accent-primary);
}

.upload-placeholder svg {
    opacity: 0.6;
    transition: all var(--transition-fast);
}

.upload-placeholder p {
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

.upload-hint {
    font-size: 0.7rem;
    opacity: 0.6;
}

.image-preview {
    display: none;
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    max-height: 160px;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: calc(var(--radius-md) - 2px);
}

.btn-remove-image {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    padding: var(--space-xs);
    opacity: 0;
    transition: all var(--transition-fast);
}

.image-preview:hover .btn-remove-image {
    opacity: 1;
}

.btn-remove-image:hover {
    background: var(--accent-error);
    border-color: var(--accent-error);
}

/* Extracted Palette */
.extracted-palette {
    display: none;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
}

.extracted-palette.visible {
    display: flex;
}

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

.palette-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.extracted-swatches {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.extracted-swatch {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform var(--transition-fast);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.extracted-swatch:hover {
    transform: scale(1.15);
    z-index: 1;
}

.swatch-label {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 6px;
    font-weight: 700;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Options */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.option-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.toggle-group {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.toggle-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn:not(:last-child) {
    border-right: 1px solid var(--border-default);
}

.toggle-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.toggle-btn.active {
    color: var(--accent-primary);
    background: var(--accent-primary-dim);
}

/* Settings Form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.value-display {
    font-family: var(--font-mono);
    color: var(--accent-primary);
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

.form-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898a8' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.model-select-wrapper {
    display: flex;
    gap: var(--space-xs);
}

.model-select-wrapper select {
    flex: 1;
}

/* Range Input */
input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-primary-glow);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--accent-primary) 0%, #00c4cc 100%);
    color: var(--bg-deep);
    font-weight: 600;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 255, 255, 0.2) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover:not(:disabled)::before {
    opacity: 1;
}

.btn-primary:hover:not(:disabled) {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-generate {
    margin-top: auto;
}

.btn-generate.loading .btn-text,
.btn-generate.loading .btn-icon-svg {
    opacity: 0;
}

.btn-generate .btn-loader {
    position: absolute;
    display: none;
}

.btn-generate.loading .btn-loader {
    display: block;
}

.loader-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(10, 10, 15, 0.3);
    border-top-color: var(--bg-deep);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-secondary {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-icon {
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
}

.btn-icon:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
}

.btn-install {
    background: linear-gradient(135deg, var(--accent-success) 0%, #00cc6a 100%);
    color: var(--bg-deep);
}

.btn-install:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.btn-install:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.btn-accent {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-tertiary) 0%, #6d28d9 100%);
    color: white;
}

.btn-accent:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.btn-accent:disabled {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* Status Bar */
.status-bar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition-fast);
}

.status-bar.success .status-indicator {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
}

.status-bar.error .status-indicator {
    background: var(--accent-error);
    box-shadow: 0 0 8px var(--accent-error);
}

.status-bar.loading .status-indicator {
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.preview-header h2 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.preview-actions {
    display: flex;
    gap: var(--space-xs);
}

.canvas-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    overflow: hidden;
}

#themeCanvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.canvas-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    transition: opacity var(--transition-base);
}

.canvas-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-muted);
    text-align: center;
}

.overlay-content svg {
    opacity: 0.3;
}

.overlay-content p {
    font-size: 0.9rem;
}

/* Palette Panel */
.palette-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.palette-empty,
.info-placeholder {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px dashed var(--border-default);
}

.color-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.color-item:hover {
    background: var(--bg-tertiary);
}

.color-swatch-wrapper {
    position: relative;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.color-swatch:hover {
    transform: scale(1.05);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 10px var(--accent-primary-dim);
}

.color-picker-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

.color-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.color-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-hex-input {
    width: 70px;
    padding: 2px 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    transition: all var(--transition-fast);
}

.color-hex-input:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-default);
}

.color-hex-input:focus {
    outline: none;
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.color-hex {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
}

.color-copy {
    padding: var(--space-xs);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
}

.color-item:hover .color-copy {
    opacity: 1;
}

.color-copy:hover {
    color: var(--accent-primary);
}

/* Theme Info */
.theme-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

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

.info-value {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Help Section */
.help-section {
    margin-top: auto;
}

.help-details {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.help-details summary {
    padding: var(--space-md);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    user-select: none;
    transition: background var(--transition-fast);
}

.help-details summary::-webkit-details-marker {
    display: none;
}

.help-details summary:hover {
    background: var(--bg-tertiary);
}

.help-details summary .chevron {
    margin-left: auto;
    transition: transform var(--transition-fast);
}

.help-details[open] summary .chevron {
    transform: rotate(180deg);
}

.help-details[open] summary {
    border-bottom: 1px solid var(--border-subtle);
}

.help-content {
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.help-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.help-item h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.help-item ol {
    margin: 0;
    padding-left: var(--space-lg);
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.help-item li {
    margin-bottom: var(--space-xs);
}

.help-item code {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--accent-primary);
}

.help-item kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-primary);
    box-shadow: 0 2px 0 var(--border-default);
}

.help-item strong {
    color: var(--text-primary);
}

.help-paths {
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

.path-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xs) var(--space-sm);
    font-size: 0.7rem;
    align-items: center;
}

.path-label {
    color: var(--text-muted);
    font-weight: 500;
}

.section-title.clickable {
    cursor: pointer;
}

/* Export Section */
.export-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

.toast.success {
    border-color: var(--accent-success);
}

.toast.error {
    border-color: var(--accent-error);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.success .toast-icon {
    color: var(--accent-success);
}

.toast.error .toast-icon {
    color: var(--accent-error);
}

.toast-message {
    font-size: 0.875rem;
    color: var(--text-primary);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bg-elevated);
}

/* Responsive */
@media (max-width: 1400px) {
    .main-content {
        grid-template-columns: 300px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 280px 1fr;
    }
    
    .palette-panel {
        display: none;
    }
}

@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .control-panel {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        max-height: 50vh;
    }
}

/* ============================================
   Modal Styles
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-large {
    max-width: 1000px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-header h2 svg {
    color: var(--accent-primary);
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* Theme Library Grid */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

.library-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    text-align: center;
}

.library-empty svg {
    opacity: 0.3;
    margin-bottom: var(--space-md);
}

.library-empty p {
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}

.library-empty span {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Theme Card */
.theme-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-primary-dim);
    transform: translateY(-2px);
}

.theme-card-preview {
    height: 80px;
    display: flex;
    padding: var(--space-xs);
    gap: 2px;
}

.theme-card-color {
    flex: 1;
    border-radius: var(--radius-sm);
}

.theme-card-info {
    padding: var(--space-md);
}

.theme-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-card-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.theme-card-actions {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-subtle);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.theme-card:hover .theme-card-actions {
    opacity: 1;
}

.theme-card-actions .btn {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.75rem;
}

/* Color Editor */
.editor-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: var(--space-lg);
    min-height: 400px;
}

.editor-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: 500px;
    overflow-y: auto;
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.editor-section label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.editor-section input[type="text"] {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.editor-section input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-dim);
}

.editor-colors {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.color-edit-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.color-edit-row label {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.color-edit-input {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.color-edit-input input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
}

.color-edit-input input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-edit-input input[type="color"]::-webkit-color-swatch {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
}

.color-edit-input input[type="text"] {
    width: 80px;
    padding: var(--space-xs) var(--space-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

.color-edit-input input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.editor-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow: hidden;
}

.editor-preview canvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* Color category headers in editor */
.color-category {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: var(--space-sm) 0 var(--space-xs);
    border-bottom: 1px solid var(--border-subtle);
    margin-top: var(--space-sm);
}

.color-category:first-child {
    margin-top: 0;
}

