/**
 * Quiz Feature Styles
 * 考一考功能样式
 * 适配7-12岁儿童的视觉设计
 * 与主页风格保持一致
 */

/* ===== Variables - 与主页style.css保持一致 ===== */
:root {
    --quiz-primary: #2c5aa0;
    --quiz-primary-hover: #1e4080;
    --quiz-success: #28a745;
    --quiz-error: #EF4444;
    --quiz-warning: #F59E0B;
    --quiz-info: #3B82F6;
    --quiz-bg: #f8f9fa;
    --quiz-card-bg: #FFFFFF;
    --quiz-text: #333;
    --quiz-text-light: #666;
    --quiz-border: #e5e7eb;
    --quiz-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --quiz-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ===== Global Styles ===== */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--quiz-bg);
    min-height: 100vh;
}

.quiz-header {
    background: linear-gradient(135deg, var(--quiz-primary) 0%, #667eea 100%);
    color: white;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 24px;
    box-shadow: var(--quiz-shadow-lg);
}

.quiz-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.quiz-header-top h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.quiz-back-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    box-shadow: none !important;
}

.quiz-back-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

.quiz-header h1 {
    margin: 0 0 16px 0;
    font-size: 28px;
    font-weight: 700;
}

.user-stats {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    font-size: 16px;
}

.user-stats span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.user-stats strong {
    font-weight: 700;
    font-size: 18px;
}

/* ===== Section Styles ===== */
section {
    background: var(--quiz-card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--quiz-shadow);
}

section h2 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: var(--quiz-text);
    font-weight: 600;
}

/* ===== Museum Grid ===== */
.museum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}

.museum-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--quiz-shadow);
}

.museum-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--quiz-shadow-lg);
}

.museum-card .museum-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 12px;
}

.museum-card .museum-progress {
    font-size: 14px;
    opacity: 0.9;
}

.museum-card .stars {
    margin-top: 8px;
    font-size: 16px;
}

.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--quiz-text-light);
    font-size: 16px;
}

/* ===== Action Buttons ===== */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.action-btn {
    background: linear-gradient(135deg, var(--quiz-primary) 0%, var(--quiz-primary-hover) 100%);
    color: white;
    border: none;
    padding: 24px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--quiz-shadow);
    text-align: center;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--quiz-shadow-lg);
}

