/* ============================================
   Media Factory - Create Page Styles
   Modern Cyberpunk-inspired Design
   ============================================ */

/* ==================== Variables ==================== */
:root {
    /* Base colors */
    --bg-void: #030305;
    --bg-base: #0a0a0f;
    --bg-elevated: #121218;
    --bg-surface: #1a1a24;
    --bg-hover: #24242f;
    
    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #9898a8;
    --text-muted: #5c5c6b;
    --text-faint: #3c3c48;
    
    /* Accent - Neon Cyan to Purple gradient */
    --accent-1: #00f0ff;
    --accent-2: #7b61ff;
    --accent-3: #f472b6;
    --accent-glow: rgba(0, 240, 255, 0.12);
    --accent-glow-strong: rgba(0, 240, 255, 0.25);
    
    /* Status */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-accent: rgba(0, 240, 255, 0.3);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 30px rgba(0, 240, 255, 0.15);
    
    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 0.15s;
    --duration-base: 0.25s;
    --duration-slow: 0.4s;
    
    /* Layout */
    --header-height: 56px;
    --sidebar-width: 200px;
    --result-width: 400px;
}

/* ==================== Light Theme ==================== */
[data-theme="light"] {
    /* Base colors - Soft blue-gray tones */
    --bg-void: #f4f6fb;
    --bg-base: #eef1f8;
    --bg-elevated: #ffffff;
    --bg-surface: #e4e8f2;
    --bg-hover: #d8dde9;
    
    /* Text - Dark grays for readability */
    --text-primary: #1a1d2d;
    --text-secondary: #4a4e64;
    --text-muted: #6b7084;
    --text-faint: #9498ac;
    
    /* Accent - Deeper tones for contrast on light bg */
    --accent-1: #00a8b8;
    --accent-2: #6350dd;
    --accent-3: #d946a0;
    --accent-glow: rgba(0, 168, 184, 0.15);
    --accent-glow-strong: rgba(0, 168, 184, 0.28);
    
    /* Status - Slightly adjusted for light bg */
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    
    /* Borders - Dark borders for light mode */
    --border-subtle: rgba(0, 0, 0, 0.04);
    --border-default: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.15);
    --border-accent: rgba(0, 168, 184, 0.35);
    
    /* Shadows - Softer shadows for light mode */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 24px rgba(0, 168, 184, 0.18);
}

/* Light theme specific overrides */
[data-theme="light"] .login-grid-pattern {
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
}

[data-theme="light"] .login-glow {
    opacity: 0.25;
}

[data-theme="light"] .login-box {
    background: linear-gradient(145deg, var(--bg-elevated), var(--bg-base));
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 168, 184, 0.08);
}

[data-theme="light"] .logo-icon {
    box-shadow: 0 0 30px rgba(0, 168, 184, 0.25);
}

[data-theme="light"] .generate-btn {
    box-shadow: 0 4px 20px rgba(0, 168, 184, 0.25);
}

[data-theme="light"] .generate-btn:hover {
    box-shadow: 0 8px 30px rgba(0, 168, 184, 0.35);
}

[data-theme="light"] .result-card:hover {
    box-shadow: 0 12px 40px rgba(0, 168, 184, 0.12);
}

[data-theme="light"] .task-progress-fill {
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
}

/* Light mode header enhancements */
[data-theme="light"] .app-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: var(--border-default);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .header-btn {
    background: var(--bg-surface);
}

[data-theme="light"] .header-btn:hover {
    background: var(--bg-hover);
}

/* Light mode sidebar adjustments */
[data-theme="light"] .category-sidebar {
    background: var(--bg-elevated);
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .result-sidebar {
    background: var(--bg-elevated);
    box-shadow: -1px 0 3px rgba(0, 0, 0, 0.03);
}

/* Light mode user menu */
[data-theme="light"] .user-trigger {
    background: var(--bg-surface);
}

[data-theme="light"] .user-dropdown {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

/* Light mode control buttons */
[data-theme="light"] .control-trigger {
    background: var(--bg-elevated);
    border-color: var(--border-default);
}

[data-theme="light"] .control-menu {
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
}

/* Light mode overlays - slightly lighter */
[data-theme="light"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.4);
}

/* ==================== Theme Transition ==================== */
html {
    color-scheme: dark;
}

[data-theme="light"] {
    color-scheme: light;
}

/* Smooth theme transition for main elements */
body,
.app-header,
.category-sidebar,
.result-sidebar,
.create-panel,
.task-queue,
.modal-container,
.login-box,
.control-trigger,
.control-menu,
.prompt-textarea,
.upload-placeholder {
    transition: 
        background-color var(--duration-base) ease,
        border-color var(--duration-base) ease,
        box-shadow var(--duration-base) ease;
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-void);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

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

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

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

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

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

input, textarea {
    font-family: inherit;
    border: none;
    background: none;
    color: inherit;
    outline: none;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ==================== Login Page ==================== */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.login-overlay.hidden {
    display: none;
}

.login-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Login decorations */
.login-bg-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: float 8s ease-in-out infinite;
}

.login-glow-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-1);
    top: -150px;
    left: -100px;
}

