/* 性教育知识测评系统样式 */

#sexedu-quiz-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.quiz-screen {
    display: none;
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease;
}

.quiz-screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 年龄选择页面 */
.quiz-header {
    text-center;
    margin-bottom: 40px;
}

.quiz-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.quiz-header h1 {
    font-size: 32px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 10px;
}

.quiz-header p {
    color: #6b7280;
    font-size: 16px;
}

.age-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.age-btn {
    padding: 30px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.age-btn:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2);
    transform: translateY(-4px);
}

.age-emoji {
    font-size: 48px;
    margin-bottom: 12px;
}

.age-label {
    font-size: 18px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 4px;
}

.age-desc {
    font-size: 14px;
    color: #9ca3af;
}

/* 测试进行中 */
.quiz-progress {
    margin-bottom: 30px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.progress-info span {
    font-size: 14px;
    color: #6b7280;
}

.question-type {
    background: #dbeafe;
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.question-text {
    font-size: 22px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 24px;
    line-height: 1.4;
}

.options-container {
    margin-bottom: 24px;
}

.option-btn {
    width: 100%;
    padding: 16px 20px;
    margin-bottom: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    font-size: 16px;
    color: #1f2937;
}

.option-btn:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.option-btn.selected {
    border-color: #3b82f6;
    background: #dbeafe;
}

.option-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 4px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.option-btn.selected .option-checkbox {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.next-btn {
    width: 100%;
    padding: 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.next-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.next-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* 结果页面 */
.result-header {
    text-center;
    margin-bottom: 40px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.result-header h2 {
    font-size: 28px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 12px;
}

.result-score {
    font-size: 48px;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 12px;
}

.result-message {
    font-size: 16px;
    color: #6b7280;
}

.wrong-questions {
    margin-bottom: 24px;
}

.wrong-question-item {
    border: 2px solid #fee2e2;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    background: #fef2f2;
}

.wrong-question-title {
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 16px;
    font-size: 16px;
}

.answer-section {
    margin-bottom: 12px;
}

.answer-label {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 4px;
}

.user-answer {
    color: #dc2626;
}

.correct-answer {
    color: #16a34a;
    font-weight: bold;
}

.explanation-box {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.explanation-title {
    font-size: 14px;
    font-weight: bold;
    color: #1e40af;
    margin-bottom: 6px;
}

.explanation-content {
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.knowledge-box {
    background: #f3e8ff;
    border-left: 4px solid #8b5cf6;
    padding: 16px;
    border-radius: 8px;
}

.knowledge-title {
    font-size: 14px;
    font-weight: bold;
    color: #6b21a8;
    margin-bottom: 6px;
}

.knowledge-content {
    color: #374151;
    font-size: 14px;
    line-height: 1.6;
}

.chat-btn {
    width: 100%;
    padding: 16px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 12px;
}

.chat-btn:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(139, 92, 246, 0.3);
}

.restart-btn {
    width: 100%;
    padding: 16px;
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.restart-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* AI 对话 */
.chat-header {
    text-align: center;
    margin-bottom: 24px;
}

.chat-header h2 {
    font-size: 24px;
    font-weight: bold;
    color: #1f2937;
    margin-bottom: 8px;
}

.chat-header p {
    color: #6b7280;
    font-size: 14px;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 20px;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
}

.chat-message.user .message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.chat-input-area {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    resize: none;
    font-family: inherit;
    transition: border-color 0.3s;
}

#chat-input:focus {
    outline: none;
    border-color: #8b5cf6;
}

.chat-send-btn {
    padding: 12px 24px;
    background: #8b5cf6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-send-btn:hover:not(:disabled) {
    background: #7c3aed;
    transform: translateY(-2px);
}

.chat-send-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

.back-btn {
    width: 100%;
    padding: 12px;
    background: white;
    color: #6b7280;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #sexedu-quiz-container {
        padding: 10px;
        margin: 20px auto;
    }
    
    .quiz-screen {
        padding: 24px;
    }
    
    .age-buttons {
        grid-template-columns: 1fr;
    }
    
    .quiz-header h1 {
        font-size: 24px;
    }
    
    .question-text {
        font-size: 18px;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}