/* styles/animations.css */

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

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #ff6b6b;
    border-radius: 2px;
}

.confetti:nth-child(2n) { background: #4ecdc4; }
.confetti:nth-child(3n) { background: #45b7d1; }
.confetti:nth-child(4n) { background: #f9ca24; }
.confetti:nth-child(5n) { background: #6c5ce7; }
.confetti:nth-child(6n) { background: #a29bfe; }
.confetti:nth-child(7n) { background: #fd79a8; }
.confetti:nth-child(8n) { background: #00b894; }

.confetti-piece {
    animation: explode 3s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) rotate(var(--r));
        opacity: 0;
    }
}

/* Flashcard Stack Container */
.flashcard-stack {
    position: relative;
    width: 100%;
    height: 300px;
    margin: 0 auto;
}

.flashcard-stack .flip-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    perspective: 1000px;
    width: 100%;
    height: 300px;
    margin: 0 auto;
    user-select: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.1s ease-out;
}

/* Next card is slightly behind and smaller */
#nextFlashcard, #nextSentenceCard {
    transform: scale(0.95) translateY(8px);
    z-index: 1;
    opacity: 0.8;
}

/* Current card is on top */
#flashcard, #sentenceCard {
    z-index: 2;
}

.flip-card {
    perspective: 1000px;
    width: 100%;
    height: 300px;
    margin: 0 auto;
    position: relative;
    user-select: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.1s ease-out;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    cursor: pointer;
}

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

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    pointer-events: auto;
}

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

.flip-card-back {
    background: white;
    color: #333;
    transform: rotateY(180deg);
    border: 1px solid #e2e8f0;
}

.swipe-hint {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}

/* CRITICAL: Drag Feedback - Must not interfere with clicks */
.drag-feedback {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none !important;
    backdrop-filter: blur(10px);
    user-select: none;
}

.drag-feedback.show {
    opacity: 1;
}

.drag-feedback.left {
    left: 20px;
    color: #f59e0b;
}

.drag-feedback.right {
    right: 20px;
    color: #10b981;
}

/* Card stack effect */
.flip-card::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    background: rgba(0,0,0,0.03);
    border-radius: 16px;
    z-index: -1;
}

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

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.pulse {
    animation: pulse 2s infinite;
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

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