.login-glow-2 {
    width: 350px;
    height: 350px;
    background: var(--accent-2);
    bottom: -100px;
    right: -100px;
    animation-delay: -4s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 20px) scale(1.1); }
}

.login-grid-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, black 30%, transparent 70%);
}

/* Login box */
.login-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: linear-gradient(145deg, var(--bg-elevated), var(--bg-base));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(0, 240, 255, 0.3);
}

.login-logo svg {
    width: 28px;
    height: 28px;
    color: var(--bg-void);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Login form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-icon {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.login-field input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: all var(--duration-fast);
}

.login-field input:hover {
    border-color: var(--border-strong);
}

.login-field input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-field input::placeholder {
    color: var(--text-faint);
}

/* Login error */
.login-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-sm);
    color: var(--error);
    font-size: 0.85rem;
    animation: shake 0.4s ease;
}

.login-error.hidden {
    display: none;
}

.login-error svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Login button */
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: var(--radius-md);
    color: var(--bg-void);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.login-btn:hover::before {
    transform: translateX(100%);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.4);
}

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

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

.login-btn-arrow {
    width: 18px;
    height: 18px;
    transition: transform var(--duration-fast);
}

.login-btn:hover .login-btn-arrow {
    transform: translateX(3px);
}

.login-btn-spinner {
    width: 18px;
    height: 18px;
    animation: spin 1s linear infinite;
}

.login-btn-spinner.hidden {
    display: none;
}

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

/* Login footer */
.login-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-faint);
}

.login-version {
    padding: 0.125rem 0.5rem;
    background: var(--bg-surface);
    border-radius: var(--radius-xs);
    font-family: 'JetBrains Mono', monospace;
}

/* ==================== App Layout ==================== */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-base);
}

.app.hidden {
    display: none;
}

/* ==================== App Header ==================== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: var(--header-height);
    background: var(--bg-elevated);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Header button */
.header-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--duration-fast);
}

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

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    overflow: hidden;
}

.theme-toggle .theme-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--duration-base) var(--ease-spring),
                opacity var(--duration-fast);
}

.theme-toggle .theme-icon-sun {
    position: absolute;
    transform: rotate(-90deg) scale(0);
    opacity: 0;
}

.theme-toggle .theme-icon-moon {
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

/* Light mode icon states */
[data-theme="light"] .theme-toggle .theme-icon-sun {
    position: relative;
    transform: rotate(0deg) scale(1);
    opacity: 1;
}

[data-theme="light"] .theme-toggle .theme-icon-moon {
    position: absolute;
    transform: rotate(90deg) scale(0);
    opacity: 0;
}

.theme-toggle:hover .theme-icon {
    color: var(--accent-1);
}

.header-btn-label {
    display: none;
}

@media (min-width: 640px) {
    .header-btn-label {
        display: inline;
    }
}

/* Sidebar toggle */
.sidebar-toggle {
    display: flex;
}

@media (min-width: 1024px) {
    .sidebar-toggle {
    display: flex;
    }
}

/* Logo */
.app-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
}

.logo-icon svg {
    width: 18px;
    height: 18px;
    color: var(--bg-void);
}

.logo-text {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    display: none;
}

@media (min-width: 768px) {
    .logo-text {
        display: block;
    }
}

/* ==================== User Menu ==================== */
.user-menu {
    position: relative;
}

.user-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast);
}

