/* 基础重置与变量 */
:root {
    --primary-color: #4a6fa5;
    --primary-dark: #385d8a;
    --secondary-color: #6b8cbc;
    --accent-color: #ff9800;
    --success-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #6c757d;
    --light-gray: #e9ecef;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #f5f7fa;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.subtitle {
    color: var(--gray-color);
    font-size: 1.1rem;
}

/* 模式选择器 */
.mode-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.mode-btn {
    flex: 1;
    min-width: 140px;
    padding: 14px 20px;
    background: white;
    border: 2px solid var(--light-gray);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-color);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mode-btn:hover {
    border-color: var(--secondary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.mode-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 试卷选择器 */
.paper-selector {
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.paper-selector h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.paper-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.paper-item {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.paper-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.paper-item.active {
    border-color: var(--primary-color);
    background-color: rgba(74, 111, 165, 0.05);
}

.paper-item h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.paper-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-top: 10px;
}

.paper-count {
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* 内容区域 */
.content-area {
    flex: 1;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 25px;
    overflow: hidden;
}

.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
}

/* 题目头部 */
.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.question-header h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
}

.question-nav {
    display: flex;
    align-items: center;
    gap: 15px;
}

.question-nav span {
    font-weight: 600;
    color: var(--gray-color);
    min-width: 80px;
    text-align: center;
}

/* 题目容器 */
.question-container {
    min-height: 300px;
    padding: 20px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
    overflow-y: auto;
    max-height: 500px;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--gray-color);
    text-align: center;
}

.placeholder i {
    margin-bottom: 20px;
    color: var(--light-gray);
}

.placeholder p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.hint {
    font-size: 0.9rem !important;
    color: var(--gray-color);
    max-width: 500px;
}

/* 题目内容样式 */
.question-group {
    margin-bottom: 25px;
}

.group-material {
    background: #f0f7ff;
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.question-item {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border-color);
}

.question-item:last-child {
    border-bottom: none;
}

.question-content {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 20px;
    color: var(--dark-color);
}

.question-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 10px 0;
    box-shadow: var(--shadow);
}

/* 选项样式 */
.options-container {
    margin: 20px 0;
}

.option-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    padding: 12px 15px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    border-color: var(--secondary-color);
    background-color: #f8fafd;
}

.option-item.selected {
    border-color: var(--primary-color);
    background-color: rgba(74, 111, 165, 0.05);
}

.option-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--light-gray);
    border-radius: 50%;
    font-weight: bold;
    margin-right: 15px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    line-height: 1.6;
}

.option-image {
    max-width: 200px;
    max-height: 150px;
    margin-top: 10px;
    border-radius: var(--border-radius-sm);
}

/* 答案与解析 */
.answer-section {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--success-color);
}

.answer-section h4 {
    color: var(--success-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.analysis-section {
    margin-top: 20px;
    padding: 20px;
    background: #fff8e1;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--warning-color);
}

.analysis-section h4 {
    color: var(--warning-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.knowledge-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.knowledge-tag {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-left: 15px;
}

.difficulty-easy {
    background: #d4edda;
    color: #155724;
}

.difficulty-medium {
    background: #fff3cd;
    color: #856404;
}

.difficulty-hard {
    background: #f8d7da;
    color: #721c24;
}

/* 控制按钮 */
.study-controls,
.practice-controls {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.nav-btn,
.action-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-btn {
    background: var(--light-gray);
    color: var(--dark-color);
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--gray-color);
    color: white;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn {
    background: var(--primary-color);
    color: white;
}

.action-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.submit-btn {
    background: var(--success-color);
}

.submit-btn:hover:not(:disabled) {
    background: #3d8b40;
}

.danger-btn {
    background: var(--danger-color);
}

.danger-btn:hover:not(:disabled) {
    background: #d32f2f;
}

/* 答题结果面板 */
.result-panel {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--border-radius);
    animation: slideIn 0.3s ease;
}

.result-panel.hidden {
    display: none;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 600;
}

.result-icon {
    font-size: 1.5rem;
}

.result-correct {
    color: var(--success-color);
}

.result-wrong {
    color: var(--danger-color);
}

/* 错题练习模式 */
.review-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.review-header h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stats {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    background: var(--light-color);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.stat-label {
    display: block;
    color: var(--gray-color);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.filter-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--light-gray);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover {
    background: #dde1e7;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.review-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.review-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 18px;
    transition: var(--transition);
    position: relative;
}

.review-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow);
}

.review-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.review-item-title {
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
}

.review-badges {
    display: flex;
    gap: 8px;
}

.review-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.badge-wrong {
    background: #ffebee;
    color: var(--danger-color);
}

.badge-important {
    background: #fff8e1;
    color: var(--warning-color);
}

.review-stats {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-top: 10px;
    display: flex;
    gap: 15px;
}

/* 管理功能 */
.management-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.management-section:last-child {
    border-bottom: none;
}

.management-section h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.paper-manager {
    margin-bottom: 20px;
}

.edit-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.select-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: white;
}

.select-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.json-editor {
    width: 100%;
    height: 400px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    background: #f8f9fa;
}

.json-editor:focus {
    outline: none;
    border-color: var(--primary-color);
}

.editor-buttons {
    display: flex;
    gap: 15px;
    margin-top: 15px;
}

.warning-text {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    padding: 15px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.warning-text i {
    color: var(--warning-color);
    margin-top: 2px;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--gray-color);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.version {
    font-size: 0.8rem;
    margin-top: 5px;
    color: #adb5bd;
}

/* 消息提示 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 15px 25px;
    background: var(--dark-color);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* 动画 */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .mode-selector {
        flex-direction: column;
    }
    
    .mode-btn {
        min-width: 100%;
    }
    
    .paper-list {
        grid-template-columns: 1fr;
    }
    
    .question-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .question-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        min-width: 100%;
    }
    
    .review-list {
        grid-template-columns: 1fr;
    }
    
    .edit-controls {
        flex-direction: column;
    }
    
    .select-input {
        min-width: 100%;
    }
    
    .study-controls,
    .practice-controls {
        flex-direction: column;
    }
    
    .nav-btn,
    .action-btn {
        width: 100%;
    }
    
    .toast {
        left: 15px;
        right: 15px;
        bottom: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .question-container {
        padding: 15px;
    }
    
    .option-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .option-label {
        margin-bottom: 10px;
    }
}