.action-btn .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.action-btn .text {
    font-size: 18px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.action-btn .subtitle {
    font-size: 14px;
    opacity: 0.9;
    display: block;
}

.action-btn.daily-challenge {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
}

.action-btn.random-quiz {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.action-btn.wrong-questions {
    background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background: var(--quiz-bg);
    border-radius: 12px;
}

.stat-label {
    display: block;
    color: var(--quiz-text-light);
    font-size: 14px;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    color: var(--quiz-primary);
    font-size: 28px;
    font-weight: 700;
}

/* ===== Footer ===== */
.quiz-footer {
    text-align: center;
    padding: 20px;
}

.quiz-footer button {
    background: var(--quiz-card-bg);
    color: var(--quiz-text);
    border: 2px solid var(--quiz-border);
    padding: 12px 32px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-footer button:hover {
    background: var(--quiz-bg);
    border-color: var(--quiz-primary);
    color: var(--quiz-primary);
}

/* ===== Quiz Session Styles ===== */
.quiz-session-body {
    background: var(--quiz-bg);
    margin: 0;
    padding: 0;
}

.session-container {
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
}

.session-header {
    background: linear-gradient(135deg, var(--quiz-primary) 0%, #667eea 100%);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--quiz-shadow-lg);
}

.session-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.session-header-top .museum-name {
    flex: 1;
    text-align: center;
    margin-bottom: 0;
}

.museum-name {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.question-progress {
    font-size: 16px;
    margin-bottom: 12px;
}

.session-stats {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 14px;
}

.session-stats span {
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
}

/* ===== Question Container ===== */
.question-container {
    background: var(--quiz-card-bg);
    margin: 20px;
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--quiz-shadow-lg);
}

.question-image {
    margin-bottom: 24px;
    border-radius: 12px;
    overflow: hidden;
}

.question-image img {
    width: 100%;
    height: auto;
    display: block;
}

.question-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--quiz-text);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ===== Options ===== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.option-button {
    background: var(--quiz-bg);
    border: 2px solid var(--quiz-border);
    padding: 16px 20px;
    border-radius: 12px;
    font-size: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.option-button:hover {
    background: #EEF2FF;
    border-color: var(--quiz-primary);
}

.option-button.selected {
    background: #EEF2FF;
    border-color: var(--quiz-primary);
    border-width: 3px;
}

.option-button.correct {
    background: #D1FAE5;
    border-color: var(--quiz-success);
}

.option-button.wrong {
    background: #FEE2E2;
    border-color: var(--quiz-error);
}

/* ===== Question Actions ===== */
.question-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--quiz-primary-hover);
}

.btn-primary:disabled {
    background: var(--quiz-text-light);
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-secondary {
    background: var(--quiz-card-bg);
    color: var(--quiz-text);
    border: 2px solid var(--quiz-border);
}

.btn-secondary:hover {
    background: var(--quiz-bg);
}

/* ===== Feedback Container ===== */
.feedback-container {
    background: var(--quiz-card-bg);
    margin: 20px;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: var(--quiz-shadow-lg);
    text-align: center;
}

.feedback-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.feedback-icon.correct {
    animation: bounce 0.5s ease;
}

.feedback-icon.wrong {
    animation: shake 0.5s ease;
}

.feedback-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.feedback-points {
    font-size: 24px;
    color: var(--quiz-success);
    font-weight: 600;
    margin-bottom: 12px;
}

.feedback-streak {
    font-size: 18px;
    color: var(--quiz-warning);
    margin-bottom: 20px;
}

.feedback-correct-answer {
    font-size: 18px;
    color: var(--quiz-error);
    margin-bottom: 20px;
    font-weight: 600;
}

.feedback-explanation {
    background: var(--quiz-bg);
    padding: 20px;
    border-radius: 12px;
    text-align: left;
    margin-bottom: 24px;
}

.feedback-explanation strong {
    display: block;
    margin-bottom: 8px;
    color: var(--quiz-primary);
}

.feedback-explanation p {
    line-height: 1.6;
    color: var(--quiz-text);
    margin: 8px 0;
}

.added-to-wrong {
    font-size: 14px;
    color: var(--quiz-text-light);
    font-style: italic;
}

/* ===== Animations ===== */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

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

.animate-bounce {
    animation: bounce 0.5s ease;
}

.animate-shake {
    animation: shake 0.5s ease;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .quiz-container,
    .session-container {
        padding: 12px;
    }
    
    .quiz-header {
        padding: 20px 16px;
    }
    
    .quiz-header h1 {
        font-size: 24px;
    }
    
    section {
        padding: 20px 16px;
    }
    
    .museum-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .question-container,
    .feedback-container {
        margin: 12px;
        padding: 20px 16px;
    }
    
    .question-text {
        font-size: 18px;
    }
    
    .option-button {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .feedback-icon {
        font-size: 48px;
    }
    
    .feedback-title {
        font-size: 24px;
    }
}

/* ===== Quiz Notification ===== */
.quiz-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    background: white;
    box-shadow: var(--quiz-shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.quiz-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.quiz-notification.success {
    border-left: 4px solid var(--quiz-success);
}

.quiz-notification.error {
    border-left: 4px solid var(--quiz-error);
}

.quiz-notification.warning {
    border-left: 4px solid var(--quiz-warning);
}

.quiz-notification.info {
    border-left: 4px solid var(--quiz-info);
}

/* ===== Loading Spinner ===== */
.quiz-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-message {
    color: white;
    margin-top: 16px;
    font-size: 16px;
}

/* ===== Progress Bar ===== */
.progress-bar {
    background: var(--quiz-bg);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    height: 32px;
}

.progress-fill {
    background: linear-gradient(90deg, var(--quiz-primary) 0%, #667eea 100%);
    height: 100%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 14px;
    color: var(--quiz-text);
}

/* ===== Modal ===== */
.quiz-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.quiz-modal.show {
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    box-shadow: var(--quiz-shadow-lg);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--quiz-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--quiz-text-light);
    line-height: 1;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--quiz-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn.primary {
    background: var(--quiz-primary);
    color: white;
}

.modal-btn.secondary {
    background: var(--quiz-bg);
    color: var(--quiz-text);
}