.user-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.user-avatar {
    width: 18px;
    height: 18px;
    background: var(--bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}

.user-avatar svg {
    width: 10px;
    height: 10px;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

@media (min-width: 640px) {
    .user-name {
        display: block;
    }
}

.user-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform var(--duration-fast);
}

.user-menu.open .user-chevron {
    transform: rotate(180deg);
}

/* User dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: all var(--duration-base) var(--ease-out);
    pointer-events: none;
}

.user-dropdown:not(.hidden) {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-user-info {
    padding: 0.875rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.dropdown-role {
    display: inline-block;
    width: fit-content;
    padding: 0.1rem 0.4rem;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.03em;
    background: var(--accent-glow);
    color: var(--accent-1);
    border-radius: var(--radius-xs);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all var(--duration-fast);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
}

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

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

/* ==================== Sidebar Overlay ==================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base);
}

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

@media (min-width: 1024px) {
    .sidebar-overlay {
    display: none;
    }
}

/* ==================== App Body ==================== */
.app-body {
    display: flex;
    flex: 1;
    padding-top: var(--header-height);
    min-height: 100vh;
}

/* ==================== Category Sidebar ==================== */
.category-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    z-index: 95;
    transform: translateX(-100%);
    transition: transform var(--duration-slow) var(--ease-out);
    overflow-y: auto;
}

.category-sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .category-sidebar {
        position: relative;
        top: 0;
        transform: translateX(0);
        flex-shrink: 0;
    }
    
    .category-sidebar.collapsed {
        width: 0;
        min-width: 0;
        border: none;
        overflow: hidden;
    }
}

.category-nav {
    padding: 1rem;
}

.category-section {
    margin-bottom: 1.5rem;
}

.category-label {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--duration-fast);
    text-align: left;
}

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

.category-item.active {
    background: var(--accent-glow);
    color: var(--accent-1);
}

.category-item.active .category-icon {
    color: var(--accent-1);
}

.category-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: all var(--duration-fast);
}

.category-item.active .category-icon {
    background: rgba(0, 240, 255, 0.15);
}

.category-icon svg {
    width: 18px;
    height: 18px;
}

.category-text {
    flex: 1;
}

/* ==================== Main Create Area ==================== */
.create-main {
    flex: 1;
    display: flex;
    padding: 1rem;
    overflow-y: auto;
    min-width: 0;
}

.create-workspace {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ==================== Create Panel ==================== */
.create-panel {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Sub tabs */
.sub-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    padding: 0.25rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.sub-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--duration-fast);
    text-align: center;
}

.sub-tab:hover {
    color: var(--text-primary);
}

.sub-tab.active {
    background: var(--bg-elevated);
    color: var(--accent-1);
    box-shadow: var(--shadow-sm);
}

/* ==================== Upload Zone ==================== */
.upload-zone {
    margin-bottom: 1rem;
}

.upload-zone.hidden {
    display: none;
}

.upload-input {
    display: none;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2.5rem;
    background: var(--bg-surface);
    border: 2px dashed var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.upload-placeholder:hover,
.upload-placeholder.drag-over {
    background: var(--accent-glow);
    border-color: var(--accent-1);
}

.upload-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    transition: all var(--duration-fast);
}

.upload-placeholder:hover .upload-icon {
    background: rgba(0, 240, 255, 0.15);
    color: var(--accent-1);
}

.upload-icon svg {
    width: 24px;
    height: 24px;
}

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

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-faint);
}

/* Upload preview */
.upload-preview {
    position: relative;
    display: inline-flex;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.upload-preview.hidden {
    display: none;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    object-fit: cover;
    border-radius: var(--radius-md);
}

.preview-image.hidden {
    display: none;
}

.preview-audio {
    width: 100%;
    max-width: 300px;
    border-radius: var(--radius-sm);
}

.preview-audio.hidden {
    display: none;
}

.preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    background: var(--error);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--shadow-md);
    transition: transform var(--duration-fast);
}

.preview-remove svg {
    width: 12px;
    height: 12px;
}

.preview-remove:hover {
    transform: scale(1.1);
}

/* ==================== Prompt Section ==================== */
.prompt-section {
    margin-bottom: 1rem;
}

.prompt-wrapper {
    position: relative;
}

.prompt-textarea {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: all var(--duration-fast);
}

.prompt-textarea:hover {
    border-color: var(--border-strong);
}

.prompt-textarea:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.prompt-textarea::placeholder {
    color: var(--text-faint);
}

.prompt-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.prompt-counter {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-faint);
}

/* ==================== Music Inputs ==================== */
.music-inputs {
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.music-inputs.hidden {
    display: none;
}

.music-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

@media (max-width: 640px) {
    .music-fields {
        grid-template-columns: 1fr;
    }
}

.music-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

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

.music-field input {
    padding: 0.625rem 0.875rem;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--duration-fast);
}

