/* Trip Planner Animations */

/* Flying card animation - from form to table */
@keyframes flyToTable {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(20px, -30px) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(0, -100px) scale(0.3);
        opacity: 0;
    }
}

/* Flying card animation - from favorite to table */
@keyframes flyFromFavorite {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(0, -50px) scale(0.7);
        opacity: 0.7;
    }
    100% {
        transform: translate(0, -150px) scale(0.2);
        opacity: 0;
    }
}

/* Slide in from right with bounce */
@keyframes slideInBounce {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    60% {
        transform: translateX(-10px);
        opacity: 1;
    }
    80% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Fade out and slide left */
@keyframes fadeOutLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-30px);
        opacity: 0;
    }
}

/* Button press animation */
@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

/* Success checkmark on button */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Speed shoot to right */
@keyframes shootRight {
    0% {
        transform: translateX(0) scale(1);
    }
    50% {
        transform: translateX(15px) scale(1.05);
    }
    100% {
        transform: translateX(0) scale(1);
    }
}

/* Shake animation for validation errors */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(14, 165, 233, 0);
    }
}

/* Flying card element */
.flying-card {
    position: fixed;
    background: white;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 600;
    color: #0f172a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    pointer-events: none;
    white-space: nowrap;
}

/* Apply animations */
.animate-fly-to-table {
    animation: flyToTable 0.6s ease-out forwards;
}

.animate-fly-from-favorite {
    animation: flyFromFavorite 0.7s ease-out forwards;
}

.animate-slide-in {
    animation: slideInBounce 0.5s ease-out forwards;
}

.animate-fade-out {
    animation: fadeOutLeft 0.3s ease-out forwards;
}

.animate-button-press {
    animation: buttonPress 0.2s ease-out;
}

.animate-checkmark {
    animation: checkmark 0.4s ease-out;
}

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

.animate-pulse {
    animation: pulse 0.6s ease-out;
}

.animate-shoot-right {
    animation: shootRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hover lift effect for table rows */
#stopsTable tbody tr {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#stopsTable tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Inline checkmark animation */
svg.animate-checkmark {
    display: inline-block;
    animation: checkmark 0.4s ease-out;
}

/* Slide in from right (for screen/tab transitions) */
@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Ensure animation stops at final state */
@keyframes slideInFromRightStop {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Slide up from bottom (for modals) */
@keyframes slideUpFromBottom {
    0% {
        transform: translateY(100%);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fade in backdrop */
@keyframes fadeInBackdrop {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.animate-slide-in-right {
    animation: slideInFromRight 0.15s ease-out;
    animation-fill-mode: both;
}

/* Lock position after animation */
.animation-complete {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
}

.animate-slide-up {
    animation: slideUpFromBottom 0.3s ease-out forwards;
}

.animate-fade-in {
    animation: fadeInBackdrop 0.3s ease-out forwards;
}
