/**
 * Quiz Grade Display Styles - Alternative Design 5: Transparent Compact Badge
 * For Young Students (ages 9-12)
 * 
 * Design Concept: Transparent Container with Colorful Medal
 * - Transparent badge container
 * - Gradient background on the medal itself
 * - Vertical attempt indicators on the right
 * - Fits in ~200x105px box
 * - Based on alt4 but inverted color scheme
 */

/* === SHARED/COMMON STYLES === */

/* Loading state */
.quiz-grade-badge.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    /* background: rgba(248, 249, 250, 0.95);
    border-radius: 16px; */
    color: #718096;
    height: 100%;
}

.loading-spinner {
    font-size: 24px;
    animation: spin 2s linear infinite;
}

.loading-text {
    font-size: 13px;
    display: none;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error state */
.quiz-grade-badge.error {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    /* background: rgba(255, 245, 245, 0.95);
    border: 2px solid #fc8181;
    border-radius: 16px; */
    color: #c53030;
    height: 100%;
}

.error-icon {
    font-size: 24px;
}

.error-text {
    font-size: 12px;
    display: none;
}

/* === MAIN TRANSPARENT BADGE DESIGN === */

/* Transparent badge container - grid layout */
.quiz-grade-badge {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 12px;
    background: transparent;
    /* border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
    position: relative;
    overflow: visible;
    /* max-width: 200px;
    min-height: 105px; */
}

.quiz-grade-badge.quiz-badge-start {
    height: calc(100% - 24px);
}

/* Main colorful medal container - left side with gradient */
.quiz-badge-medal {
    position: relative;
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    z-index: 1;
    animation: float-badge 3s ease-in-out infinite;
    /* align-self: center; */
    align-self: start;
}

@keyframes float-badge {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-4px); }
}

/* Badge ribbon (top decoration) - gold */
.quiz-badge-medal::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 16px;
    background: linear-gradient(135deg, #3191ff 0%, #6eff4e 100%);
    clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
    z-index: -1;
}