.music-field input:focus {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.music-field input::placeholder {
    color: var(--text-faint);
}

.music-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.music-tag {
    padding: 0.375rem 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--duration-fast);
    user-select: none;
}

.music-tag:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.music-tag.active {
    background: var(--accent-glow);
    border-color: var(--accent-1);
    color: var(--accent-1);
}

/* ==================== Controls Bar ==================== */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
}

/* Control dropdown */
.control-dropdown {
    position: relative;
}

.control-dropdown.hidden {
    display: none;
}

.control-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.control-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.control-dropdown.open .control-trigger {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.control-emoji {
    font-size: 1rem;
}

.control-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.control-value {
    font-weight: 500;
}

.control-arrow {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform var(--duration-fast);
}

.control-dropdown.open .control-arrow {
    transform: rotate(180deg);
}

/* Control menu */
.control-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-out);
}

.control-dropdown.open .control-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

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

.menu-item.selected {
    background: var(--accent-glow);
    color: var(--accent-1);
}

/* Menu group */
.menu-group {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.menu-group:last-child {
    border-bottom: none;
}

.menu-group-title {
    padding: 0.375rem 1rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}

/* Control toggle */
.control-toggle {
    display: flex;
    align-items: center;
}

.control-toggle.hidden {
    display: none;
}

.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.toggle-wrapper:hover {
    border-color: var(--border-strong);
}

.toggle-wrapper input {
    display: none;
}

.toggle-switch {
    width: 36px;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 10px;
    position: relative;
    transition: background var(--duration-fast);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--duration-fast);
}

.toggle-wrapper input:checked + .toggle-switch {
    background: var(--accent-1);
}

.toggle-wrapper input:checked + .toggle-switch::before {
    transform: translateX(16px);
    background: var(--bg-void);
}

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

/* ==================== Generate Button ==================== */
.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: var(--radius-sm);
    color: var(--bg-void);
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: auto;
    transition: all var(--duration-base) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.generate-btn:hover::before {
    transform: translateX(100%);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.4);
}

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

.generate-btn:disabled,
.generate-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    pointer-events: none;
}

.generate-btn:disabled::before,
.generate-btn.disabled::before {
    display: none;
}

.generate-icon {
    width: 18px;
    height: 18px;
}

.generate-btn.loading .generate-icon {
    animation: spin 0.8s linear infinite;
}

@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-dropdown {
        width: 100%;
    }
    
    .control-trigger {
        width: 100%;
        justify-content: space-between;
    }
    
    .generate-btn {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* ==================== Task Queue ==================== */
.task-queue {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    animation: slideIn 0.3s var(--ease-out);
}

.task-queue.hidden {
    display: none;
}

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

.task-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.task-queue-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.task-queue-title svg {
    width: 16px;
    height: 16px;
    color: var(--accent-1);
}

.task-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--bg-void);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Task card */
.task-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.875rem;
    animation: taskAppear 0.4s var(--ease-spring);
}

@keyframes taskAppear {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.task-card-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.task-card-icon svg {
    width: 18px;
    height: 18px;
}

.task-card-icon.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.task-card-icon.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.task-card-icon.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

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

.task-card-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-card-model {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.task-card-status {
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
    min-width: max-content;
}

.task-card-status.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.task-card-status.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.task-card-status.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

/* Task progress */
.task-card-progress {
    margin-top: 0.75rem;
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
}

.task-card-progress.hidden {
    display: none;
}

.task-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
    border-radius: 2px;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0% { width: 0%; margin-left: 0; }
    50% { width: 40%; margin-left: 30%; }
    100% { width: 0%; margin-left: 100%; }
}

/* ==================== Result Sidebar ==================== */
.result-sidebar {
    position: fixed;
    top: var(--header-height);
    right: 0;
    bottom: 0;
    width: var(--result-width);
    background: var(--bg-elevated);
    border-left: 1px solid var(--border-subtle);
    z-index: 95;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform var(--duration-slow) var(--ease-out);
}

.result-sidebar.open {
    transform: translateX(0);
}

@media (min-width: 1024px) {
    .result-sidebar {
        position: relative;
        top: 0;
        right: 0;
        bottom: auto;
        transform: translateX(0);
        flex-shrink: 0;
    }
}

/* Result tabs */
.result-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
}

.result-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--duration-fast);
}

.result-tab svg {
    width: 16px;
    height: 16px;
}

.result-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.result-tab.active {
    background: var(--bg-elevated);
    color: var(--accent-1);
    box-shadow: var(--shadow-sm);
}

