/* ============================================
   AI Script Optimizer - HeyGen Style
   Clean, minimal, professional
   ============================================ */

/* ============================================
   CSS Variables - Reduced sizes for compact layout
   ============================================ */
:root {
    /* Colors */
    --primary: #8B5CF6;
    --primary-light: #A78BFA;
    --primary-dark: #7C3AED;
    
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    
    --border-light: #E5E7EB;
    --border-normal: #D1D5DB;
    
    --success: #10B981;
    --error: #EF4444;
    
    /* Spacing - Reduced */
    --space-2: 0.5rem;
    --space-3: 0.5rem;
    --space-4: 0.75rem;
    --space-5: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 1.75rem;
    --space-12: 2rem;
    
    /* Radius */
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Base Styles
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
}

/* Hide old background */
.background {
    display: none;
}

/* ============================================
   Header - Clean & Simple
   ============================================ */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-8);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo:hover {
    opacity: 0.8;
}

.logo-icon {
    font-size: 1.25rem;
}

.nav-menu {
    display: flex;
    gap: var(--space-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

.nav-link.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    font-size: 1rem;
}

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

.user-plan-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.5rem 0.875rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.user-plan-btn:hover {
    border-color: var(--border-normal);
}

.plan-badge {
    padding: 0.1875rem 0.625rem;
    background: var(--primary);
    color: white;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.dropdown-arrow {
    font-size: 0.625rem;
    transition: transform 0.2s;
}

.user-plan-btn.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-light);
    min-width: 200px;
    overflow: hidden;
    z-index: 1000;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}

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

.dropdown-item .item-icon {
    font-size: 1rem;
}

.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 1rem;
    min-height: calc(100vh - 60px);
}

/* ============================================
   Sidebar - Clean History
   ============================================ */
.sidebar {
    width: 240px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.new-task-btn {
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.new-task-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}

.sidebar-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    max-height: 90vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-3);
}

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

.task-item {
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
}

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

.task-item.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--primary);
}

