/* CSS变量定义 */
:root {
    /* 浅色主题变量 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-color: #334155;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --card-bg: #ffffff;
    --hover-bg: #f8fafc;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --accent-color: #667eea;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}



/* 头部样式 */
.header {
    background: #2563eb;
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: #f59e0b;
}

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

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-btn-primary {
    background: #f59e0b;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    animation: pulse 2s infinite;
}

.nav-btn-primary:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
    transform: translateY(-2px);
}

.nav-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.nav-btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
}

@keyframes pulse {
    0% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.5);
    }
    100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    }
}

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

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.5rem;
}

/* 主要内容区域 */
.main {
    display: flex;
    height: calc(100vh - 64px);
    max-width: 1400px;
}

.main {
    margin-left: 300px;
    margin-right: 0;
    transition: margin-left 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
}



/* 工作区域 */
.workspace {
    flex: 1;
    display: flex;
    background: white;
    height: 100%;
}

.workspace.editor-only .preview-panel {
    display: none !important;
}

.workspace.preview-only .editor-panel {
    display: none !important;
}

.workspace.editor-only .editor-panel {
    flex: 1;
    width: 100%;
}

.workspace.preview-only .preview-panel {
    flex: 1;
    width: 100%;
}

/* 面板样式 */
.editor-panel,
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.editor-panel {
    border-right: 1px solid #e2e8f0;
    display: flex;
    position: relative;
}

.editor-content-wrapper {
    display: flex;
    flex: 1;
    position: relative;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.panel-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-tools {
    display: flex;
    gap: 0.25rem;
}

.tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 0.375rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 4px;
}

.tool-btn:hover {
    background: #e2e8f0;
    color: #374151;
}

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

/* 工具分隔线 */
.tool-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 4px;
}



/* 展开按钮 */
.sidebar-expand-btn {
    position: fixed;
    top: 84px;
    left: 10px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.sidebar-expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

/* 左侧功能侧边栏 */
.right-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    width: 280px;
    height: calc(100vh - 64px);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    z-index: 100;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.right-sidebar.collapsed {
    transform: translateX(-280px);
}

/* 功能按钮栏 */
.function-buttons {
    width: 56px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
}

.function-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.2s ease;
    border: 1px solid var(--border-color);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.function-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.function-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

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

.function-btn span {
    font-size: 8px;
    font-weight: 500;
    margin-top: 1px;
}

/* 功能面板容器 */
.function-panels {
    flex: 1;
    background: white;
    overflow: hidden;
}

.function-panel {
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.function-panel.active {
    display: flex;
}

/* 面板头部 */
.function-panel .panel-header {
    background: #f8fafc;
    color: #1e293b;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.function-panel .panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.panel-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.api-status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6b6b;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #51cf66;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.collapse-btn {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.collapse-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

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

/* 面板内容 */
.panel-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

/* AI处理状态 */
.ai-processing {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    color: white;
    text-align: center;
}

.processing-animation {
    margin-bottom: 15px;
}

.processing-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.processing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: bounce 1.4s infinite ease-in-out;
}

.processing-dots span:nth-child(1) { animation-delay: -0.32s; }
.processing-dots span:nth-child(2) { animation-delay: -0.16s; }

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

.processing-text {
    font-size: 14px;
    font-weight: 500;
}

.processing-progress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: white;
    border-radius: 10px;
    animation: progress 2s infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* AI功能区域 */
.ai-functions {
    margin-bottom: 30px;
}

.ai-functions-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.ai-function-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ai-function-btn:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ai-function-btn:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.ai-function-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

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

.ai-function-content {
    flex: 1;
}

.ai-function-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.ai-function-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* AI设置区域 */
.ai-settings {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.ai-settings-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color);
}

.ai-setting-item {
    margin-bottom: 15px;
}

.ai-setting-item label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.ai-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23666" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

.ai-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color-alpha);
}

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

/* 暗色主题下的选择器样式 */
[data-theme="dark"] .ai-select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23ccc" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
}

.api-key-input-group {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.api-key-input-group:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
}