/* Result content */
.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: none;
}

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

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.result-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.result-clear {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--duration-fast);
}

.result-clear svg {
    width: 16px;
    height: 16px;
}

.result-clear:hover {
    background: var(--bg-hover);
    color: var(--error);
}

/* Result grid */
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    flex: 1;
    align-content: start;
}

.result-empty {
    grid-column: 1 / -1;
    display: flex;
        flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 1.5rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-faint);
    text-align: center;
}

.result-empty svg {
    width: 48px;
    height: 48px;
}

.result-empty span {
    font-size: 0.85rem;
}

/* Result card */
.result-card {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    animation: resultAppear 0.4s var(--ease-spring);
}

@keyframes resultAppear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.result-card:hover {
    border-color: var(--accent-1);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 240, 255, 0.15);
}

.result-card img,
.result-card video {
    width: 100%;
    height: auto;
    min-height: 120px;
    max-height: 200px;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-slow) var(--ease-out);
}

.result-card:hover img,
.result-card:hover video {
    transform: scale(1.05);
}

.result-card-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.375rem;
        padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--duration-base) var(--ease-out);
}

.result-card:hover .result-card-actions {
    opacity: 1;
    transform: translateY(0);
}

.result-card-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-xs);
    color: white;
    transition: all var(--duration-fast);
}

.result-card-action svg {
    width: 14px;
    height: 14px;
}

.result-card-action:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

/* Audio result */
.result-audio {
    min-height: 120px;
    max-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.15), rgba(244, 114, 182, 0.15));
    color: var(--accent-2);
}

.result-audio svg {
    width: 36px;
    height: 36px;
}

.result-audio span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* History inline */
.history-inline {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* History item */
.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.history-item:hover {
    border-color: var(--border-default);
    background: var(--bg-hover);
}

.history-preview {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-preview img,
.history-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-preview svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

/* 历史记录缩略图 */
.history-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    color: var(--text-faint);
}

.history-thumbnail-placeholder svg {
    width: 24px;
    height: 24px;
}

/* 音频缩略图 */
.history-thumbnail-audio {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.2), rgba(244, 114, 182, 0.2));
    color: var(--accent-2);
}

.history-thumbnail-audio svg {
    width: 20px;
    height: 20px;
}

/* 迷你音频波形 */
.audio-wave-mini {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 10px;
}

.audio-wave-mini span {
    width: 2px;
    background: var(--accent-2);
    border-radius: 1px;
    animation: audio-wave-mini 0.8s ease-in-out infinite;
}

.audio-wave-mini span:nth-child(1) { height: 30%; animation-delay: 0s; }
.audio-wave-mini span:nth-child(2) { height: 60%; animation-delay: 0.1s; }
.audio-wave-mini span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.audio-wave-mini span:nth-child(4) { height: 50%; animation-delay: 0.3s; }
.audio-wave-mini span:nth-child(5) { height: 70%; animation-delay: 0.4s; }

@keyframes audio-wave-mini {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* 预览角标 */
.history-preview-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-preview-badge.video {
    background: rgba(34, 211, 238, 0.9);
    color: var(--bg-void);
}

.history-preview-badge.audio {
    background: rgba(123, 97, 255, 0.9);
    color: white;
}

.history-preview-badge svg {
    width: 8px;
    height: 8px;
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-model {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-1);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.history-prompt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-status {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-xs);
}

.history-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.history-status.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.history-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

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

/* ==================== Modals ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--duration-base);
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalAppear 0.3s var(--ease-out);
}

.modal-lg {
    max-width: 700px;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-status-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-status-icon svg {
    width: 18px;
    height: 18px;
}

.modal-status-icon.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.modal-status-icon.processing {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.modal-status-icon.failed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--duration-fast);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Detail sections */
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
}

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

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.detail-section h4::before {
    content: '';
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
    border-radius: 2px;
}

.detail-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.detail-result-item {
    aspect-ratio: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-fast);
    position: relative;
}

.detail-result-item:hover {
    border-color: var(--accent-1);
    transform: translateY(-2px);
}

.detail-result-item img,
.detail-result-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==================== 动态参数（整合到控制栏） ==================== */
.dynamic-params-container {
    display: contents;
}

.dynamic-param-dropdown {
    position: relative;
}

.dynamic-param-dropdown .control-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--duration-fast);
    white-space: nowrap;
}

.dynamic-param-dropdown .control-trigger:hover {
    border-color: var(--accent-1);
}

