/* ============================================
   AI Model Generator - Custom Design System
   ============================================ */

:root {
    /* Color Palette - Deep Night Theme (Default) */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a24;
    --bg-card: #16161f;
    --bg-elevated: #1e1e2a;
    
    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --accent-glow: rgba(99, 102, 241, 0.3);
    
    /* Highlight Colors */
    --highlight-cyan: #22d3ee;
    --highlight-pink: #f472b6;
    --highlight-amber: #fbbf24;
    --highlight-emerald: #34d399;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #a5b4fc;
    
    /* Border Colors */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-active: rgba(99, 102, 241, 0.5);
    
    /* Status Colors */
    --status-success: #22c55e;
    --status-warning: #f59e0b;
    --status-error: #ef4444;
    --status-info: #3b82f6;
    
    /* Typography */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px var(--accent-glow);
    
    /* 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);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-elevated: #f8fafc;
    
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #6366f1;
    
    --border-subtle: rgba(0, 0, 0, 0.05);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-active: rgba(99, 102, 241, 0.5);
}

[data-theme="light"] body::before {
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.05), transparent);
}

/* ============================================
   Reset & Base Styles
   ============================================ */

*, *::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-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 92, 246, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   App Layout
   ============================================ */

.app-container {
    display: grid;
    grid-template-columns: 240px 1fr 380px;
    min-height: 100vh;
    gap: 0;
}

@media (max-width: 1400px) {
    .app-container {
        grid-template-columns: 220px 1fr 340px;
    }
}

@media (max-width: 1100px) {
    .app-container {
        grid-template-columns: 200px 1fr;
    }
    .results-panel {
        display: none;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding-bottom: var(--space-lg);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-section {
    flex: 1;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.925rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

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

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

/* Sidebar Controls */
.sidebar-controls {
    padding: var(--space-md) 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.control-group {
    margin-bottom: var(--space-md);
}

.control-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    display: block;
}

/* Language Buttons */
.lang-buttons {
    display: flex;
    gap: var(--space-xs);
}

.lang-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn .flag {
    font-size: 1rem;
}

.lang-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--border-active);
}

.lang-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* Theme Toggle */
.theme-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    border-color: var(--border-active);
}

.theme-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon svg {
    width: 16px;
    height: 16px;
}

/* Show/hide icons based on theme */
[data-theme="dark"] .theme-icon.light,
[data-theme="light"] .theme-icon.dark {
    display: none;
}

[data-theme="dark"] .theme-icon.dark,
[data-theme="light"] .theme-icon.light {
    display: flex;
}

.theme-text {
    flex: 1;
    text-align: left;
}

.sidebar-footer {
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.credits-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    color: var(--highlight-amber);
    font-size: 0.875rem;
    font-weight: 600;
}

.credits-badge svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
    padding: var(--space-2xl);
    overflow-y: auto;
    max-height: 100vh;
}

.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    margin-bottom: var(--space-xl);
}

.panel-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.panel-header h1 .highlight {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.925rem;
}

/* ============================================
   Form Styles
   ============================================ */

.generation-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: var(--space-lg);
}

.form-group.half {
    width: 50%;
}

.form-row {
    display: flex;
    gap: var(--space-lg);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
}

.required {
    color: var(--highlight-pink);
}

/* Select */
.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    padding-right: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.925rem;
    cursor: pointer;
    appearance: none;
    transition: all var(--transition-fast);
}

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

select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Textarea */
textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.925rem;
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition-fast);
}

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

textarea:hover {
    border-color: var(--border-active);
}

textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ============================================
   Image Upload Grid
   ============================================ */

.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.image-upload-slot {
    aspect-ratio: 1;
    background: var(--bg-card);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.image-upload-slot:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.upload-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--space-sm);
    text-align: center;
}

.upload-placeholder svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
}

.upload-placeholder span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-placeholder .formats {
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.image-upload-slot .preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-upload-slot .remove-image {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.image-upload-slot .remove-image:hover {
    background: var(--status-error);
}

/* ============================================
   Single Upload Area
   ============================================ */

.single-upload {
    position: relative;
}

.upload-area {
    padding: var(--space-xl);
    background: var(--bg-card);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-lg);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
}

.upload-area:hover {
    border-color: var(--accent-primary);
    background: var(--bg-elevated);
}

.upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
}

.upload-text {
    font-size: 0.925rem;
    color: var(--text-secondary);
}