.api-key-input {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.api-key-input:focus {
    outline: none;
}

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

.api-key-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.api-key-toggle:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.api-key-toggle svg {
    width: 16px;
    height: 16px;
}

.api-key-help {
    margin-top: 8px;
}

.api-key-help small {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.4;
}

/* 滑块样式 */
.slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-slider {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ai-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider-value {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    min-width: 40px;
    text-align: center;
    background: var(--card-bg);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* 自定义提示词样式 */
.custom-prompts {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.custom-prompts-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
}

.prompt-list {
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    padding: 8px;
}

.prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

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

.prompt-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.prompt-info {
    flex: 1;
}

.prompt-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 2px;
}

.prompt-desc {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.prompt-preview {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.2;
    font-style: italic;
    background: var(--bg-tertiary);
    padding: 4px 6px;
    border-radius: 4px;
    margin-top: 4px;
}

.prompt-header {
    margin-bottom: 16px;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.prompt-header-text h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 600;
}

.prompt-header-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.prompt-apply-section {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.apply-prompt-btn {
    flex: 1;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.apply-prompt-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.cancel-prompt-btn {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.prompt-category {
    font-size: 10px;
    padding: 2px 6px;
    background: var(--primary-color);
    color: white;
    border-radius: 10px;
    margin-right: 8px;
}

.prompt-actions {
    display: flex;
    gap: 4px;
}

.prompt-action-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.prompt-action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

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

.add-prompt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.add-prompt-btn svg {
    width: 14px;
    height: 14px;
}

/* 自定义提示词模态框样式 */
.prompt-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), var(--shadow-sm);
    background: var(--bg-primary);
}

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

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

.form-select {
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary:hover {
    background: #5a67d8;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

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

/* 响应式设计 */
@media (max-width: 1024px) {
    .main {
        margin-left: 500px;
    }
    
    .right-sidebar {
        width: 240px;
    }
    
    .right-sidebar.collapsed {
        transform: translateX(-240px);
    }
    

    
    .function-buttons {
        width: 52px;
    }
    
    .function-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 768px) {
    .main {
        margin-left: 420px;
    }
    
    .right-sidebar {
        width: 200px;
        left: 0;
    }
    
    .right-sidebar.collapsed {
        transform: translateX(-200px);
    }
    

    }
    
    .sidebar-expand-btn {
        left: 10px;
        width: 36px;
        height: 36px;
    }
    
    .function-buttons {
        width: 48px;
    }
    
    .function-btn {
        width: 32px;
        height: 32px;
    }
    
    .function-btn svg {
        width: 14px;
        height: 14px;
    }
    
    .function-btn span {
        font-size: 7px;
    }
    
    .panel-content {
        padding: 12px;
    }
    


 }
 
 /* 临时消息动画 */
 @keyframes slideInRight {
     from {
         transform: translateX(100%);
         opacity: 0;
     }
     to {
         transform: translateX(0);
         opacity: 1;
     }
 }
 
 @keyframes slideOutRight {
     from {
         transform: translateX(0);
         opacity: 1;
     }
     to {
         transform: translateX(100%);
         opacity: 0;
     }
 }

/* 编辑器 */
.editor {
    /* 基础样式由 .editor-panel #editor 覆盖 */
}

.editor::placeholder {
    color: #94a3b8;
}

/* 预览区域 */
.preview {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background: white;
}

/* Markdown 渲染样式 */
.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
    margin: 1.5rem 0 1rem 0;
    font-weight: 600;
    line-height: 1.3;
    color: #1e293b;
}

.preview h1 {
    font-size: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
}

.preview h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.25rem;
}

.preview h3 {
    font-size: 1.25rem;
}

.preview h4 {
    font-size: 1.125rem;
}

.preview h5,
.preview h6 {
    font-size: 1rem;
}

.preview p {
    margin: 1rem 0;
    line-height: 1.7;
}

.preview ul,
.preview ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.preview li {
    margin: 0.5rem 0;
}

.preview blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-left: 4px solid #0d9488;
    border-radius: 0 0.5rem 0.5rem 0;
}

.preview blockquote p {
    margin: 0;
    color: #475569;
    font-style: italic;
}

.preview code {
    background: #f1f5f9;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Fira Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.875em;
    color: #dc2626;
}

.preview pre {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: #1e293b;
    border-radius: 0.5rem;
    overflow-x: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.preview pre code {
    background: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.875rem;
}

.preview table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.preview th,
.preview td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.preview th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
}

.preview tr:hover {
    background: #f8fafc;
}

.preview a {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.preview a:hover {
    border-bottom-color: #2563eb;
}

.preview img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.preview hr {
    margin: 2rem 0;
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #e2e8f0, transparent);
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

/* 帮助模态框特殊样式 */
.help-modal {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.modal-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #64748b;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #f1f5f9;
    color: #374151;
}

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

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

/* 帮助模态框特定样式 */
.help-content {
    max-width: 100%;
}

.help-sections {
    columns: 2;
    column-gap: 2rem;
    column-fill: balance;
}

@media (max-width: 768px) {
    .help-sections {
        columns: 1;
    }
    
    .help-modal {
        max-width: 95%;
        width: 95%;
    }
}

.help-section {
    margin-bottom: 1.5rem;
    break-inside: avoid;
}

.help-section h4 {
    color: #2563eb;
    margin-bottom: 0.75rem;
    font-size: 1rem;
    border-bottom: 2px solid #2563eb;
    padding-bottom: 0.4rem;
    font-weight: 600;
}

.shortcut-list {
    display: grid;
    gap: 0.4rem;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: 0.4rem;
    border-left: 3px solid #2563eb;
}

.shortcut-key {
    font-family: 'Fira Mono', 'Monaco', 'Consolas', monospace;
    background: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #2563eb;
    font-weight: 600;
}

.shortcut-desc {
    color: #475569;
    font-size: 0.875rem;
}

.markdown-syntax {
    background: #f1f5f9;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.markdown-syntax code {
    background: #e2e8f0;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Fira Mono', 'Monaco', 'Consolas', monospace;
    color: #2563eb;
    font-weight: 500;
}

.markdown-tips {
    display: grid;
    gap: 0.4rem;
}

.tip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: #f8fafc;
    border-radius: 0.4rem;
    border-left: 3px solid #10b981;
}

.tip-item code {
    background: #e2e8f0;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Fira Mono', 'Monaco', 'Consolas', monospace;
    color: #10b981;
    font-weight: 600;
    font-size: 0.8rem;
}

.tip-item span:last-child {
    color: #475569;
    font-size: 0.8rem;
}

/* 导出选项 */
.export-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.export-option:hover {
    border-color: #2563eb;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 0.75rem;
    color: #2563eb;
    flex-shrink: 0;
}

.export-option:hover .option-icon {
    background: #2563eb;
    color: white;
}

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

.option-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.option-info p {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

/* 暗色主题 */
.dark-theme {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3d3d3d;
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --border-color: #404040;
    --accent-color: #667eea;
    --accent-hover: #5a6fd8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
}

.dark-theme .header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}



.dark-theme .editor-panel,
.dark-theme .preview-panel {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-theme .editor {
    /* 基础样式由 .dark-theme .editor-panel #editor 覆盖 */
}

.dark-theme .preview {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.dark-theme .modal-content {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-theme .export-option {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.dark-theme .export-option:hover {
    background: var(--bg-primary);
}

.dark-theme .nav-btn,
.dark-theme .tool-btn {
    color: var(--text-secondary);
}

.dark-theme .nav-btn:hover,
.dark-theme .tool-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}



.dark-theme .help-section h4 {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.dark-theme .shortcut-item {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-color);
}

.dark-theme .shortcut-key {
    background: var(--border-color);
    color: var(--accent-color);
}

.dark-theme .shortcut-desc {
    color: var(--text-secondary);
}

.dark-theme .markdown-syntax {
    background: var(--bg-tertiary);
}

.dark-theme .markdown-syntax code {
    background: var(--border-color);
    color: var(--accent-color);
}

/* 响应式设计 */
@media (max-width: 1024px) {

    
    .workspace {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0.5rem 1rem;
    }
    
    .nav {
        gap: 0.25rem;
    }
    
    .nav-btn {
        padding: 0.5rem;
        font-size: 0;
    }
    
    .nav-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .workspace {
        flex-direction: column;
    }
    
    .workspace:not(.editor-only):not(.preview-only) .editor-panel,
    .workspace:not(.editor-only):not(.preview-only) .preview-panel {
        height: 50vh;
    }
    
    .workspace.editor-only .editor-panel {
        height: 100vh;
    }
    
    .workspace.preview-only .preview-panel {
        height: 100vh;
    }
    
    .editor-panel {
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    /* AI面板响应式 */
    .ai-panel {
        width: 280px;
        right: -10px;
    }
    
    .panel-tools {
        position: relative;
    }
    
    .export-options {
        grid-template-columns: 1fr;
    }
    
    /* AI面板小屏幕适配 */
    .ai-panel {
        width: 260px;
        right: -20px;
    }
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    border-top-color: #2563eb;
    animation: spin 1s ease-in-out infinite;
}

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

/* 消息提示样式 */
.success-message,
.error-message,
.warning-message,
.info-message {
    position: fixed;
    top: 80px;
    right: 20px;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 14px;
    font-weight: 500;
    z-index: 1001;
    animation: slideInRight 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.success-message {
    background: #10b981;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.error-message {
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.warning-message {
    background: #f59e0b;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.info-message {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

/* 代码高亮主题覆盖 */
.hljs {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 1.5rem !important;
    border-radius: 0.5rem !important;
}

/* 行号样式 */
.line-numbers-container {
    flex-shrink: 0;
    width: 60px;
    background: #f8fafc;
    border-right: 1px solid #e2e8f0;
    position: relative;
}

.line-numbers {
    color: #64748b;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem 0.5rem;
    text-align: right;
    user-select: none;
    height: 100%;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
}

.line-number {
    height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    box-sizing: border-box;
}

.dark .line-numbers-container {
    background: #1e293b;
    border-right-color: #334155;
}

.dark .line-numbers {
    color: #64748b;
}

.editor-panel #editor {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    padding: 1rem;
    background: white;
    color: #1e293b;
    min-height: calc(100vh - 200px);
}

/* 字数统计样式 */
.word-count {
    position: absolute;
    bottom: 10px;
    right: 15px;
    background: rgba(37, 99, 235, 0.1);
    color: #475569;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(37, 99, 235, 0.2);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.word-count.dark {
    background: rgba(59, 130, 246, 0.15);
    color: #cbd5e1;
    border-color: rgba(59, 130, 246, 0.3);
}

/* 查找替换面板样式 */
.search-replace-panel {
    position: absolute;
    top: 10px;
    right: 15px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 20;
    min-width: 300px;
    display: none;
}

.search-replace-panel.dark {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.search-replace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.search-replace-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.search-replace-panel.dark .search-replace-title {
    color: #e2e8f0;
}

.search-close-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 1;
}

.search-close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.search-replace-panel.dark .search-close-btn {
    color: #9ca3af;
}

.search-replace-panel.dark .search-close-btn:hover {
    background: #374151;
    color: #e2e8f0;
}

.search-input-group {
    margin-bottom: 8px;
}

.search-input-group label {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 500;
}

.search-replace-panel.dark .search-input-group label {
    color: #9ca3af;
}

.search-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.875rem;
    background: white;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.search-replace-panel.dark .search-input {
    background: #374151;
    border-color: #4b5563;
    color: #e2e8f0;
}

.search-replace-panel.dark .search-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.search-nav-btn {
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    min-width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-nav-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.search-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.search-replace-panel.dark .search-nav-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e2e8f0;
}

.search-replace-panel.dark .search-nav-btn:hover {
    background: #4b5563;
}

.search-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.search-action-btn {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
}

.search-action-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.search-action-btn.primary {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.search-action-btn.primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.search-replace-panel.dark .search-action-btn {
    background: #374151;
    border-color: #4b5563;
    color: #e2e8f0;
}

.search-replace-panel.dark .search-action-btn:hover {
    background: #4b5563;
}

.search-replace-panel.dark .search-action-btn.primary {
    background: #3b82f6;
    border-color: #3b82f6;
}

.search-replace-panel.dark .search-action-btn.primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.search-match-info {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 8px;
    text-align: center;
}

.search-replace-panel.dark .search-match-info {
    color: #9ca3af;
}

/* 搜索高亮样式 */
.search-highlight {
    background-color: #fef3c7;
    border-radius: 2px;
    padding: 1px 2px;
}

.search-highlight.current {
    background-color: #fbbf24;
    color: #92400e;
}

.dark .search-highlight {
    background-color: #451a03;
    color: #fbbf24;
}

.dark .search-highlight.current {
    background-color: #92400e;
    color: #fef3c7;
}

/* 打印样式 */
@media print {
    .header,
    .sidebar,
    .panel-header,
    .panel-tools,
    .word-count,
    .search-replace-panel {
        display: none !important;
    }
    
    .main {
        height: auto;
    }
    
    .workspace {
        display: block;
    }
    
    .editor-panel {
        display: none;
    }
    
    .preview-panel {
        border: none;
    }
    
    .preview {
        padding: 0;
    }
}