.task-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-item-time {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.empty-task-list {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.875rem;
    padding: var(--space-8) var(--space-4);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
    margin-left: 1rem;
    position: relative;
    height: 100%;
}

/* Make input area always visible */
.chat-input-area {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    box-sizing: border-box; /* ensure width calculation matches container */
    position: sticky;
    bottom: 8px; /* keep on first screen */
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
}

.page-header {
    text-align: center;
    padding: var(--space-4) 0;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Chat Container - Compact
   ============================================ */
.chat-container {
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    overflow: hidden;
    min-height: 600px;
    max-height: 92vh;
}

.chat-container.has-messages {
    display: flex;
    flex: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: 3px;
}

/* ============================================
   Message Bubbles
   ============================================ */
.message-wrapper {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.message-wrapper.user-message {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 85%;
    padding: var(--space-4);
    border-radius: var(--radius-xl);
}

.user-message .message-bubble {
    background: var(--primary);
    color: white;
}

.ai-message .message-bubble {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.message-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.message-avatar {
    font-size: 1.125rem;
}

.message-sender {
    font-weight: 600;
    font-size: 0.875rem;
}

.message-content p {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: var(--space-2);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-script {
    background: rgba(0, 0, 0, 0.05);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    margin-top: var(--space-3);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.8125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

/* ============================================
   Optimization Preview - Compact
   ============================================ */
.optimization-preview {
    background: linear-gradient(135deg, #f8f7ff 0%, #fafbff 100%);
    border: 1px solid #e9e5ff;
    border-radius: 12px;
    padding: 6px 10px;
    margin: 6px 0;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.06);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    padding: 5px 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
    user-select: none;
}

.preview-header:hover {
    background-color: rgba(139, 92, 246, 0.1);
}

.preview-header:active {
    transform: scale(0.98);
}

.preview-header-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.preview-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.preview-toggle-arrow {
    font-size: 0.8rem;
    color: #7c3aed;
    transition: transform 0.3s ease, color 0.2s ease;
    user-select: none;
    font-weight: bold;
}

.preview-header:hover .preview-toggle-arrow {
    color: #6d28d9;
}

.preview-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 1;
    margin-top: 8px;
}

.preview-body.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.preview-subtitle {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Analysis Summary */
.analysis-summary {
    background: rgba(139, 92, 246, 0.05);
    border-left: 3px solid var(--primary);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.analysis-loading {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

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

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

.analysis-result {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.analysis-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.analysis-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 500;
}

.dimension-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 0;
}

.dimension-card {
    background: white;
    border: 1px solid #e5e5ff;
    border-radius: 8px;
    padding: 6px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.dimension-card:hover {
    border-color: #d0b3ff;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.1);
}

.dimension-card.selected {
    background: rgba(139, 92, 246, 0.08);
    border-color: #b794f4;
}

.dimension-header {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-bottom: 3px;
}

.dimension-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.dimension-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.dimension-suggestions {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dimension-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 3px;
    cursor: pointer;
    padding: 3px 3px;
    border-radius: 6px;
    transition: all 0.2s ease;
    background: rgba(245, 243, 255, 0.5);
}

.dimension-suggestion:hover {
    background: rgba(139, 92, 246, 0.08);
    transform: translateX(2px);
}

.suggestion-content {
    flex: 1;
    min-width: 0;
}

.suggestion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

.suggestion-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.suggestion-bullet {
    display: inline-block;
    margin-right: 8px;
    color: #6d28d9; /* primary purple */
    font-weight: 900;
    font-size: 1.1rem;
}

.suggestion-title-text,
.suggestion-desc-text {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.suggestion-description {
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.suggestion-checkbox {
    width: 14px;
    height: 14px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.suggestion-label {
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.5;
    cursor: pointer;
}

/* Priority Badge - Circular Progress */
.priority-badge {
    position: relative;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: help;
    transition: all 0.2s ease;
}

.priority-badge:hover {
    transform: scale(1.1);
}

.circular-progress {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-bg {
    fill: none;
    stroke: #E5E7EB;
    stroke-width: 3.5;
}

.progress-fill {
    fill: none;
    stroke-width: 3.5;
    stroke-linecap: round;
    transition: stroke-dasharray 0.6s ease, stroke 0.3s ease;
}

/* 5分 - 红色渐变（完整圆环）*/
.progress-5 {
    stroke: #DC2626;
}

/* 4分 - 橙色（80%圆环）*/
.progress-4 {
    stroke: #F59E0B;
}

/* 3分 - 灰色（60%圆环）*/
.progress-3 {
    stroke: #9CA3AF;
}

.score-number {
    position: relative;
    z-index: 1;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.preview-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-light);
}

.preview-btn {
    padding: 0.375rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-btn.skip {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.preview-btn.skip:hover {
    background: var(--bg-tertiary);
}

.preview-btn.generate {
    background: var(--primary);
    color: white;
}

.preview-btn.generate:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

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

/* ============================================
   Thinking Process - Compact
   ============================================ */
.thinking-process {
    margin: var(--space-4) 0;
    background: rgba(139, 92, 246, 0.03);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.thinking-toggle {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.thinking-toggle:hover {
    background: rgba(139, 92, 246, 0.05);
}

.thinking-toggle.open {
    background: rgba(139, 92, 246, 0.05);
    border-bottom: 1px solid var(--border-light);
}

.thinking-icon {
    font-size: 1rem;
}

.thinking-title {
    flex: 1;
    text-align: left;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toggle-arrow {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    transition: transform 0.2s;
}

.thinking-content {
    padding: var(--space-3);
    animation: slideDown 0.3s ease;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.thinking-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.thinking-step:last-child {
    margin-bottom: 0;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    flex: 1;
    line-height: 1.5;
    padding-top: 0.125rem;
}

.step-text.step-loading {
    position: relative;
}

.step-text.step-loading::after {
    content: '';
    animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

/* ============================================
   Action Buttons
   ============================================ */
.message-actions {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
    flex-wrap: wrap;
}

.action-btn {
    padding: var(--space-4) var(--space-5);
    background: white;
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* ============================================
   Suggestions Container
   ============================================ */
.suggestions-container {
    margin-top: var(--space-4);
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.overall-score-header {
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-5);
    border-bottom: 1px solid var(--border-light);
}

.overall-score-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--success);
    line-height: 1;
    min-width: 80px;
    text-align: center;
}

.overall-score-reason {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-secondary);
    font-weight: 500;
}

.suggestions-list {
    padding: var(--space-4);
}

.suggestion-item {
    padding: var(--space-3) 0;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    border-bottom: 1px solid var(--border-light);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    opacity: 0.7;
}

.suggestion-number {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-tertiary);
    min-width: 24px;
    padding-top: 2px;
}

.suggestion-text {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.suggestion-icon {
    color: var(--text-tertiary);
    font-size: 1.125rem;
    transition: transform 0.2s;
    padding-top: 2px;
}

.suggestion-item:hover .suggestion-icon {
    transform: translateX(3px);
}

/* ============================================
   Input Area
   ============================================ */
.input-container {
    display: block;
    margin-bottom: var(--space-3);
}

.chat-input {
    width: 100%;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    resize: none;
    transition: all 0.2s;
    line-height: 1.4;
}

.chat-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
}

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

.send-btn {
    padding: 0.5rem 1.25rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.send-btn.stop-mode {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.send-btn.stop-mode:hover {
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
    transform: translateY(-2px);
}

.input-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.toolbar-left {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toolbar-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-normal);
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

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

/* Preview Toggle Checkbox */
.preview-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-toggle-label:hover {
    background: var(--bg-tertiary);
}

.preview-toggle-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--primary);
}

.toggle-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    user-select: none;
}

/* ============================================
   Custom Optimize Panel - Compact
   ============================================ */
.custom-optimize-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    margin-top: var(--space-3);
    animation: slideDown 0.3s ease;
}

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

/* Dimensions Header */
.dimensions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    margin-top: var(--space-3);
}

.panel-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin: 0;
}

.select-all-btn {
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.select-all-btn:hover {
    background: var(--bg-tertiary);
}

.step-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.step-option-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    cursor: pointer;
    transition: all 0.2s;
}

.step-option-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-normal);
}

.step-option-card.selected {
    background: rgba(139, 92, 246, 0.05);
    border-color: var(--primary);
}

.step-option-header {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.step-checkbox-wrapper {
    position: relative;
}

.step-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0;
    position: absolute;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-normal);
    border-radius: 6px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.step-checkbox:checked + .checkbox-custom {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 12px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s;
}

.step-checkbox:checked + .checkbox-custom::after {
    opacity: 1;
}

.step-option-content {
    flex: 1;
}

.step-option-title-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.step-option-icon {
    font-size: 1.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.step-option-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.step-option-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-2);
    margin-left: calc(1.875rem + var(--space-2));
}

/* Optimization Mode Section */
.optimization-mode-section {
    margin-bottom: var(--space-4);
}

.mode-toggle-container {
    display: inline-flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.mode-toggle-option {
    position: relative;
    cursor: pointer;
}

.mode-toggle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-toggle-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-toggle-option:hover .mode-toggle-btn {
    color: var(--text-primary);
    background: rgba(139, 92, 246, 0.05);
}

.mode-toggle-option input:checked + .mode-toggle-btn {
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.mode-icon {
    font-size: 1.125rem;
}

.mode-text {
    font-weight: 600;
}

.mode-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Disabled state for dimension cards */
.step-options-grid.disabled {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(0.3);
}

.video-length-control {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-3);
    margin-top: var(--space-4);
}

.control-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.control-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.length-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-light);
    border-radius: 10px;
    outline: none;
    margin-bottom: var(--space-3);
}

.length-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

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

.slider-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary);
}

.slider-range {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ============================================
   Typing Indicator
   ============================================ */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: var(--space-4);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* ============================================
   Import from Favorites Modal
   ============================================ */
.import-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.import-modal {
    background: white;
    border-radius: var(--radius-2xl);
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: slideUp 0.3s ease;
}

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

.import-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.import-icon {
    font-size: 1.75rem;
}

.import-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0.25rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.import-modal-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-light);
    gap: 1rem;
}

.import-filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.import-filter-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.import-filter-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--border-normal);
}

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

.filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.import-filter-btn.active .filter-count {
    background: rgba(255, 255, 255, 0.3);
}

.import-sort-select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.import-sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

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

.import-favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.import-favorite-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.import-favorite-item:hover {
    background: white;
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.import-favorite-content {
    flex: 1;
    min-width: 0;
}

.import-favorite-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.import-favorite-type {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: white;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

.import-favorite-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.import-favorite-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.import-favorite-excerpt {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.import-favorite-action {
    flex-shrink: 0;
}

.import-btn {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.import-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.3);
}

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

.import-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.import-empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.import-empty-state .empty-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.import-empty-state .empty-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    max-width: 300px;
    line-height: 1.5;
}

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

/* ============================================
   Toast Notification - Compact
   ============================================ */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--success);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    font-size: 0.875rem;
}

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

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

/* ============================================
   Reference Sidebar - Compact
   ============================================ */
.reference-sidebar {
    position: fixed;
    right: 0;
    top: 80px;
    bottom: 0;
    width: 300px;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-light);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 90;
    display: flex;
    flex-direction: column;
}

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

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

