/* Enhanced Quiz System and Gamification Styles */

/* Quiz Container Enhancements */
.quiz-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin: 30px 0;
    color: white;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
}

.quiz-header {
    text-align: center;
    margin-bottom: 25px;
}

.quiz-header h3 {
    margin: 0 0 15px 0;
    font-size: 1.8em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Progress Display */
.quiz-progress {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px;
    margin: 15px 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-weight: bold;
}

.xp-progress {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    overflow: hidden;
}

.xp-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #45a049);
    border-radius: 6px;
    transition: width 1s ease;
    position: relative;
}

.xp-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

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

/* Enhanced Question Styling */
.enhanced-question {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.enhanced-question p {
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Quiz Options */
.quiz-option {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid transparent;
    color: white;
    padding: 15px 20px;
    margin: 10px 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1em;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.quiz-option:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateX(5px);
}

.quiz-option:active {
    transform: scale(0.98);
}

.quiz-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.quiz-option:hover::before {
    left: 100%;
}

/* Feedback Styling */
.quiz-feedback {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    animation: slideIn 0.5s ease;
}

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

.feedback-correct {
    background: linear-gradient(135deg, #4caf50, #45a049);
    border-left: 5px solid #2e7d32;
}

.feedback-incorrect {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-left: 5px solid #ef6c00;
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: bold;
    font-size: 1.2em;
}

.feedback-icon {
    font-size: 1.5em;
}

.xp-gain {
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    margin-left: auto;
}

.feedback-explanation {
    margin: 10px 0;
    line-height: 1.6;
    font-size: 1.05em;
}

.streak-bonus {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
    animation: pulse 1s ease;
}

.learning-tip {
    background: rgba(255, 255, 255, 0.2);
    padding: 10px 15px;
    border-radius: 10px;
    margin-top: 10px;
    font-style: italic;
}

/* Quiz Results */
.quiz-results-enhanced {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 25px;
    margin: 25px 0;
    text-align: center;
}

.score-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid;
    position: relative;
    animation: scoreReveal 1s ease;
}

@keyframes scoreReveal {
    from {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.score-circle.grade-a {
    border-color: #4caf50;
    background: linear-gradient(135deg, #4caf50, #45a049);
}

.score-circle.grade-b {
    border-color: #2196f3;
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.score-circle.grade-c {
    border-color: #ff9800;
    background: linear-gradient(135deg, #ff9800, #f57c00);
}

.score-circle.grade-d {
    border-color: #f44336;
    background: linear-gradient(135deg, #f44336, #d32f2f);
}

.score-percentage {
    font-size: 2em;
    font-weight: bold;
    line-height: 1;
}

.score-fraction {
    font-size: 0.9em;
    opacity: 0.9;
}

.score-details {
    text-align: left;
}

.grade {
    font-size: 3em;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 5px;
}

.grade.grade-a { color: #4caf50; }
.grade.grade-b { color: #2196f3; }
.grade.grade-c { color: #ff9800; }
.grade.grade-d { color: #f44336; }

.score-message {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.best-streak {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
}

/* Floating XP Animation */
.floating-xp {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.5em;
    z-index: 10000;
    animation: floatUp 2s ease forwards;
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.4);
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -200px) scale(1);
    }
}

/* Level Up Modal */
.level-up-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: modalFadeIn 0.5s ease;
}

.level-up-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: levelUpBounce 0.8s ease;
}

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

@keyframes levelUpBounce {
    0% {
        transform: scale(0.3) rotate(-10deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.1) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.level-up-animation {
    font-size: 4em;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
}

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

.level-up-content h2 {
    font-size: 2.5em;
    margin: 20px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.new-level {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
}

.level-up-content button {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2em;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.3s ease;
}

.level-up-content button:hover {
    transform: scale(1.05);
}

/* Badge System */
.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    padding: 10px 20px;
    border-radius: 25px;
    margin: 5px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    transition: transform 0.3s ease;
}

.achievement-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.achievement-badge.earned {
    animation: badgeEarn 0.8s ease;
}

@keyframes badgeEarn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.badge-icon {
    font-size: 1.2em;
}

/* Badge Unlock Modal */
.badge-unlock-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: modalFadeIn 0.5s ease;
}

.badge-unlock-content {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 350px;
    animation: badgeUnlockBounce 1s ease;
}

@keyframes badgeUnlockBounce {
    0% {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.1) rotate(-10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.badge-unlock-content .badge-icon {
    font-size: 4em;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.badge-unlock-content h3 {
    font-size: 2em;
    margin: 20px 0;
}

.badge-unlock-content button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 1.2em;
    cursor: pointer;
    margin-top: 20px;
    transition: transform 0.3s ease;
}

.badge-unlock-content button:hover {
    transform: scale(1.05);
}

/* Quiz Actions */
.quiz-actions {
    text-align: center;
    margin-top: 25px;
}

.reset-quiz-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1em;
}

.reset-quiz-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-container {
        padding: 20px;
        margin: 20px 0;
    }
    
    .score-display {
        flex-direction: column;
        gap: 20px;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-percentage {
        font-size: 1.5em;
    }
    
    .grade {
        font-size: 2em;
    }
    
    .level-up-content,
    .badge-unlock-content {
        margin: 20px;
        padding: 30px;
    }
}

/* Pulse Animation for Important Elements */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }
    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}