/* Custom animations and styles */

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

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

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

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

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

.module-card {
    animation: fadeIn 0.5s ease-out;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.success {
    background: #22C55E;
    color: white;
}

.toast.error {
    background: #EF4444;
    color: white;
}

.toast.hint {
    background: #818CF8;
    color: white;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

.star-animation {
    display: inline-block;
    animation: bounce 0.6s ease-in-out;
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #FFD700;
    top: -10px;
    animation: confetti 3s linear forwards;
    z-index: 9999;
}

.flashcard {
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 200px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
}

.flashcard-front {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.flashcard-back {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    transform: rotateY(180deg);
}

.input-answer {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    padding: 16px;
    border: 3px solid #38BDF8;
    border-radius: 12px;
    transition: all 0.3s;
}

.input-answer:focus {
    outline: none;
    border-color: #0EA5E9;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.2);
}

.input-answer.correct {
    border-color: #22C55E;
    background: #F0FDF4;
}

.input-answer.incorrect {
    border-color: #EF4444;
    background: #FEF2F2;
    animation: shake 0.5s;
}

.btn-primary {
    background: #38BDF8;
    color: white;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    background: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: #818CF8;
    color: white;
    font-weight: 700;
    padding: 12px 24px;
    border-radius: 12px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #6366F1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(129, 140, 248, 0.4);
}

.feedback-box {
    border-radius: 12px;
    padding: 16px;
    margin-top: 16px;
    animation: fadeIn 0.3s ease-out;
}

.feedback-box.success {
    background: #F0FDF4;
    border: 2px solid #22C55E;
    color: #166534;
}

.feedback-box.error {
    background: #FEF2F2;
    border: 2px solid #EF4444;
    color: #991B1B;
}

.feedback-box.hint {
    background: #EEF2FF;
    border: 2px solid #818CF8;
    color: #3730A3;
}

/* Loading spinner */
.spinner {
    border: 3px solid #E0F2FE;
    border-top: 3px solid #38BDF8;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* Progress bar animation */
.progress-bar {
    transition: width 0.5s ease-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        font-size: 14px;
    }
    
    .modal-content {
        width: 95%;
        padding: 16px;
    }
    
    .input-answer {
        font-size: 20px;
    }
}
