/* ========================================
   Animations - Bangladesh Route Master
   ======================================== */

/* Notification Animations */
.notification-container {
    position: fixed;
    top: 80px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 1001;
    pointer-events: none;
}

.notification {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    animation: slide-in 0.3s ease, fade-out 0.3s ease 2.7s forwards;
    pointer-events: auto;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--error);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

.notification.info {
    border-left: 4px solid var(--info);
}

.notification-icon {
    font-size: 1.25rem;
}

.notification-message {
    font-weight: 500;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1002;
}

.achievement-popup:not(.hidden) {
    animation: achievement-in 0.5s ease, achievement-out 0.5s ease 2.5s forwards;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: var(--radius-full);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.4);
    color: white;
}

.achievement-icon {
    font-size: 2rem;
    animation: medal-spin 1s ease-in-out infinite;
}

.achievement-text {
    display: flex;
    flex-direction: column;
}

.achievement-title {
    font-size: 0.75rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.achievement-name {
    font-weight: 700;
    font-size: 1.1rem;
}

@keyframes achievement-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-50px) scale(0.5);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes achievement-out {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px) scale(0.8);
    }
}

@keyframes medal-spin {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
}

/* Coin Animation */
.coin-earned {
    position: fixed;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 1000;
    animation: coin-fly 1s ease-out forwards;
}

@keyframes coin-fly {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

/* Streak Animation */
.streak-fire {
    animation: fire-pulse 0.5s ease-in-out;
}

@keyframes fire-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

/* Level Up Animation */
.level-up-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1003;
    animation: fade-in 0.3s ease;
}

.level-up-content {
    text-align: center;
    color: white;
    animation: level-up-pop 0.5s ease;
}

.level-up-text {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 3px;
    opacity: 0.8;
}

.level-up-number {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.5);
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes level-up-pop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Confetti */
.confetti {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--primary);
    animation: confetti-fall 3s ease-out forwards;
}

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

/* Pulse Animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

/* Glow Effect */
.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(16, 185, 129, 0.8);
    }
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10);
    opacity: 0;
    transition: transform 0.5s, opacity 1s;
}

.ripple:active::after {
    transform: scale(0);
    opacity: 1;
    transition: 0s;
}

/* Shake Animation for Errors */
.shake {
    animation: shake 0.5s ease-in-out;
}

/* Success Checkmark */
.checkmark-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--success);
    border-radius: var(--radius-full);
    animation: checkmark-pop 0.5s ease;
}

.checkmark {
    width: 30px;
    height: 30px;
    stroke: white;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    animation: checkmark-draw 0.5s ease 0.3s forwards;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
}

@keyframes checkmark-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes checkmark-draw {
    to { stroke-dashoffset: 0; }
}

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: var(--radius-full);
    animation: dot-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Floating Animation */
.floating {
    animation: floating 3s ease-in-out infinite;
}

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

/* Scale on Hover */
.hover-scale {
    transition: transform var(--transition-fast);
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Slide Up Animation */
.slide-up {
    animation: slide-up 0.3s ease forwards;
}

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