/* ============================================
   AI创意工坊 - 主样式表
   设计风格: 腾讯简洁 + Apple优雅融合
   ============================================ */

/* CSS变量 - 设计系统 */
:root {
    /* 主色调 */
    --primary: #0066FF;
    --primary-hover: #0052CC;
    --primary-light: #E8F0FE;
    --primary-gradient: linear-gradient(135deg, #0066FF, #00C6FF);

    /* 语义色 */
    --success: #34C759;
    --warning: #FF9500;
    --error: #FF3B30;
    --info: #5AC8FA;

    /* 中性色 - Apple风格灰阶 */
    --gray-50: #FAFAFA;
    --gray-100: #F5F5F7;
    --gray-200: #E8E8ED;
    --gray-300: #D2D2D7;
    --gray-400: #AEAEB2;
    --gray-500: #8E8E93;
    --gray-600: #636366;
    --gray-700: #48484A;
    --gray-800: #363639;
    --gray-900: #1D1D1F;
    --gray-950: #0A0A0B;

    /* 背景 */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F7;
    --bg-tertiary: #FAFAFA;
    --bg-elevated: #FFFFFF;

    /* 文字 */
    --text-primary: #1D1D1F;
    --text-secondary: #636366;
    --text-tertiary: #AEAEB2;
    --text-inverse: #FFFFFF;

    /* 边框 */
    --border-color: #E8E8ED;
    --border-light: #F0F0F0;

    /* 阴影 */
    --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 30px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.15);

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Cascadia Code", monospace;

    /* 动画 */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

    /* 侧边栏 */
    --sidebar-width: 240px;
}

/* ============================================
   全局重置 & 基础样式
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

img, video {
    max-width: 100%;
    height: auto;
}

/* ============================================
   布局
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   侧边导航 - Apple风格
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border-light);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.logo-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item .nav-icon {
    width: 24px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-light);
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    align-items: center;
    justify-content: center;
}

/* ============================================
   主内容区
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 40px;
}

/* ============================================
   首页 Hero
   ============================================ */
.hero-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 60px;
    padding: 40px 0 60px;
    min-height: calc(100vh - 200px);
}

.hero-content {
    flex: 1;
    max-width: 560px;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
}

.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.hero-desc {
    font-size: 16px;
    color: var(--text-tertiary);
    margin-bottom: 32px;
}

.hero-actions {
    display: flex;
    gap: 12px;
}

.hero-visual {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.hero-icon-large {
    font-size: 120px;
    animation: float 3s ease-in-out infinite;
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    background: var(--primary);
}

.shape-1 {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 10%;
    animation: float 4s ease-in-out infinite;
}

.shape-2 {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 10%;
    animation: float 5s ease-in-out infinite 0.5s;
    background: #00C6FF;
}

.shape-3 {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 30%;
    animation: float 3.5s ease-in-out infinite 1s;
}

.shape-4 {
    width: 80px;
    height: 80px;
    top: 30%;
    right: 30%;
    animation: float 4.5s ease-in-out infinite 1.5s;
    background: #5856D6;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

/* ============================================
   通用区块
   ============================================ */
.section-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.features-section,
.models-section {
    padding: 40px 0 60px;
}

/* ============================================
   功能卡片网格
   ============================================ */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feature-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: all var(--transition-normal);
    cursor: pointer;
    display: block;
    color: inherit;
    text-decoration: none;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    color: inherit;
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 16px;
    display: block;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.feature-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

/* ============================================
   模型卡片
   ============================================ */
.models-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.model-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
}

.model-card:hover {
    box-shadow: var(--shadow-md);
}

.model-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.model-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.model-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.model-badge.text {
    background: #E8F5E9;
    color: #2E7D32;
}

.model-badge.image {
    background: #FFF3E0;
    color: #E65100;
}

.model-badge.video {
    background: #E8EAF6;
    color: #283593;
}

.model-card p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================
   生成页面布局
   ============================================ */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.page-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

.badge-new {
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-left: 8px;
}

.generate-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.generate-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
}

.result-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    min-height: 500px;
    position: sticky;
    top: 24px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.result-status {
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 20px;
}

.result-status.processing { background: #FFF3E0; color: #E65100; }
.result-status.success { background: #E8F5E9; color: #2E7D32; }
.result-status.error { background: #FFEBEE; color: #C62828; }

.result-content {
    min-height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-placeholder {
    text-align: center;
    color: var(--text-tertiary);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.placeholder-sub {
    font-size: 13px;
    margin-top: 4px;
}

.result-image {
    width: 100%;
    border-radius: var(--radius-md);
    object-fit: contain;
    max-height: 500px;
}

.result-video {
    width: 100%;
    border-radius: var(--radius-md);
    max-height: 500px;
}

.result-error {
    color: var(--error);
    text-align: center;
    padding: 20px;
}

.result-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   表单组件
   ============================================ */
.panel-section {
    margin-bottom: 24px;
}

.panel-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.prompt-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-sans);
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--transition-fast);
    background: var(--bg-tertiary);
}

.prompt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-primary);
}

.prompt-tips {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.tip-badge {
    padding: 4px 12px;
    background: var(--gray-100);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.tip-badge:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-primary);
    cursor: pointer;
}

/* ============================================
   尺寸选择器
   ============================================ */
.size-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.size-btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    cursor: pointer;
    font-size: 13px;
    text-align: center;
    transition: all var(--transition-fast);
    line-height: 1.4;
}

.size-btn small {
    display: block;
    font-size: 11px;
    color: var(--text-tertiary);
}

.size-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.size-btn.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.custom-size {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.size-input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    text-align: center;
}

/* ============================================
   视频参数
   ============================================ */
