/* Custom styles for QuizZl Platform */
/* Using Bootstrap dark theme as base, minimal custom overrides */

/* Enhanced Animations and Effects */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -100%, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 100%, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(1.5);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 15px var(--bs-primary);
    }
    50% {
        box-shadow: 0 0 25px var(--bs-primary), 0 0 35px var(--bs-primary);
    }
}

@keyframes particle-float {
    0% {
        transform: translateY(0px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(180deg);
        opacity: 0;
    }
}

/* Custom game-specific styles */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* Particle System */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--bs-primary);
    border-radius: 50%;
    animation: particle-float linear infinite;
    opacity: 0.6;
}

/* Enhanced Question Card */
.question-enter {
    animation: slideInDown 0.8s ease-out;
}

.options-enter {
    animation: slideInUp 0.6s ease-out 0.2s both;
}

.question-card {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    background-color: var(--bs-body-bg);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.question-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--bs-primary), var(--bs-info), var(--bs-success));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.question-card.active::before {
    opacity: 0.3;
}

.question-text {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    animation: fadeInScale 0.6s ease-out;
}

.answer-option {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.answer-option::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: width 0.6s ease, height 0.6s ease;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.answer-option:hover {
    background-color: var(--bs-secondary-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.answer-option.ripple::before {
    width: 300px;
    height: 300px;
    animation: ripple 0.6s ease-out;
}

.answer-option.selected {
    background-color: var(--bs-primary);
    color: var(--bs-white);
    transform: translateY(-2px);
    animation: glow 2s infinite;
}

.answer-option.correct {
    background-color: var(--bs-success);
    color: var(--bs-white);
    animation: glow 1s ease-out;
}

.answer-option.incorrect {
    background-color: var(--bs-danger);
    color: var(--bs-white);
    animation: shake 0.5s ease-out;
}

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

.answer-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    border-radius: 8px !important;
}

.answer-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    color: #ffffff !important;
    font-weight: bold !important;
}

.answer-button:active {
    transform: translateY(0);
}

.answer-button.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary), var(--bs-info));
    border: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    color: #ffffff !important;
    font-weight: bold !important;
}

/* Locked Answer States */
.answer-locked-unselected {
    opacity: 0.4 !important;
    filter: grayscale(70%) !important;
    transform: none !important;
    box-shadow: none !important;
    background-color: var(--bs-secondary) !important;
    color: var(--bs-secondary-color) !important;
    cursor: not-allowed !important;
    transition: all 0.3s ease !important;
}

.answer-locked-selected {
    opacity: 0.9 !important;
    cursor: not-allowed !important;
    box-shadow: 0 0 15px rgba(var(--bs-primary-rgb), 0.5) !important;
    animation: lockedPulse 2s infinite !important;
}

@keyframes lockedPulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(var(--bs-primary-rgb), 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(var(--bs-primary-rgb), 0.8);
    }
}

.timer-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bs-warning);
    position: relative;
}

.timer-display.warning {
    color: var(--bs-danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Circular Timer */
.circular-timer {
    width: 80px;
    height: 80px;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.circular-timer svg {
    position: absolute;
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.circular-timer .timer-circle {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
}

.circular-timer .timer-background {
    stroke: rgba(255, 255, 255, 0.1);
}

.circular-timer .timer-progress {
    stroke: var(--bs-warning);
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.circular-timer .timer-progress.warning {
    stroke: var(--bs-danger);
    animation: pulse-stroke 0.5s infinite;
}

.circular-timer .timer-text {
    position: relative;
    font-size: 1rem;
    font-weight: bold;
    color: var(--bs-body-color);
    z-index: 2;
}

@keyframes pulse-stroke {
    0%, 100% { stroke-width: 4; }
    50% { stroke-width: 6; }
}

/* Time Attack Timer */
.time-attack-timer {
    background: linear-gradient(45deg, var(--bs-warning), var(--bs-danger));
    border-radius: 10px;
    padding: 10px 20px;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: glow 2s infinite;
}

.time-attack-timer.critical {
    animation: pulse 0.5s infinite, glow 2s infinite;
    background: linear-gradient(45deg, var(--bs-danger), #ff1744);
}

/* Score display */
.score-display {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--bs-info);
    position: relative;
    transition: all 0.3s ease;
}

.score-display.updated {
    transform: scale(1.2);
    color: var(--bs-success);
    text-shadow: 0 0 10px var(--bs-success);
}

/* Floating score animation */
.floating-score {
    position: absolute;
    top: 50%;
    left: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--bs-success);
    pointer-events: none;
    z-index: 1000;
    animation: scoreFloat 2s ease-out forwards;
}

.floating-score.bonus {
    color: var(--bs-warning);
    font-size: 2rem;
    text-shadow: 0 0 15px var(--bs-warning);
}

/* Achievement System */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--bs-warning), var(--bs-success));
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    transform: translateX(100%);
    animation: slideInRight 0.5s ease-out forwards, slideOutRight 0.5s ease-in 3s forwards;
    max-width: 300px;
}

.achievement-notification .achievement-icon {
    font-size: 2rem;
    margin-right: 10px;
    animation: bounce 1s infinite;
}

.achievement-notification .achievement-title {
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.achievement-notification .achievement-desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(100%);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Achievement Badges */
.achievement-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--bs-warning), var(--bs-success));
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: badgeGlow 2s infinite;
}