.sidebar-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.2s;
}

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

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-5);
    font-size: 0.8125rem;
}

.reference-item {
    padding: var(--space-3);
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    cursor: pointer;
    transition: all 0.2s;
}

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

.reference-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.reference-excerpt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.reference-source {
    font-size: 0.75rem;
}

/* ============================================
   Responsive - Compact Adjustments
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
        min-width: 200px;
    }
    }
    
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        padding: 0.5rem 1rem;
    }
    
    .content-area {
        margin-left: 0;
    }
    
    .dimension-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        gap: var(--space-3);
    }
    
    .new-task-btn {
        flex: 0 0 auto;
        padding: var(--space-3);
        font-size: 0.875rem;
    }
    
    .sidebar-section {
        max-height: 150px;
    }
    
    .task-list {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .task-item {
        min-width: 150px;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .page-subtitle {
        font-size: 0.9375rem;
    }
    
    .message-bubble {
        max-width: 95%;
    }
    
    .input-container {
        flex-direction: column;
    }
    
    .input-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left {
        width: 100%;
        justify-content: center;
    }
    
    .send-btn {
        width: 100%;
        justify-content: center;
    }
    
    .step-options-grid {
        grid-template-columns: 1fr;
    }
    
    .reference-sidebar {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 var(--space-4);
    }
    
    .nav-menu {
        gap: 0;
    }
    
    .nav-link span:not(.nav-icon) {
        display: none;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .logo-icon {
        font-size: 1.125rem;
    }
    
    .logo-text {
        display: none;
    }
    
    .page-header {
        padding: var(--space-6) 0;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.9375rem;
    }
}


/* ============================================
   More Suggestions - Dimension Cards
   ============================================ */