/* Medal icon/emoji - white for contrast */
.quiz-badge-medal .quiz-icon-emoji {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 2px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Medal score text - white on gradient */
.quiz-badge-score {
    font-size: 22px;
    font-weight: 800;
    color: white;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.quiz-badge-score .score-unit {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-right: -8px;
}

/* Medal gradient colors by level - optimized for young students */
.quiz-badge-excellent .quiz-badge-medal {
    /* 90-100%: Rich Gold (like first place, trophy, winner!) */
    background: linear-gradient(135deg, #d4af37 0%, #f9d56e 50%, #d4af37 100%);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.6);
}

/* Dark text for gold medal (better contrast) */
.quiz-badge-excellent .quiz-badge-medal .quiz-icon-emoji {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.quiz-badge-excellent .quiz-badge-score {
    color: #6b4423; /* Rich bronze/chocolate brown */
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.quiz-badge-excellent .quiz-badge-score .score-unit {
    color: #8b5a2b; /* Lighter brown */
    margin-right: -6px;
}

.quiz-badge-good .quiz-badge-medal {
    /* 75-89%: Blue/Cyan (positive, calm, achievement) */
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 6px 16px rgba(79, 172, 254, 0.5);
}

.quiz-badge-pass .quiz-badge-medal {
    /* 60-74%: Green (success, go, pass!) */
    /* background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    box-shadow: 0 6px 16px rgba(67, 233, 123, 0.5); */
    /* 60-74%: Pink/Rose (achievement, sweet success!) */
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 6px 16px rgba(240, 147, 251, 0.5);
}

.quiz-badge-fail .quiz-badge-medal {
    /* Below pass grade: Orange/Amber (warning, try again - not harsh red) */
    background: linear-gradient(135deg, #ff9a56 0%, #ffba5a 100%);
    box-shadow: 0 6px 16px rgba(255, 154, 86, 0.5);
}

.quiz-badge-start .quiz-badge-medal {
    /* Not started yet: Purple (curiosity, excitement, ready to begin!) */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

/* Right side content container */
.quiz-right-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    z-index: 1;
}

/* Status badge (ผ่าน/ไม่ผ่าน) - compact */
.quiz-status-tag {
    /* padding: 3px 8px;
    border-radius: 8px;
    font-size: 10px; */
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    align-self: center;

    position: absolute;
    top: 4px;
}

.quiz-status-tag + .quiz-attempts-vertical {
    margin-top: 16px;
}

/* .quiz-status-passed {
    background: #48bb78;
    color: white;
    box-shadow: 0 2px 6px rgba(72, 187, 120, 0.4);
}

.quiz-status-failed {
    background: #f56565;
    color: white;
    box-shadow: 0 2px 6px rgba(245, 101, 101, 0.4);
} */

/* === MOTIVATIONAL DISPLAY (No Score Yet) === */

/* Centered motivational display for not-started or in-progress states */
.quiz-motivate-display {
    grid-column: 1 / -1; /* Span full width */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    min-width: 68px;
}

.quiz-motivate-icon {
    font-size: 48px;
    line-height: 1;
    /* animation: bounce-motivate 2s ease-in-out infinite; */
}

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

.quiz-motivate-message {
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    text-align: center;
    line-height: 1.3;
}

/* === VERTICAL ATTEMPT INDICATORS === */

/* Container for vertical attempts */
.quiz-attempts-vertical {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

/* Option 1: Compact stickers (vertical) */
.quiz-sticker-vertical {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.quiz-sticker-vertical:hover {
    transform: scale(1.1);
}

/* Sticker states */
.sticker-empty {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.5);
}

.sticker-progress {
    animation: pulse-sticker 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.6);
}

@keyframes pulse-sticker {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 5px rgba(255, 215, 0, 0.4);
    }
}

.sticker-passed {
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.5);
    background: rgba(72, 187, 120, 0.1);
}

.sticker-failed {
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.5);
    background: rgba(245, 101, 101, 0.1);
}

/* Option 2: Simple dots (vertical) - alternative to stickers */
.quiz-dots-vertical {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.quiz-dot-vertical {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Empty: Simple bigger empty dot */
.dot-empty {
    background: rgba(0, 0, 0, 0.1);
    opacity: 0.4;
    border: 2px solid rgba(0, 0, 0, 0.15);
}

/* In Progress: Growing blue dot */
.dot-progress {
    background: #4facfe;
    animation: pulse-dot-grow 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.3);
    border: 2px solid #4facfe;
    opacity: 0.55;
}

@keyframes pulse-dot-grow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.3);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 0 5px rgba(79, 172, 254, 0.2);
    }
}

/* Passed: Checkmark in green circle */
.dot-passed {
    background: #48bb78;
    border: 2px solid #48bb78;
    box-shadow: 0 2px 6px rgba(72, 187, 120, 0.4);
    opacity: 0.7;
}

.dot-passed::after {
    content: '✓';
    color: white;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* Failed: X-mark in red circle */
.dot-failed {
    background: #f56565;
    border: 2px solid #f56565;
    box-shadow: 0 2px 6px rgba(245, 101, 101, 0.4);
    opacity: 0.7;
}

.dot-failed::after {
    content: '✗';
    color: white;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

/* Best attempt: Full opacity with enhanced glow */
.dot-best {
    opacity: 1 !important;
}

.dot-best.dot-passed {
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.6), 0 0 12px rgba(72, 187, 120, 0.4);
}

.dot-best.dot-failed {
    box-shadow: 0 2px 8px rgba(245, 101, 101, 0.6), 0 0 12px rgba(245, 101, 101, 0.4);
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .quiz-grade-badge {
        max-width: 100%;
        padding: 10px;
        gap: 8px;
    }
    
    .quiz-badge-medal {
        width: 65px;
        height: 65px;
    }
    
    .quiz-badge-medal .quiz-icon-emoji {
        font-size: 28px;
    }
    
    .quiz-badge-score {
        font-size: 14px;
    }
    
    .quiz-sticker-vertical {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .quiz-dot-vertical {
        width: 14px;
        height: 14px;
    }
    
    .dot-passed::after,
    .dot-failed::after {
        font-size: 9px;
    }
}

