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

:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* 标签切换 */
.tabs {
    display: flex;
    background: var(--bg-color);
    padding: 0;
    border-bottom: 2px solid var(--border-color);
}

.tab-button {
    flex: 1;
    padding: 20px;
    background: transparent;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-button:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.tab-button.active {
    color: var(--primary-color);
    background: white;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

/* 内容面板 */
.tab-content {
    display: none;
    padding: 40px 30px;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* 同步提示 */
.sync-hint {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border-left: 4px solid var(--primary-color);
    padding: 12px 15px;
    margin-bottom: 25px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.auto-sync-label {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-left: 8px;
}

/* 表单组 */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 1rem;
}

.form-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: var(--bg-color);
}

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

/* 文件上传 */
.file-upload-wrapper {
    margin-top: 15px;
}

.file-input {
    display: none;
}

.file-label {
    display: inline-block;
    padding: 12px 24px;
    background: var(--bg-color);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-secondary);
}

.file-label:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.filename-display {
    margin-left: 15px;
    color: var(--success-color);
    font-weight: 500;
}

/* 按钮 */
.btn {
    padding: 16px 40px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: var(--shadow-md);
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 加载动画 */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* 结果区域 */
.result-section {
    margin-top: 40px;
    padding: 30px;
    background: var(--bg-color);
    border-radius: 16px;
    border: 2px solid var(--border-color);
    animation: slideIn 0.5s ease;
}

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

.result-section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.result-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    line-height: 1.8;
}

/* Markdown渲染样式 */
.result-content h1 {
    font-size: 2rem;
    margin-top: 30px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
    color: var(--text-primary);
}

.result-content h2 {
    font-size: 1.6rem;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.result-content h3 {
    font-size: 1.3rem;
    margin-top: 25px;
    margin-bottom: 12px;
    color: var(--secondary-color);
}

.result-content h4 {
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.result-content p {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.result-content ul,
.result-content ol {
    margin: 15px 0;
    padding-left: 30px;
}

.result-content li {
    margin-bottom: 10px;
    line-height: 1.8;
}

.result-content strong {
    color: var(--text-primary);
    font-weight: 700;
}

.result-content em {
    color: var(--secondary-color);
}

.result-content code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: var(--danger-color);
}

.result-content pre {
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
}

.result-content pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.result-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 20px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 表格样式 */
.result-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    background: white;
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
    overflow: hidden;
}

.result-content thead {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.result-content th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.result-content td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.result-content tr:last-child td {
    border-bottom: none;
}

.result-content tbody tr:hover {
    background: var(--bg-color);
}

/* 底部 */
.footer {
    padding: 20px 30px;
    text-align: center;
    background: var(--bg-color);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 15px;
    }

    .header {
        padding: 30px 20px;
    }

    .header-content h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .tab-content {
        padding: 25px 20px;
    }

    .tab-button {
        padding: 15px 10px;
        font-size: 0.95rem;
    }

    .result-content {
        padding: 20px;
    }

    .result-content h1 {
        font-size: 1.5rem;
    }

    .result-content h2 {
        font-size: 1.3rem;
    }

    .btn {
        padding: 14px 30px;
        font-size: 1rem;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

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