/* ============================================
   Media Factory - 现代极简科技风 UI
   灵感来源: Linear, Vercel, Raycast
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* 深色模式变量（默认） */
:root {
    /* 核心色彩 - 深邃蓝黑主题 */
    --bg-base: #09090b;
    --bg-elevated: #18181b;
    --bg-surface: #27272a;
    --bg-subtle: #3f3f46;
    
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-faint: #52525b;
    
    /* 强调色 - 冷调霓虹 */
    --accent-primary: #22d3ee;
    --accent-secondary: #a78bfa;
    --accent-tertiary: #f472b6;
    --accent-glow: rgba(34, 211, 238, 0.15);
    
    /* 状态色 */
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    
    /* 边框与阴影 */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.15);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 40px rgba(34, 211, 238, 0.1);
    
    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    /* 过渡 */
    --transition-fast: 0.1s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 浅色模式变量 */
:root.light, body.light {
    --bg-base: #fafafa;
    --bg-elevated: #ffffff;
    --bg-surface: #f4f4f5;
    --bg-subtle: #e4e4e7;
    
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --text-muted: #71717a;
    --text-faint: #a1a1aa;
    
    --accent-primary: #0891b2;
    --accent-secondary: #7c3aed;
    --accent-glow: rgba(8, 145, 178, 0.1);
    
    --border-subtle: rgba(0, 0, 0, 0.04);
    --border-default: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.12);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
}

/* 跟随系统主题 - 浅色模式 */
@media (prefers-color-scheme: light) {
    :root:not(.dark) {
        --bg-base: #fafafa;
        --bg-elevated: #ffffff;
        --bg-surface: #f4f4f5;
        --bg-subtle: #e4e4e7;
        
        --text-primary: #18181b;
        --text-secondary: #52525b;
        --text-muted: #71717a;
        --text-faint: #a1a1aa;
        
        --accent-primary: #0891b2;
        --accent-secondary: #7c3aed;
        --accent-glow: rgba(8, 145, 178, 0.1);
        
        --border-subtle: rgba(0, 0, 0, 0.04);
        --border-default: rgba(0, 0, 0, 0.08);
        --border-strong: rgba(0, 0, 0, 0.12);
        
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
        --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    }
}

/* ==================== 基础重置 ==================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

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

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* ==================== 登录模态框 ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

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

.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 32px rgba(34, 211, 238, 0.3);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modal-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    position: relative;
}

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

.text-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);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

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

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

.error-text {
    color: var(--error);
    font-size: 0.85rem;
    text-align: left;
}

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

/* ==================== 按钮样式 ==================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: #09090b;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-base), opacity var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.4);
}

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

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

.btn-primary:disabled::before {
    display: none;
}

/* 次要按钮 */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-secondary:active {
    transform: scale(0.98);
}

/* 幽灵按钮 - 无背景 */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* 图标按钮 */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

/* ==================== 主布局 ==================== */
.main-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-layout.hidden {
    display: none;
}

/* ==================== 顶部导航 ==================== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 56px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 50;
}

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

.nav-center {
    display: none;
}

@media (min-width: 1024px) {
    .nav-center {
        display: block;
    }
}

.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* 侧边栏切换按钮 - 在顶部导航栏 */
.sidebar-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: 0.5rem;
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.sidebar-toggle-btn .collapse-icon {
    width: 18px;
    height: 18px;
    transition: transform var(--transition-base);
}

