/**
 * 题目渲染器样式 - Question Renderer CSS v2.1
 * 用户端文章题目交互式卡片样式
 *
 * v2.1改进：
 * - 支持在文章原始位置显示题目
 * - 优化嵌入内容的视觉效果
 */

/* 嵌入在文章内容中的题目容器 */
.question-in-content {
    margin: 28px 0;
    padding: 4px 0;
}

/* 题目容器（集中显示模式，保留兼容性） */
.questions-container {
    margin: 32px 0;
    padding: 24px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.questions-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px dashed #cbd5e1;
}

.questions-header h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: #1e293b;
    font-weight: 700;
}

.questions-subtitle {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 单个题目 */
.question-item {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.question-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.question-title {
    font-size: 17px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 18px;
    line-height: 1.6;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.question-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.type-single { background: #dbeafe; color: #1d4ed8; }
.type-multiple { background: #fce7f3; color: #be185d; }
.type-judge { background: #dcfce7; color: #15803d; }
.type-fill { background: #fef9c3; color: #a16207; }

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.option-item:hover {
    border-color: #94a3b8;
    background: #f8fafc;
    transform: translateX(4px);
}

.option-item.correct {
    border-color: #10b981;
    background: #ecfdf5;
}

.option-item.wrong {
    border-color: #ef4444;
    background: #fef2f2;
}

.option-input {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-size: 15px;
    color: #374151;
    line-height: 1.5;
}

.option-correct-mark {
    display: none;
    color: #10b981;
    font-weight: 700;
    font-size: 14px;
}

.option-item.correct .option-correct-mark {
    display: inline;
}

.option-wrong-mark {
    display: none;
    color: #ef4444;
    font-weight: 700;
    font-size: 14px;
}

.option-item.wrong .option-wrong-mark {
    display: inline;
}

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

.btn-submit,
.btn-show-answer {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

.btn-submit:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.btn-show-answer {
    background: transparent;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-show-answer:hover {
    background: #667eea;
    color: white;
}

.question-result {
    margin-top: 20px;
    padding: 16px;
    border-radius: 10px;
    animation: slideDown 0.3s ease;
}

.result-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.result-status.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.result-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.correct-answer {
    padding: 12px 16px;
    background: #f0fdf4;
    border-radius: 8px;
    font-size: 14px;
    color: #15803d;
    font-weight: 500;
    margin-bottom: 12px;
}

.analysis {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    padding: 16px;
    border-radius: 8px;
    margin-top: 12px;
}

.analysis strong {
    color: #92400e;
    font-size: 14px;
}

.analysis-content {
    color: #78350f;
    font-size: 14px;
    line-height: 1.6;
    margin-top: 8px;
    display: block;
}

.fill-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.fill-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.fill-input:disabled {
    background: #f8fafc;
    cursor: not-allowed;
}

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

/* 嵌入模式下的题目项特殊样式 */
.question-in-content .question-item {
    background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
    border-left: 4px solid #667eea;
}

.question-in-content .question-item:hover {
    border-left-color: #5a67d8;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.12);
}

/* 错误提示样式 */
.questions-error {
    margin: 24px 0;
    padding: 20px;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #fecaca;
    border-radius: 12px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    animation: slideDown 0.3s ease;
}

.error-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.error-content h4 {
    margin: 0 0 8px 0;
    color: #991b1b;
    font-size: 18px;
    font-weight: 700;
}

.error-content p {
    margin: 0 0 12px 0;
    color: #7f1d1d;
    font-size: 14px;
    line-height: 1.6;
}

.error-content details {
    margin-top: 12px;
}

.error-content summary {
    cursor: pointer;
    color: #dc2626;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    transition: all 0.2s;
}

.error-content summary:hover {
    background: #fef2f2;
}

.error-content pre {
    margin: 8px 0 0 0;
    padding: 12px;
    background: white;
    border: 1px solid #fecaca;
    border-radius: 6px;
    font-size: 12px;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    color: #374151;
}

/* 嵌入模式响应式 */
@media (max-width: 480px) {
    .questions-container {
        margin: 16px 0;
        padding: 12px;
        border-radius: 12px;
    }

    .question-item {
        padding: 14px;
        border-radius: 10px;
    }

    .question-in-content {
        margin: 20px 0;
    }

    .question-in-content .question-item {
        padding: 14px;
    }
}

/* =====================================================
 * 深色主题（Dark Mode）- 题目渲染器
 * ===================================================== */
[data-theme="dark"] .questions-container {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-color: #2a2a3e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .questions-header {
    border-bottom-color: #3a3a5e;
}

[data-theme="dark"] .questions-header h3 {
    color: #e8e8e8;
}

[data-theme="dark"] .questions-subtitle {
    color: #a0a0a0;
}

[data-theme="dark"] .question-item {
    background: linear-gradient(135deg, #1e1e32 0%, #252540 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    border-color: #2a2a4a;
}

[data-theme="dark"] .question-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

[data-theme="dark"] .question-title {
    color: #e8e8e8;
}

[data-theme="dark"] .type-single { background: rgba(29, 78, 216, 0.2); color: #60a5fa; }
[data-theme="dark"] .type-multiple { background: rgba(190, 24, 93, 0.2); color: #f472b6; }
[data-theme="dark"] .type-judge { background: rgba(21, 128, 61, 0.2); color: #4ade80; }
[data-theme="dark"] .type-fill { background: rgba(161, 98, 7, 0.2); color: #fbbf24; }

[data-theme="dark"] .option-item {
    background: #252540;
    border-color: #3a3a5e;
    color: #e8e8e8;
}

[data-theme="dark"] .option-item:hover {
    border-color: #5a5a7e;
    background: #2d2d4a;
}

[data-theme="dark"] .option-item.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
}

[data-theme="dark"] .option-item.wrong {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

[data-theme="dark"] .option-text {
    color: #e0e0e0;
}

[data-theme="dark"] .option-correct-mark {
    color: #34d399;
}

[data-theme="dark"] .option-wrong-mark {
    color: #f87171;
}

[data-theme="dark"] .btn-submit:disabled {
    background: #3a3a5e;
    color: #808080;
}

[data-theme="dark"] .result-status.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

[data-theme="dark"] .result-status.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

[data-theme="dark"] .correct-answer {
    background: rgba(21, 128, 61, 0.15);
    color: #4ade80;
}

[data-theme="dark"] .analysis {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

[data-theme="dark"] .analysis strong {
    color: #fbbf24;
}

[data-theme="dark"] .analysis-content {
    color: #d4a574;
}

[data-theme="dark"] .fill-input {
    background: #252540;
    border-color: #3a3a5e;
    color: #e8e8e8;
}

[data-theme="dark"] .fill-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .fill-input:disabled {
    background: #1e1e32;
    color: #808080;
}

/* 嵌入模式下的深色主题 */
[data-theme="dark"] .question-in-content .question-item {
    background: linear-gradient(135deg, #1e1e35 0%, #252545 100%);
    border-left-color: #667eea;
}

[data-theme="dark"] .question-in-content .question-item:hover {
    border-left-color: #818cf8;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
}

[data-theme="dark"] .questions-error {
    background: linear-gradient(135deg, #3a1515 0%, #451a1a 100%);
    border-color: #7f1d1d;
}

[data-theme="dark"] .error-content h4 {
    color: #fca5a5;
}

[data-theme="dark"] .error-content p {
    color: #d4a5a5;
}

[data-theme="dark"] .error-content summary {
    color: #f87171;
    background: #2a1a1a;
}

[data-theme="dark"] .error-content summary:hover {
    background: #3a2020;
}

[data-theme="dark"] .error-content pre {
    background: #1a1010;
    border-color: #5a2a2a;
    color: #d4d4d4;
}
