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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 24px;
    padding: 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    color: white;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

header p {
    font-size: 14px;
    opacity: 0.9;
}

/* Tab导航样式 */
.tab-navigation {
    display: flex;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

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

.tab-btn:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

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

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: white;
    border-radius: 3px 3px 0 0;
}

/* Tab内容样式 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    gap: 20px;
    min-height: calc(100vh - 220px);
}

/* 左侧参数面板 - 占比 2/10 */
.left-panel {
    flex: 2;
    min-width: 280px;
    max-width: 320px;
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 220px);
    overflow-y: auto;
}

.left-panel h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color);
}

/* 表单样式 */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
    background: var(--card-bg);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 表单操作按钮 */
.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.form-actions button {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-actions button[type="submit"],
.primary-btn {
    background: var(--primary-color);
    color: white;
}

.form-actions button[type="submit"]:hover,
.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.form-actions button[type="submit"]:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.form-actions button[type="button"],
.secondary-btn {
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.form-actions button[type="button"]:hover,
.secondary-btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

.danger-btn {
    background: var(--danger-color) !important;
    color: white !important;
    border: none !important;
}

.danger-btn:hover {
    background: #dc2626 !important;
}

.small-btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.small-btn:hover {
    background: var(--primary-hover);
}

/* 右侧结果面板 - 占比 8/10 */
.right-panel {
    flex: 8;
    background: var(--card-bg);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--success-color);
}

.result-header h2 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.pagination-info,
.score-summary {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.result-header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.export-btn {
    padding: 6px 14px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.pagination-info span,
.score-summary span {
    background: var(--bg-color);
    padding: 4px 12px;
    border-radius: 20px;
}

.result-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 结果显示 */
.result {
    font-size: 14px;
    line-height: 1.6;
}

.result .placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 60px 20px;
    font-style: italic;
}

/* 试题卡片样式 */
.question-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.question-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.question-id {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 13px;
}

.question-type {
    background: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.question-card-body {
    padding: 16px;
}

.question-stem {
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 15px;
}

.question-stem p {
    margin: 8px 0;
}

.question-stem img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
}

.question-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-color);
    padding: 4px 10px;
    border-radius: 6px;
}

.meta-tag .label {
    font-weight: 500;
    color: var(--text-primary);
}

/* 难度标签颜色 */
.difficulty-easy { background: #d1fae5; color: #065f46; }
.difficulty-medium { background: #fef3c7; color: #92400e; }
.difficulty-hard { background: #fee2e2; color: #991b1b; }

/* AI评分结果卡片 */
.score-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.score-card:hover {
    box-shadow: var(--shadow);
}

.score-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-bottom: 1px solid var(--border-color);
}

.score-card-header .question-id {
    font-weight: 600;
    color: var(--text-primary);
}

.score-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
    font-weight: 700;
}

.score-badge.high { color: var(--success-color); }
.score-badge.medium { color: var(--warning-color); }
.score-badge.low { color: var(--danger-color); }

.score-badge span {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
}

.score-card-body {
    padding: 16px;
}

.score-stem {
    background: #fefefe;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.score-stem::before {
    content: '📝 题干：';
    font-weight: 600;
    color: var(--primary-color);
    display: block;
    margin-bottom: 8px;
}

.score-stem img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
}

.score-reason {
    background: var(--bg-color);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.score-reason::before {
    content: '💡 评分理由：';
    font-weight: 600;
    color: var(--text-primary);
}

/* AI评分试题属性标签样式 */
.score-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
}

.score-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* 难度标签样式 */
.score-tag.difficulty-tag {
    border: 1px solid;
}

.score-tag.difficulty-tag.difficulty-easy {
    background: #d1fae5;
    color: #065f46;
    border-color: #a7f3d0;
}

.score-tag.difficulty-tag.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
    border-color: #fde68a;
}

.score-tag.difficulty-tag.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* 题型标签样式 */
.score-tag.type-tag {
    background: #e0e7ff;
    color: #3730a3;
    border: 1px solid #c7d2fe;
}

/* 知识点标签样式 */
.score-tag.kpoint-tag {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* 答案解析展开区域样式 */
.score-expand-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    animation: slideDown 0.3s ease;
}

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

.score-answer,
.score-explanation {
    background: #fefefe;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    line-height: 1.8;
}

.score-answer {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: #bbf7d0;
}

.score-explanation {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #bfdbfe;
}

.expand-label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.expand-content {
    font-size: 14px;
    color: var(--text-primary);
}

.expand-content img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
}

.expand-content p {
    margin: 6px 0;
}

/* 展开提示样式 */
.expand-hint {
    text-align: center;
    padding: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-top: 1px dashed var(--border-color);
    margin-top: 12px;
}

.expand-hint:hover {
    color: var(--primary-color);
    background: var(--bg-color);
    border-radius: 0 0 12px 12px;
}

.expand-icon {
    display: inline-block;
    margin-right: 6px;
    font-size: 10px;
    transition: transform 0.2s ease;
}

/* 卡片展开状态样式 */
.score-card.expanded {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.score-card.expanded .expand-hint {
    background: var(--bg-color);
    border-radius: 0 0 12px 12px;
}

/* MathML和公式在答案解析中的渲染样式 */
.score-answer math,
.score-answer .MathJax,
.score-explanation math,
.score-explanation .MathJax {
    font-size: 1.1em;
}

/* 表格在答案解析中的样式 */
.expand-content table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
}

.expand-content table td,
.expand-content table th {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
}

.expand-content table th {
    background: var(--bg-color);
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.page-number:hover {
    background: var(--bg-color);
}

.page-number.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 悬浮窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #7c3aed 100%);
    color: white;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    display: flex;
    height: calc(80vh - 70px);
}