/* 侧边栏收拢时按钮图标变化 */
body.sidebar-collapsed .sidebar-toggle-btn {
    background: var(--accent-glow);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

.current-model {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: 320px;
}

.current-model svg {
    flex-shrink: 0;
    color: var(--accent-primary);
}

.current-model span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.energy-display {
    display: none;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .energy-display {
        display: flex;
    }
}

.energy-bar {
    width: 80px;
    height: 6px;
    background: var(--bg-surface);
    border-radius: 3px;
    overflow: hidden;
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 主题图标切换 */
body.dark .theme-icon-light {
    display: none;
}

body.light .theme-icon-dark {
    display: none;
}

body.light .theme-icon-light {
    display: block;
}

/* ==================== 侧边栏遮罩 ==================== */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

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

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

/* ==================== 内容区域 ==================== */
.content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ==================== 侧边栏 ==================== */
.sidebar {
    width: 260px;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform var(--transition-slow), width var(--transition-slow);
}

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

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

/* 无障碍辅助类 */
.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;
}

/* ==================== 搜索框 ==================== */
.sidebar-search {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.search-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-count {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.search-count.hidden {
    display: none;
}

/* ==================== 侧边栏内容 ==================== */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    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-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.75rem;
}

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

.category-group {
    margin-bottom: 0.75rem;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.category-title svg {
    color: var(--accent-primary);
}

.sidebar-item {
    display: block;
    padding: 0.5rem 0.625rem;
    margin: 1px 0;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    transition: all var(--transition-fast);
}

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

.sidebar-item.active {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

/* ==================== 主内容区 ==================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-base);
}

.content-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ==================== 卡片 ==================== */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-glow);
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon.purple {
    background: rgba(167, 139, 250, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.empty-icon.cyan {
    background: var(--accent-glow);
    border: 1px solid rgba(34, 211, 238, 0.2);
}

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

.empty-state h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.form-label .required {
    color: var(--error);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

/* ==================== 自定义下拉框 ==================== */
.custom-dropdown {
    position: relative;
}

.dropdown-trigger {
    position: relative;
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.dropdown-trigger:hover {
    border-color: var(--border-strong);
}

.dropdown-trigger:focus,
.custom-dropdown.open .dropdown-trigger {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* 下拉箭头 - 使用伪元素确保显示 */
.dropdown-arrow {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
    transition: transform var(--transition-base);
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.custom-dropdown.open .dropdown-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* 备用方案：CSS箭头 */
.dropdown-trigger::after {
    content: '';
    position: absolute;
    right: 0.875rem;
    top: 50%;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    transition: transform var(--transition-base);
    pointer-events: none;
}

.custom-dropdown.open .dropdown-trigger::after {
    transform: translateY(-30%) rotate(-135deg);
}

/* 如果SVG存在则隐藏伪元素 */
.custom-dropdown .dropdown-arrow ~ .dropdown-trigger::after {
    display: none;
}

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

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

.dropdown-option {
    padding: 0.5rem 0.875rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.dropdown-option.selected {
    background: var(--accent-glow);
    color: var(--accent-primary);
}

/* ==================== 复选框 ==================== */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-checkbox {
    width: 40px;
    height: 22px;
    background: var(--bg-subtle);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition-base);
    appearance: none;
    -webkit-appearance: none;
    border: none;
}

.toggle-checkbox::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.toggle-checkbox:checked {
    background: var(--accent-primary);
}

.toggle-checkbox:checked::before {
    transform: translateX(18px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* 字符计数 */
.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* 嵌套组 */
.nested-group {
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

/* ==================== Toast ==================== */
.toast-container {
    position: fixed;
    top: 4.5rem;
    right: 1rem;
    z-index: 1000;
    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.875rem;
    color: var(--text-primary);
    transform: translateX(120%);
    transition: transform var(--transition-slow);
}

.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-primary); }

/* ==================== 结果展示 ==================== */
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.result-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.result-media {
    width: 100%;
    display: block;
    background: var(--bg-base);
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
}

/* ==================== 动画 ==================== */
@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* ==================== 导航标签 ==================== */
.nav-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-surface);
    padding: 0.25rem;
    border-radius: var(--radius-md);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

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

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

/* ==================== 用户菜单 ==================== */
.user-menu {
    position: relative;
}

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

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

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

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

.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);
    z-index: 100;
    overflow: hidden;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.role-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.role-badge.admin {
    background: rgba(244, 114, 182, 0.2);
    color: #f472b6;
}

.role-badge.user {
    background: rgba(34, 211, 238, 0.2);
    color: var(--accent-primary);
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

/* ==================== 当前模型标签 ==================== */
.current-model-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.current-model-tag.hidden {
    display: none;
}

/* ==================== 页面内容 ==================== */
.page-content {
    height: 100%;
}

.page-content.hidden {
    display: none;
}

/* ==================== 历史记录页面 ==================== */
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.history-filters .custom-dropdown {
    min-width: 120px;
}

.history-filters .dropdown-trigger {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
}

.history-filters .dropdown-menu {
    min-width: 120px;
}

.history-filters .dropdown-option {
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

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

.stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-icon.cyan {
    background: rgba(34, 211, 238, 0.15);
    color: var(--accent-primary);
}

.stat-icon.yellow {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(248, 113, 113, 0.15);
    color: var(--error);
}

.stat-icon.purple {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-secondary);
}

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

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* 历史记录列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

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

.history-item-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.history-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

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

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

.history-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.history-item-model {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.history-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-item-error {
    font-size: 0.8rem;
    color: var(--error);
    margin-top: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* 状态徽章 */
.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.status-success {
    background: rgba(52, 211, 153, 0.2);
    color: var(--success);
}

.status-processing {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.status-pending {
    background: rgba(167, 139, 250, 0.2);
    color: var(--accent-secondary);
}

.status-error {
    background: rgba(248, 113, 113, 0.2);
    color: var(--error);
}

/* 分页 */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

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

/* ==================== 详情模态框 ==================== */
.modal-large {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-content {
    padding-bottom: 1rem;
}

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

.detail-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.model-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.detail-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.json-preview {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}

.error-box {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    color: var(--error);
    font-size: 0.85rem;
}

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

.file-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.file-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.audio-card {
    padding: 1rem;
}

.result-audio {
    width: 100%;
}

.file-preview {
    width: 100%;
    height: 100px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

/* ==================== 响应式 ==================== */
@media (max-width: 1023px) {
    .main-content {
        padding: 1rem;
    }
    
    .content-container {
        gap: 1rem;
    }
    
    .nav-tabs {
        display: none;
    }
}

@media (max-width: 640px) {
    .card {
        padding: 1.25rem;
    }
    
    .card-header {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-item-thumb {
        width: 100%;
        height: 120px;
    }
    
    .history-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