.dimension-suggestion-item {
    padding: 12px;
    margin: 8px 0;
    background: #F9FAFB;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dimension-suggestion-item:hover {
    background: #F3F4F6;
}

.dimension-suggestion-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.6;
}

.dimension-suggestion-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #8B5CF6;
}

.dimension-suggestion-text {
    flex: 1;
    color: #374151;
}

.dimension-suggestion-score {
    flex-shrink: 0;
    color: #F59E0B;
    font-weight: 600;
    font-size: 12px;
}

.dimension-suggestions {
    margin-top: 12px;
}

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


/* ============================================
   User Selections Panel (可折叠)
   ============================================ */

.user-selections-panel {
    border-radius: 12px;
    overflow: hidden;
}

.selections-header {
    user-select: none;
    transition: background 0.2s ease;
}

.selections-header:hover {
    background: rgba(102, 126, 234, 0.05);
}

.selections-body {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

.toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

/* ============================================
   Script Library Section
   ============================================ */
.script-library-section {
    margin-top: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(240, 84, 84, 0.03) 100%);
    border-radius: 1rem;
    border: 1px solid var(--border-light);
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.library-header {
    margin-bottom: 2rem;
}

.library-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

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

/* ============================================
   Filter Bar
   ============================================ */
.filter-bar {
    margin-bottom: 2rem;
}

.filter-controls {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

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

.filter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-select {
    padding: 0.5rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.filter-select:hover {
    border-color: var(--primary);
}

/* ============================================
   Showcase Grid
   ============================================ */
.showcase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 0.5rem;
}

/* 自定义滚动条样式 */
.showcase-grid::-webkit-scrollbar {
    width: 8px;
}

.showcase-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.showcase-grid::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 4px;
}

.showcase-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.script-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.script-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

/* Video preview in card */
.card-video-preview {
    position: relative;
    width: 100%;
    height: 140px;
    overflow: hidden;
    background: linear-gradient(135deg, #374151 0%, #111827 100%); /* 默认深色渐变，替代纯黑 */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-video-preview.no-thumb {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%); /* 无图时的默认紫色渐变 */
}

.card-video-preview.no-thumb::after {
    content: '🎬';
    font-size: 3rem;
    opacity: 0.3;
}

.card-video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.script-card:hover .video-play-overlay {
    opacity: 1;
}

.play-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--primary);
    padding-left: 3px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.script-card:hover .play-icon {
    transform: scale(1.1);
}

.card-body {
    padding: 0.75rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0.25rem;
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.card-category {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.card-content {
    display: none; /* 隐藏描述文字 */
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-light);
}

.card-score {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.score-value {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.875rem;
}

.card-action {
    padding: 0.375rem 0.75rem;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.card-action:hover {
    background: var(--primary);
    color: white;
}

.loading-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

@media (max-width: 768px) {
    .script-library-section {
        padding: 1.5rem;
        max-height: 500px;
    }

    .library-title {
        font-size: 1.25rem;
    }

    .filter-controls {
        gap: 1rem;
    }

    .showcase-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1rem;
    }
}


/* ============================================
   Inspiration Panel (Horizontal Scroll)
   ============================================ */
.inspiration-panel {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(240, 84, 84, 0.02) 100%);
    border-radius: 1rem;
    border: 1px solid var(--border-light);
}

.inspiration-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.inspiration-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.inspiration-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.inspiration-view-all {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.inspiration-view-all:hover {
    opacity: 0.8;
}

.inspiration-controls {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.inspiration-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 240px;
}

.inspiration-search-input {
    flex: 1;
    padding: 0.5rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.inspiration-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.inspiration-search-btn {
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.inspiration-search-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.inspiration-search-btn:active {
    transform: scale(0.95);
}

.inspiration-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.inspiration-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.inspiration-select {
    padding: 0.5rem 0.875rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.inspiration-select:hover {
    border-color: var(--primary);
}

/* 3-Column Grid with Vertical Scroll */
.inspiration-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-height: 700px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0.5rem;
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.inspiration-grid::-webkit-scrollbar {
    width: 8px;
}

.inspiration-grid::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.inspiration-grid::-webkit-scrollbar-thumb {
    background: var(--border-normal);
    border-radius: 4px;
}

.inspiration-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Script Card (Grid) */
.inspiration-grid .script-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0;
    transition: all 0.2s;
    cursor: pointer;
}

.inspiration-grid .script-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

/* Pagination */
.inspiration-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.pagination-btn {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.inspiration-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-text {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

@media (max-width: 1200px) {
    .inspiration-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .inspiration-panel {
        padding: 1rem;
        margin-top: 1.5rem;
    }

    .inspiration-header {
        flex-direction: column;
        gap: 1rem;
    }

    .inspiration-title {
        font-size: 1.125rem;
    }

    .inspiration-controls {
        gap: 1rem;
    }

    .inspiration-grid {
        grid-template-columns: 1fr;
        max-height: 600px;
    }
}

/* ============================================
   Inspiration Modal
   ============================================ */
.inspiration-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
}

.inspiration-modal {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

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

.inspiration-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: var(--bg-secondary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.inspiration-modal-close:hover {
    background: var(--border-normal);
    transform: rotate(90deg);
}

.inspiration-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    gap: 1.5rem;
}

.inspiration-modal-header > div:first-child {
    flex: 1;
    min-width: 0;
}

.inspiration-modal-header > div:first-child > * {
    display: block;
}

.inspiration-modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    word-break: break-word;
}

.inspiration-modal-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.inspiration-modal-score {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
}

.inspiration-modal-meta {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: var(--bg-secondary);
}

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

.meta-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.inspiration-modal-body {
    padding: 2rem;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.modal-video-player {
    margin-bottom: 1.5rem;
}

.modal-video-player video {
    width: 100%;
    max-height: 400px;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.inspiration-modal-section {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.inspiration-modal-script {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.inspiration-modal-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem 2rem;
    border-top: 1px solid var(--border-light);
}

.btn-inspiration {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-inspiration:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline {
    flex: 1;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-normal);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

@media (max-width: 768px) {
    .inspiration-modal-overlay {
        padding: 1rem;
    }

    .inspiration-modal {
        max-width: 95%;
        width: 100%;
        max-height: 95vh;
    }

    .inspiration-modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }

    .inspiration-modal-title {
        font-size: 1.25rem;
    }

    .inspiration-modal-score {
        font-size: 1.5rem;
    }

    .inspiration-modal-meta {
        padding: 1rem 1.5rem;
        gap: 1.5rem;
    }

    .inspiration-modal-body {
        padding: 1.5rem;
    }

    .inspiration-modal-actions {
        flex-direction: column;
        padding: 1rem 1.5rem 1.5rem;
    }
}

/* ============================================
   Fixed Bottom Input (During Conversation)
   ============================================ */
.chat-input-area.fixed-bottom {
    position: fixed !important;
    width: auto;
    max-width: none;
    /* 保持其他所有原有样式不变 */
}

/* For large screens (>= 1280px): center with max-width */
@media (min-width: 1280px) {
    .chat-input-area.fixed-bottom {
        left: calc((100vw - 1280px) / 2 + 1.5rem + 240px + 1rem + 1rem); /* center + main-padding + sidebar + gap + content-margin */
        right: calc((100vw - 1280px) / 2 + 1.5rem); /* center + main-padding */
    }
}

/* For smaller screens (< 1280px): use viewport-based calculation */
@media (max-width: 1279px) {
    .chat-input-area.fixed-bottom {
        left: calc(1.5rem + 240px + 1rem + 1rem); /* main-padding + sidebar + gap + content-margin */
        right: 1.5rem; /* main-padding-right */
    }
}

/* Add padding to chat container when input is fixed */
.chat-container:has(.chat-input-area.fixed-bottom) {
    padding-bottom: 200px;
}

/* Alternative: add padding to chat messages */
.chat-messages.with-fixed-input {
    padding-bottom: 180px;
}

/* Hide showcase when conversation starts */
.inspiration-panel.hidden {
    display: none !important;
}

/* ============================================
   Reference Sidebar - Enhanced Display
   ============================================ */
.reference-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.reference-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-light);
}

.reference-thumbnail {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-secondary);
    position: relative;
}

.reference-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-tertiary);
}

.reference-card-content {
    padding: 0.75rem;
}

.reference-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reference-category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: capitalize;
}

.reference-video-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    color: white;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.reference-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
    line-height: 1.3;
}

.reference-card-excerpt {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.reference-card-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.reference-score {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
}

.reference-improvement {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--success);
}

.reference-view-btn {
    width: 100%;
    padding: 0.5rem;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.reference-view-btn:hover {
    background: var(--primary);
    color: white;
}

/* ============================================
   Reference Script Detail Modal
   ============================================ */
.reference-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s;
}

.reference-modal {
    background: var(--bg-primary);
    border-radius: 1rem;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.3s;
}

.reference-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reference-modal-close:hover {
    background: var(--border-normal);
    transform: rotate(90deg);
}

.reference-video-container {
    width: 100%;
    background: #000;
    margin-bottom: 1.5rem;
}

.reference-video-container iframe,
.reference-video-container video {
    display: block;
    width: 100%;
    border-radius: 1rem 1rem 0 0;
}

.reference-modal-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.reference-modal-header > div:first-child {
    flex: 1;
}

.reference-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.reference-modal-category {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.reference-modal-score {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.reference-modal-meta {
    display: flex;
    gap: 2rem;
    padding: 0 1.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
}

.reference-modal-body {
    padding: 1.5rem;
}

.reference-modal-section {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.reference-modal-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.reference-modal-script {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.reference-modal-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
}

.btn-reference-primary {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reference-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-reference-outline {
    flex: 1;
    padding: 0.875rem 1.5rem;
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reference-outline:hover {
    background: var(--primary-light);
}

/* Responsive - Reference Modal */
@media (max-width: 768px) {
    .reference-modal {
        margin: 1rem;
        max-height: 95vh;
    }
    
    .reference-modal-title {
        font-size: 1.25rem;
    }
    
    .reference-modal-actions {
        flex-direction: column;
    }
    
    .reference-video-container iframe,
    .reference-video-container video {
        height: 250px;
    }
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================
   样式切换器
   ========================================== */
.style-switcher {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 12px 0;
}

.style-btn {
    padding: 10px 20px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.style-btn:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.style-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.style-icon {
    font-size: 16px;
}

/* ==========================================
   样式B - 卡片拖放式交互
   ========================================== */
.style-b-container {
    max-width: 100%;
}

.preview-body-b {
    padding: 16px;
}

.dimensions-container-b {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.style-b-dimension-section {
    border-radius: 12px;
    overflow: hidden;
}

.dimension-header-b {
    padding: 12px 16px;
    border: 2px solid;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.dimension-icon-b {
    font-size: 20px;
}

.dimension-title-b {
    margin: 0;
    font-size: 14px;
}

.dimension-cards-b {
    padding: 12px;
    background: #fafafa;
    border: 2px solid;
    border-top: none;
    border-radius: 0 0 12px 12px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.style-b-card {
    padding: 12px 14px;
    border: 2px solid;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.style-b-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.style-b-card:active {
    transform: scale(0.98);
}

.style-b-card.card-selected-b {
    animation: cardFlyAway 0.5s ease-out forwards;
}

@keyframes cardFlyAway {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translateY(-20px) scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: translateY(100px) scale(0.8);
        opacity: 0;
    }
}

.card-content-b {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.card-text-b {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

.card-score-badge-b {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==========================================
   选择篮子
   ========================================== */
.selection-basket-b {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border: 2px dashed #667eea;
    border-radius: 16px;
    padding: 16px;
    min-height: 180px;
    transition: all 0.3s ease;
}

.selection-basket-b:has(.basket-card-b) {
    background: linear-gradient(135deg, #667eea25 0%, #764ba225 100%);
    border-style: solid;
}

.basket-header-b {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea40;
}

.basket-icon-b {
    font-size: 24px;
}

.basket-title-b {
    flex: 1;
    font-weight: 600;
    font-size: 15px;
    color: #333;
}

.basket-count-b {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.basket-content-b {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.basket-empty-state-b {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 30px;
    color: #999;
    text-align: center;
}

.empty-icon-b {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.basket-empty-state-b p {
    margin: 0;
    font-size: 13px;
}

.basket-card-b {
    padding: 12px 14px;
    border: 2px solid;
    border-radius: 10px;
    position: relative;
    animation: dropIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes dropIn {
    0% {
        transform: translateY(-50px) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.basket-card-b.animate-drop {
    animation: dropIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.basket-card-b.animate-remove {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

.remove-card-btn-b {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    color: white;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
    z-index: 10;
}

.remove-card-btn-b:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.remove-card-btn-b:active {
    transform: scale(0.95);
}

.basket-card-content-b {
    display: flex;
    align-items: center;
    gap: 10px;
}

.basket-card-icon-b {
    font-size: 20px;
    flex-shrink: 0;
}

.basket-card-text-b {
    flex: 1;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 500;
}

.basket-card-score-b {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.preview-actions-b button {
    position: relative;
    overflow: hidden;
}

.preview-actions-b button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.preview-actions-b button:active::before {
    width: 300px;
    height: 300px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .dimensions-container-b {
        grid-template-columns: 1fr;
    }
    
    .style-switcher {
        flex-direction: column;
    }
    
    .style-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================
   骰子旋转动画 (Dice Spinner for More Inspirations)
   ========================================== */
@keyframes spinDice {
    0% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(90deg) scale(1.1);
    }
    50% {
        transform: rotate(180deg) scale(1);
    }
    75% {
        transform: rotate(270deg) scale(1.1);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.dice-spinner {
    animation: spinDice 1s infinite ease-in-out;
    display: inline-block;
    font-size: 48px;
    margin-bottom: 15px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* 添加一些颜色变化让动画更生动 */
@keyframes spinDiceColorful {
    0% {
        transform: rotate(0deg) scale(1);
        filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
    }
    25% {
        transform: rotate(90deg) scale(1.1);
        filter: drop-shadow(0 4px 12px rgba(118, 75, 162, 0.4));
    }
    50% {
        transform: rotate(180deg) scale(1);
        filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
    }
    75% {
        transform: rotate(270deg) scale(1.1);
        filter: drop-shadow(0 4px 12px rgba(118, 75, 162, 0.4));
    }
    100% {
        transform: rotate(360deg) scale(1);
        filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
    }
}

/* 如果想要更炫酷的彩色阴影效果，可以使用这个类 */
.dice-spinner-colorful {
    animation: spinDiceColorful 1s infinite ease-in-out;
    display: inline-block;
    font-size: 48px;
    margin-bottom: 15px;
}

/* ==========================================
   Style B 柔和现代风 - 增强样式
   ========================================== */

/* 卡片增强阴影效果 */
.style-b-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.style-b-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
}

/* 维度头部增强 */
.dimension-header-b {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* 选择篮子增强 */
.selection-basket-b {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.basket-card-b {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* 分数徽章增强 - 根据不同维度使用不同阴影 */
.card-score-badge-b,
.basket-card-score-b {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 移除按钮增强 */
.remove-card-btn-b {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.15);
}

.remove-card-btn-b:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* 样式切换按钮活跃状态优化 */
.style-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3), 0 2px 6px rgba(118, 75, 162, 0.2);
}

/* ==========================================
   右上角视图切换器 - 滑动开关样式
   ========================================== */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
}

.preview-header-content {
    flex: 1;
}

.view-toggle-container {
    flex-shrink: 0;
}

.view-toggle {
    position: relative;
    display: inline-flex;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 20px;
    padding: 3px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.toggle-option {
    position: relative;
    padding: 6px 16px;
    background: transparent;
    border: none;
    border-radius: 17px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 2;
    min-width: 50px;
    text-align: center;
}

.toggle-option:hover {
    color: #333;
}

.toggle-option.active {
    color: #667eea;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 3px);
    height: calc(100% - 6px);
    background: white;
    border-radius: 17px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.toggle-slider.slide-right {
    transform: translateX(100%);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .preview-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle-container {
        display: flex;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

/* 移除旧样式切换器 */
.style-switcher {
    display: none !important;
}

/* ==========================================
   Reference Sources 紧凑优化
   ========================================== */

/* 隐藏占位图标，只在有实际图片时显示缩略图 */
.reference-thumbnail-placeholder {
    display: none !important;
}

/* 只在有实际图片时显示缩略图 */
.reference-thumbnail:not(.reference-thumbnail-placeholder) {
    display: block;
}

/* 紧凑化reference卡片 */
.reference-card {
    margin-bottom: 0.75rem !important;
    padding: 0 !important;
}

/* 紧凑化卡片内容 */
.reference-card-content {
    padding: 0.875rem !important;
}

/* 减小标题字号和间距 */
.reference-card-title {
    font-size: 0.8125rem !important;
    margin-bottom: 0.25rem !important;
}

/* 减小摘要间距 */
.reference-card-excerpt {
    margin-bottom: 0.375rem !important;
    font-size: 0.6875rem !important;
    -webkit-line-clamp: 2 !important;
}

/* 减小header间距 */
.reference-card-header {
    margin-bottom: 0.375rem !important;
}

/* 减小footer间距 */
.reference-card-footer {
    margin-bottom: 0.375rem !important;
}

/* 紧凑化查看按钮 */
.reference-view-btn {
    padding: 0.5rem 0.875rem !important;
    font-size: 0.75rem !important;
}

/* 减小sidebar内边距 */
.sidebar-content {
    padding: 0.875rem !important;
}

/* 紧凑化分数和改进标签 */
.reference-score,
.reference-improvement {
    font-size: 0.6875rem !important;
    padding: 0.125rem 0.375rem !important;
}
