/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 40px);
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1em;
    opacity: 0.9;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧面板 */
.left-panel {
    width: 400px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.panel-section {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.panel-section h3 {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #667eea;
    border-bottom: 2px solid #667eea;
    padding-bottom: 8px;
}

.flex-grow {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 文件上传 */
.upload-area {
    text-align: center;
}

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
    color: #666;
}

/* 过滤器 */
.filter-group {
    margin-bottom: 12px;
}

.filter-group label {
    display: block;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 5px;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-outline {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: white;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group .btn {
    flex: 1;
}

/* 统计信息 */
.statistics {
    font-size: 0.9em;
    line-height: 1.8;
    color: #555;
}

/* 题目列表 */
.question-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    max-height: 400px;
}

.question-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.question-item:hover {
    background: #f8f9fa;
}

.question-item.active {
    background: #e7f3ff;
    border-left: 3px solid #667eea;
}

.placeholder {
    text-align: center;
    color: #999;
    padding: 30px;
}

/* 右侧面板 */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 标签页 */
.tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 0 20px;
}

.tab-btn {
    padding: 15px 25px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* 标签内容 */
.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* 工具栏 */
.toolbar {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 代码块 */
.code-block {
    flex: 1;
    overflow: auto;
    padding: 20px;
    margin: 0;
    background: #2d2d2d;
    color: #f8f8f2;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    line-height: 1.6;
}

/* 预览区域 */
.preview-area {
    flex: 1;
    overflow: auto;
    padding: 30px;
    background: white;
    line-height: 1.8;
    font-size: 16px;
    color: #333;
}

/* MathJax数学公式样式 */
.preview-area .MathJax {
    font-size: 1.1em;
}

.preview-area mjx-container {
    margin: 10px 0;
}

.preview-area mjx-container[display="true"] {
    display: block;
    text-align: center;
    margin: 20px 0;
}

/* 行内公式 */
.preview-area mjx-container[display="false"] {
    display: inline-block;
    margin: 0 3px;
}

/* 公式块 */
.preview-area .math-block {
    padding: 15px;
    margin: 20px 0;
    background: #f9f9f9;
    border-left: 4px solid #667eea;
    border-radius: 4px;
    overflow-x: auto;
}

.preview-area h1 {
    color: #667eea;
    border-bottom: 3px solid #667eea;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.preview-area h2 {
    color: #444;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.preview-area h3 {
    color: #555;
    margin-top: 30px;
    margin-bottom: 15px;
}

.preview-area table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
}

.preview-area th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: left;
}

.preview-area td {
    padding: 12px 15px;
    border-bottom: 1px solid #e8e8e8;
}

.preview-area tr:hover {
    background: #f8f9fa;
}

.preview-area blockquote {
    border-left: 4px solid #667eea;
    padding: 15px 25px;
    background: #f9fafb;
    margin: 20px 0;
}

.preview-area code {
    background: #f4f4f4;
    padding: 3px 8px;
    border-radius: 4px;
    color: #e83e8c;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.preview-area pre {
    background: #f6f8fa;
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
    margin: 20px 0;
    line-height: 1.45;
}

.preview-area pre code {
    background: none;
    padding: 0;
    color: #24292e;
    font-size: 0.95em;
}

.preview-area p {
    margin: 15px 0;
    line-height: 1.8;
}

.preview-area ul, .preview-area ol {
    margin: 15px 0;
    padding-left: 30px;
}

.preview-area li {
    margin: 8px 0;
    line-height: 1.6;
}

.preview-area strong {
    color: #222;
    font-weight: 600;
}

.preview-area em {
    font-style: italic;
    color: #555;
}

.preview-area hr {
    border: none;
    border-top: 2px solid #e1e4e8;
    margin: 30px 0;
}

.preview-area a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.preview-area a:hover {
    border-bottom-color: #667eea;
}

/* 状态栏 */
.status-bar {
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    padding: 10px 20px;
    font-size: 0.9em;
    color: #666;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin-bottom: 10px;
    color: #667eea;
}

.modal-description {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.6;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.modal-buttons .btn {
    flex: 1;
}

/* 加载动画 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-spinner p {
    font-size: 1.2em;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .left-panel {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
}