.achievement-badge.new {
    animation: badgeUnlock 1s ease-out, badgeGlow 2s infinite 1s;
}

.achievement-badge.streak {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.achievement-badge.perfect {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.achievement-badge.speed {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.achievement-badge.master {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

@keyframes badgeGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 2px 15px rgba(255, 255, 255, 0.4);
    }
}

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

/* Confetti System */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1500;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--bs-primary);
    animation: confettiFall linear infinite;
}

.confetti:nth-child(odd) {
    background: var(--bs-success);
    border-radius: 50%;
}

.confetti:nth-child(even) {
    background: var(--bs-warning);
    transform: rotate(45deg);
}

.confetti:nth-child(3n) {
    background: var(--bs-info);
    border-radius: 2px;
}

.confetti:nth-child(4n) {
    background: var(--bs-danger);
    width: 15px;
    height: 4px;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Victory Celebration Effects */
.victory-overlay {
    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: 2000;
    opacity: 0;
    animation: victoryFadeIn 0.5s ease-out forwards;
}

.victory-content {
    text-align: center;
    color: white;
    transform: scale(0.8);
    animation: victoryScale 0.8s ease-out 0.2s forwards;
}

.victory-title {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 20px;
    animation: victoryGlow 2s infinite;
}

.victory-score {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--bs-warning);
}

.victory-achievements {
    margin-bottom: 30px;
}

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

@keyframes victoryScale {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

@keyframes victoryGlow {
    0%, 100% {
        text-shadow: 0 0 20px var(--bs-success);
    }
    50% {
        text-shadow: 0 0 30px var(--bs-success), 0 0 40px var(--bs-warning);
    }
}

/* Screen Shake Effect */
.screen-shake {
    animation: screenShake 0.5s ease-in-out;
}

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

/* Progress Bars with Animation */
.animated-progress {
    background: linear-gradient(90deg, var(--bs-primary), var(--bs-info));
    background-size: 200% 100%;
    animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Score Display for Results */
.final-score-display {
    font-size: 4rem;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    position: relative;
    animation: scoreReveal 1s ease-out;
}

.final-score-display::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, var(--bs-primary), var(--bs-success), var(--bs-warning), var(--bs-info));
    background-size: 400% 400%;
    border-radius: 15px;
    z-index: -1;
    animation: gradientShift 3s infinite;
}

@keyframes scoreReveal {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Streak Counter Enhancement */
.streak-display {
    display: inline-block;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    font-weight: bold;
    animation: streakPulse 1s infinite;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.streak-display.high-streak {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    animation: streakBlaze 0.5s infinite;
}

@keyframes streakPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes streakBlaze {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.6);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 215, 0, 0.6);
    }
}

/* Loading spinner override */
.spinner-border {
    color: var(--bs-primary);
}

/* Analytics charts */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 2rem;
}

/* Upload area styling */
.upload-area {
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}

/* Game mode cards */
.game-mode-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--bs-border-color);
}

.game-mode-card:hover {
    border-color: var(--bs-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.game-mode-card.selected {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}

/* Avatar styling */
.avatar-container {
    position: relative;
    display: inline-block;
}

.avatar-container:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

.avatar-icon {
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.avatar-icon:hover {
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.avatar-option {
    transition: all 0.2s ease;
}

.avatar-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.avatar-option.active {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-container {
        padding: 0 1rem;
    }
    
    .timer-display {
        font-size: 1.2rem;
    }
}