/* 提示词列表面板 */
.prompt-list-panel {
    width: 240px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.prompt-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

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

.prompt-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.prompt-item {
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prompt-item:hover {
    background: var(--bg-color);
}

.prompt-item.active {
    background: var(--primary-color);
    color: white;
}

.prompt-item .default-tag {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.prompt-item:not(.active) .default-tag {
    background: var(--bg-color);
    color: var(--text-secondary);
}

/* 提示词编辑面板 */
.prompt-edit-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.prompt-edit-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.prompt-name-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.prompt-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.readonly-badge {
    background: var(--warning-color);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.prompt-textarea {
    flex: 1;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: none;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.prompt-textarea:read-only {
    background: var(--bg-color);
    color: var(--text-secondary);
}

.prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.prompt-actions button {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .tab-content.active {
        flex-direction: column;
    }
    
    .left-panel {
        max-width: none;
        max-height: none;
    }
    
    .right-panel {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }
    
    header h1 {
        font-size: 22px;
    }
    
    .tab-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .modal-body {
        flex-direction: column;
    }
    
    .prompt-list-panel {
        width: 100%;
        height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 3px;
}

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

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

/* MathML 和公式渲染样式 */
.question-stem math,
.question-stem .MathJax {
    font-size: 1.1em;
}

/* 确保表格在题干中正确显示 */
.question-stem table {
    border-collapse: collapse;
    margin: 10px 0;
}

.question-stem table td,
.question-stem table th {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
}

.question-stem table th {
    background: var(--bg-color);
}

/* AI评分信息提示样式 */
.ai-score-info {
    margin: 20px 0;
    padding: 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 10px;
    border-left: 4px solid var(--primary-color);
}

.ai-score-info .info-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.6;
}

.ai-score-info .picked-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.ai-score-info .picked-count span {
    font-size: 18px;
    color: var(--success-color);
}

/* AI评分进度样式 */
.score-progress {
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-color);
    border-radius: 8px;
}

.score-progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.score-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* Loading区域内的进度条样式 */
.progress-container {
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
}

.progress-bar-wrapper {
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--success-color) 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    width: 0%;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: progress-shine 1.5s ease-in-out infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 500;
    margin: 0;
}

/* ==================== 树状选择器样式 ==================== */

/* 树状选择容器 */
.tree-select-container,
.multi-select-container {
    position: relative;
    width: 100%;
}

/* 触发器样式 */
.tree-select-trigger,
.multi-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 42px;
}

.tree-select-trigger:hover,
.multi-select-trigger:hover {
    border-color: var(--primary-color);
}

.tree-select-trigger.active,
.multi-select-trigger.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.tree-select-placeholder,
.multi-select-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-select-value,
.multi-select-value {
    color: var(--text-primary);
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-select-arrow,
.multi-select-arrow {
    color: var(--text-secondary);
    font-size: 10px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 8px;
}

.tree-select-trigger.active .tree-select-arrow,
.multi-select-trigger.active .multi-select-arrow {
    transform: rotate(180deg);
}

/* 下拉框样式 */
.tree-select-dropdown,
.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    margin-top: 4px;
    max-height: 350px;
    overflow: hidden;
}

.tree-select-dropdown.show,
.multi-select-dropdown.show {
    display: block;
}

/* 搜索框 */
.tree-select-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tree-select-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.tree-select-search input:focus {
    border-color: var(--primary-color);
}

/* 树状内容区域 */
.tree-select-content,
.multi-select-content {
    max-height: 280px;
    overflow-y: auto;
    padding: 8px;
}

/* 树状列表 */
.tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree-list.level-0 {
    padding-left: 0;
}

.tree-list.level-1 {
    padding-left: 20px;
}

.tree-list.level-2 {
    padding-left: 20px;
}

.tree-list.level-3 {
    padding-left: 20px;
}

/* 树节点 */
.tree-node {
    margin: 2px 0;
}

.tree-node > .tree-list {
    display: none;
}

.tree-node.expanded > .tree-list {
    display: block;
}

/* 节点内容 */
.tree-node-content {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.tree-node-content:hover {
    background: var(--bg-color);
}

.tree-node.selected > .tree-node-content {
    background: rgba(37, 99, 235, 0.1);
}

/* 展开/收起按钮 */
.tree-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    margin-right: 4px;
}

.tree-toggle:hover {
    color: var(--primary-color);
}

.tree-toggle-placeholder {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-right: 4px;
}

/* 复选框样式 */
.tree-checkbox-label,
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.tree-checkbox,
.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 8px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s ease;
    background: var(--card-bg);
}

.tree-checkbox:checked + .checkbox-custom,
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.tree-checkbox:checked + .checkbox-custom::after,
.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.tree-node-text,
.checkbox-text {
    font-size: 13px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 多选项样式 */
.multi-select-item {
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.multi-select-item:hover {
    background: var(--bg-color);
}

/* 加载和空状态 */
.tree-loading,
.tree-empty,
.tree-error {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.tree-error {
    color: var(--danger-color);
}

/* 表单下拉框样式优化 */
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

/* 左侧面板滚动优化 */
.left-panel {
    overflow-y: auto;
    overflow-x: hidden;
}

.left-panel::-webkit-scrollbar {
    width: 4px;
}

.left-panel::-webkit-scrollbar-track {
    background: transparent;
}

.left-panel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

/* 表单组间距调整 */
.left-panel .form-group {
    margin-bottom: 14px;
}

.left-panel .form-group label {
    font-size: 12px;
    margin-bottom: 4px;
}