.upload-formats {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-preview {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
}

.upload-preview img,
.upload-preview video {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.remove-upload {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.remove-upload:hover {
    background: var(--status-error);
}

/* ============================================
   Motion Options
   ============================================ */

.motion-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.motion-option {
    cursor: pointer;
}

.motion-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.option-card {
    padding: var(--space-md);
    background: var(--bg-card);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
}

.option-card svg {
    width: 28px;
    height: 28px;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.option-card span {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.motion-option:hover .option-card {
    border-color: var(--border-active);
    background: var(--bg-elevated);
}

.motion-option input:checked + .option-card {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

.motion-option input:checked + .option-card svg {
    color: var(--accent-primary);
}

.motion-option input:checked + .option-card span {
    color: var(--accent-primary);
}

/* ============================================
   Slider
   ============================================ */

.slider-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

input[type="range"] {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    appearance: none;
    cursor: pointer;
}

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

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

.slider-value {
    min-width: 40px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-accent);
}

/* ============================================
   Toggle
   ============================================ */

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

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

.toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    position: relative;
    transition: all var(--transition-fast);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.toggle input:checked + .toggle-slider::after {
    left: 23px;
    background: white;
}

.toggle input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.toggle-label {
    font-size: 0.925rem;
    color: var(--text-primary);
}

.toggle-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-left: 56px;
}

/* ============================================
   Cost Indicator
   ============================================ */

.cost-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.cost-indicator svg {
    width: 18px;
    height: 18px;
    color: var(--highlight-amber);
}

.cost-indicator span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.cost-indicator strong {
    color: var(--highlight-amber);
}

/* ============================================
   Generate Button
   ============================================ */

.generate-btn {
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-glow);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    display: flex;
    align-items: center;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

.spinner circle {
    fill: none;
    stroke: currentColor;
    stroke-width: 3;
    stroke-linecap: round;
}

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

/* ============================================
   Character Count
   ============================================ */

.char-count {
    display: block;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

/* ============================================
   Coming Soon
   ============================================ */

.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
    color: var(--text-muted);
}

.coming-soon svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

/* ============================================
   Results Panel
   ============================================ */

.results-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

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

.results-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.feedback-link {
    font-size: 0.8rem;
    color: var(--highlight-cyan);
    text-decoration: none;
}

.feedback-link:hover {
    text-decoration: underline;
}

.results-content {
    flex: 1;
}

/* Demo Section */
.demo-section {
    text-align: center;
}

.demo-section h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.demo-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    background: var(--bg-tertiary);
}

.demo-placeholder {
    padding: var(--space-2xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
}

.demo-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.demo-placeholder span {
    font-size: 0.875rem;
}

.demo-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Job Status */
.job-status {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.status-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.pending {
    background: rgba(251, 191, 36, 0.2);
    color: var(--highlight-amber);
}

.status-badge.processing {
    background: rgba(59, 130, 246, 0.2);
    color: var(--status-info);
}

.status-badge.completed {
    background: rgba(34, 197, 94, 0.2);
    color: var(--status-success);
}

.status-badge.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--status-error);
}

.status-time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

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

/* Result Display */
.result-display {
    margin-bottom: var(--space-lg);
}

.result-media {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-tertiary);
    margin-bottom: var(--space-md);
}

.result-media img,
.result-media video {
    width: 100%;
    display: block;
}

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

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

.action-btn.download {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.action-btn.download:hover {
    background: var(--bg-elevated);
    border-color: var(--border-active);
}

.action-btn.continue {
    background: var(--accent-gradient);
    border: none;
    color: white;
}

.action-btn.continue:hover {
    transform: translateY(-1px);
}

/* History Section */
.history-section {
    margin-top: auto;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.history-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

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

.history-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-md);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.history-item:hover {
    background: var(--bg-elevated);
}

.history-thumb {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-accent);
    text-transform: uppercase;
}

.history-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================
   Settings Panel
   ============================================ */

.settings-form {
    max-width: 700px;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.section-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.section-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.input-hint {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-primary);
}

.replicate-section {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(99, 102, 241, 0.05) 100%);
    border-color: var(--accent-primary);
}

.api-features {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.feature-badge {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feature-badge svg {
    width: 14px;
    height: 14px;
    color: var(--accent-primary);
}

/* Input with visibility toggle */
.input-with-help {
    position: relative;
    display: flex;
    gap: var(--space-xs);
}

.input-with-help input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.input-with-help input::placeholder {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.input-with-help input:hover {
    border-color: var(--border-active);
}

.input-with-help input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.toggle-visibility {
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-visibility:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.toggle-visibility svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* URL Input */
.settings-form input[type="url"] {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.settings-form input[type="url"]:hover {
    border-color: var(--border-active);
}

.settings-form input[type="url"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* API Help Details */
.api-help {
    margin-top: var(--space-sm);
}

.api-help summary {
    font-size: 0.8rem;
    color: var(--highlight-cyan);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.api-help summary:hover {
    color: var(--text-accent);
}

.api-help p {
    margin-top: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-line;
}

/* Provider Tabs */
.provider-tabs {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.provider-tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.provider-tab:hover {
    background: var(--bg-elevated);
    border-color: var(--border-active);
}

.provider-tab.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

.provider-config {
    display: none;
}

.provider-config.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Save Button */
.save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.save-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Toast Notifications
   ============================================ */

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

.toast {
    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);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

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

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

.toast.info {
    border-color: var(--status-info);
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

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

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

.toast.info .toast-icon {
    color: var(--status-info);
}

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

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

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

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Light Theme Adjustments
   ============================================ */

[data-theme="light"] .sidebar {
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .results-panel {
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .settings-section {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-item.active {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .generate-btn {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

[data-theme="light"] .option-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .toast {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