.video-params {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.param-group {
    flex: 1;
    min-width: 150px;
}

.param-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.generate-note {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 12px;
    text-align: center;
}

/* ============================================
   图片上传
   ============================================ */
.image-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.image-upload-area:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-placeholder {
    padding: 40px;
    text-align: center;
    cursor: pointer;
    color: var(--text-tertiary);
}

.upload-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.upload-hint {
    font-size: 12px;
    margin-top: 4px;
}

.upload-preview {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
}

.or-divider {
    display: flex;
    align-items: center;
    margin: 12px 0;
    color: var(--text-tertiary);
    font-size: 13px;
}

.or-divider::before,
.or-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.or-divider span {
    padding: 0 12px;
}

/* ============================================
   按钮
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-danger {
    background: var(--error);
    color: white;
}

.btn-danger:hover {
    background: #D63029;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    border-radius: var(--radius-md);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    font-size: 18px;
}

.generate-btn {
    margin-top: 8px;
}

/* ============================================
   视频进度
   ============================================ */
.video-progress {
    text-align: center;
    color: var(--text-secondary);
}

.progress-ring {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.task-id {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    font-family: var(--font-mono);
}

/* ============================================
   对话页面
   ============================================ */
.chat-container {
    display: flex;
    gap: 24px;
    height: calc(100vh - 180px);
}

.chat-sidebar-info {
    width: 220px;
    min-width: 220px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-model-info {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.model-avatar {
    font-size: 48px;
    margin-bottom: 8px;
}

.model-name {
    font-size: 16px;
    font-weight: 600;
}

.model-desc {
    font-size: 12px;
    color: var(--text-tertiary);
}

.chat-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feature-item {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
}

.chat-main {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
}

.welcome-avatar {
    font-size: 56px;
    margin-bottom: 16px;
}

.chat-welcome h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.chat-welcome p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.quick-prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.quick-prompt-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.quick-prompt-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: var(--primary-light);
}

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    line-height: 1.7;
}

.chat-message.user .message-content {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}

.chat-message.error .message-content {
    background: #FFEBEE;
    color: var(--error);
}

.message-meta {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 0 0 48px;
}

.chat-message .message-content pre {
    background: var(--gray-900);
    color: #E8E8ED;
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0;
}

.chat-message .message-content pre code,
.chat-message .message-content pre > code {
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    background: none !important;
    padding: 0 !important;
    color: inherit !important;
}

.chat-message .message-content code {
    font-family: var(--font-mono);
    font-size: 13px;
}

/* 仅行内code有背景 */
.chat-message.user .message-content > :not(pre) > code,
.chat-message.user .message-content > code {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.chat-message.assistant .message-content > :not(pre) > code,
.chat-message.assistant .message-content > code {
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typing 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: var(--font-sans);
    resize: none;
    line-height: 1.5;
    max-height: 150px;
    transition: border-color var(--transition-fast);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-send {
    padding: 10px 24px;
    border-radius: var(--radius-md);
    white-space: nowrap;
}

/* ============================================
   对话增强：代码块、消息操作、预览
   ============================================ */

/* 消息body包装 */
.message-body {
    flex: 1;
    min-width: 0;
}

/* 消息操作按钮行 */
.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.msg-action-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* 代码块包装器 */
.code-block-wrapper {
    margin: 12px 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gray-900);
}

/* 代码块头部工具栏 */
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
}

.code-lang-tag {
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-block-actions {
    display: flex;
    gap: 6px;
}

.code-action-btn {
    padding: 3px 10px;
    font-size: 11px;
    border: 1px solid #555;
    border-radius: 4px;
    background: #3a3a3a;
    color: #ccc;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.code-action-btn:hover {
    background: #555;
    border-color: #777;
    color: #fff;
}

.code-action-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* 代码块内容 */
.code-block-content {
    margin: 0;
    padding: 16px;
    background: #1e1e1e;
    color: #d4d4d4;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    white-space: pre;
    tab-size: 4;
}

.code-block-content code {
    font-family: inherit !important;
    font-size: inherit !important;
    background: none !important;
    padding: 0 !important;
    color: inherit !important;
}

/* 预览容器 */
.code-preview-container {
    background: #fff;
    min-height: 100px;
}

.preview-iframe {
    display: block;
    border: none;
    width: 100%;
    min-height: 300px;
}

/* Markdown 标题 */
.md-heading {
    margin: 14px 0 8px;
    line-height: 1.4;
}

/* Markdown 列表 */
.md-ul, .md-ol {
    margin: 8px 0;
    padding-left: 24px;
}

.md-li {
    margin: 4px 0;
}

/* 对话中用户消息的操作按钮 */
.chat-message.user .message-actions {
    justify-content: flex-end;
}

.chat-message.user .msg-action-btn {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
}

.chat-message.user .msg-action-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
    color: #fff;
}

/* ============================================
   画廊
   ============================================ */
.gallery-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.gallery-search {
    width: 240px;
    margin-left: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.gallery-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.gallery-item-info {
    padding: 12px;
}

.gallery-item-prompt {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-item-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.gallery-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    cursor: pointer;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 预览遮罩 */
.preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
}

.preview-image,
.preview-video {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

/* ============================================
   通用状态
   ============================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
    font-size: 16px;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .features-grid,
    .models-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .generate-layout {
        grid-template-columns: 1fr;
    }

    .result-panel {
        position: static;
    }

    .hero-section {
        flex-direction: column;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
    }

    .chat-container {
        flex-direction: column;
    }

    .chat-sidebar-info {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-menu-btn {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
        padding-top: 70px;
    }

    .hero-title {
        font-size: 36px;
    }

    .features-grid,
    .models-grid {
        grid-template-columns: 1fr;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .video-params {
        flex-direction: column;
    }
}