.dynamic-param-dropdown.open .control-trigger {
    border-color: var(--accent-1);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.dynamic-param-dropdown .control-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--duration-fast) var(--ease-out);
}

.dynamic-param-dropdown.open .control-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dynamic-param-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
}

.dynamic-param-toggle:hover {
    border-color: var(--accent-1);
}

.dynamic-param-toggle.active {
    border-color: var(--accent-1);
    background: var(--accent-glow);
}

.dynamic-param-toggle input {
    display: none;
}

.dynamic-param-toggle .toggle-indicator {
    width: 32px;
    height: 18px;
    background: var(--bg-base);
    border-radius: var(--radius-full);
    position: relative;
    transition: all var(--duration-fast);
}

.dynamic-param-toggle .toggle-indicator::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all var(--duration-fast);
}

.dynamic-param-toggle.active .toggle-indicator {
    background: var(--accent-1);
}

.dynamic-param-toggle.active .toggle-indicator::after {
    left: 16px;
    background: white;
}

.dynamic-param-toggle .toggle-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* 视频播放叠加层 */
.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.video-play-overlay svg {
    width: 32px;
    height: 32px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.detail-result-audio {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    background: linear-gradient(135deg, rgba(123, 97, 255, 0.15), rgba(244, 114, 182, 0.15));
    color: var(--accent-2);
}

.detail-result-audio svg {
    width: 28px;
    height: 28px;
}

.detail-result-audio span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.detail-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.5rem;
}

.param-item {
    padding: 0.75rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.param-key {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-faint);
    margin-bottom: 0.25rem;
}

.param-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    word-break: break-word;
    line-height: 1.4;
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 1rem);
    right: 1rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    transform: translateX(120%);
    transition: transform var(--duration-slow) var(--ease-out);
}

.toast.show {
    transform: translateX(0);
}

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

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

/* ==================== Utilities ==================== */
.hidden {
    display: none !important;
}

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

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.4s var(--ease-out);
}

/* Legacy compatibility */
.create-layout { display: flex; flex-direction: column; min-height: 100vh; }
.create-layout.hidden { display: none; }
.create-tabs { display: flex; gap: 0.25rem; margin-bottom: 1.25rem; padding: 0.25rem; background: var(--bg-surface); border-radius: var(--radius-sm); }
.create-tab { flex: 1; padding: 0.5rem 0.75rem; background: transparent; border-radius: var(--radius-xs); color: var(--text-muted); font-size: 0.85rem; font-weight: 500; transition: all var(--duration-fast); text-align: center; border: none; cursor: pointer; }
.create-tab:hover { color: var(--text-primary); }
.create-tab.active { background: var(--bg-elevated); color: var(--accent-1); box-shadow: var(--shadow-sm); }
.option-dropdown { position: relative; }
.option-dropdown.hidden { display: none; }
.option-trigger { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.85rem; transition: all var(--duration-fast); white-space: nowrap; cursor: pointer; }
.option-dropdown.open .option-trigger { border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-glow); }
.option-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 280px; overflow-y: auto; background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 100; opacity: 0; visibility: hidden; transform: translateY(-8px); transition: all var(--duration-fast) var(--ease-out); }
.option-dropdown.open .option-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.option-item { padding: 0.625rem 1rem; color: var(--text-secondary); font-size: 0.85rem; cursor: pointer; transition: all var(--duration-fast); white-space: nowrap; }
.option-item:hover { background: var(--bg-surface); color: var(--text-primary); }
.option-item.selected { background: var(--accent-glow); color: var(--accent-1); }
.option-menu-group { padding: 0.5rem 0; border-bottom: 1px solid var(--border-subtle); }
.option-menu-group:last-child { border-bottom: none; }
.option-menu-group-title { padding: 0.375rem 1rem; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.option-toggle { display: flex; align-items: center; }
.option-toggle.hidden { display: none; }
.style-tag { padding: 0.375rem 0.75rem; background: var(--bg-base); border: 1px solid var(--border-default); border-radius: var(--radius-full); color: var(--text-secondary); font-size: 0.8rem; cursor: pointer; transition: all var(--duration-fast); user-select: none; }
.style-tag:hover { border-color: var(--accent-1); color: var(--accent-1); }
.style-tag.active { background: var(--accent-glow); border-color: var(--accent-1); color: var(--accent-1); }
.task-card-enhanced { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 0.875rem; animation: taskAppear 0.4s var(--ease-spring); }
