/* ============================================
   EasyRentalGuru Animation System
   Comprehensive CSS animations for Blazor app
   ============================================ */

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Zoom Animations */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Slide Animations */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(100%);
        opacity: 0;
    }
}

@keyframes slideOutLeft {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(-100%);
        opacity: 0;
    }
}

/* Bounce, Pulse, Shake */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(-20px); }
    75% { transform: translateY(-10px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Flip Animation */
@keyframes flip {
    0% { transform: perspective(400px) rotateY(0); }
    40% { transform: perspective(400px) rotateY(-180deg); }
    100% { transform: perspective(400px) rotateY(0); }
}

/* Rotate Animations */
@keyframes rotateIn {
    from {
        transform: rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: rotate(0);
        opacity: 1;
    }
}

@keyframes rotateOut {
    from {
        transform: rotate(0);
        opacity: 1;
    }
    to {
        transform: rotate(180deg);
        opacity: 0;
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0);
        opacity: 0;
    }
}

/* Spinner/Loading Animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Elastic Animation */
@keyframes elastic {
    0% { transform: scale(1); }
    30% { transform: scale(1.25, 0.75); }
    40% { transform: scale(0.75, 1.25); }
    50% { transform: scale(1.15, 0.85); }
    65% { transform: scale(0.95, 1.05); }
    75% { transform: scale(1.05, 0.95); }
    100% { transform: scale(1); }
}

/* Heartbeat Animation */
@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* ============================================
   ANIMATION UTILITY CLASSES
   ============================================ */

.anim-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.anim-fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

.anim-fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
}

.anim-fade-in-down {
    animation: fadeInDown 0.4s ease-out forwards;
}

.anim-fade-in-left {
    animation: fadeInLeft 0.4s ease-out forwards;
}

.anim-fade-in-right {
    animation: fadeInRight 0.4s ease-out forwards;
}

.anim-zoom-in {
    animation: zoomIn 0.3s ease-out forwards;
}

.anim-zoom-out {
    animation: zoomOut 0.3s ease-out forwards;
}

.anim-slide-in-up {
    animation: slideInUp 0.4s ease-out forwards;
}

.anim-slide-in-down {
    animation: slideInDown 0.4s ease-out forwards;
}

.anim-slide-in-left {
    animation: slideInLeft 0.4s ease-out forwards;
}

.anim-slide-in-right {
    animation: slideInRight 0.4s ease-out forwards;
}

.anim-bounce {
    animation: bounce 0.6s ease-in-out;
}

.anim-pulse {
    animation: pulse 1s ease-in-out infinite;
}

.anim-shake {
    animation: shake 0.5s ease-in-out;
}

.anim-flip {
    animation: flip 0.6s ease-in-out;
}

.anim-rotate-in {
    animation: rotateIn 0.5s ease-out forwards;
}

.anim-rotate-out {
    animation: rotateOut 0.5s ease-out forwards;
}

.anim-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

.anim-scale-out {
    animation: scaleOut 0.3s ease-out forwards;
}

.anim-spin {
    animation: spin 1s linear infinite;
}

.anim-elastic {
    animation: elastic 0.6s ease-in-out;
}

.anim-heartbeat {
    animation: heartbeat 1.3s ease-in-out infinite;
}

/* Animation Delays */
.anim-delay-100 { animation-delay: 100ms; }
.anim-delay-200 { animation-delay: 200ms; }
.anim-delay-300 { animation-delay: 300ms; }
.anim-delay-400 { animation-delay: 400ms; }
.anim-delay-500 { animation-delay: 500ms; }
.anim-delay-600 { animation-delay: 600ms; }
.anim-delay-700 { animation-delay: 700ms; }
.anim-delay-800 { animation-delay: 800ms; }
.anim-delay-900 { animation-delay: 900ms; }
.anim-delay-1000 { animation-delay: 1000ms; }

/* Animation Durations */
.anim-fast { animation-duration: 0.15s; }
.anim-normal { animation-duration: 0.3s; }
.anim-slow { animation-duration: 0.5s; }
.anim-slower { animation-duration: 0.8s; }

/* ============================================
   HOVER ANIMATIONS
   ============================================ */

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(66, 153, 225, 0.6);
}

.hover-highlight {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.hover-highlight:hover {
    background-color: rgba(66, 153, 225, 0.1);
    transform: translateX(4px);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

.hover-shadow {
    transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* ============================================
   CLICK ANIMATIONS
   ============================================ */

.click-press:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.click-bounce:active {
    animation: bounce 0.3s ease;
}

/* Ripple Effect */
.ripple-button {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
    width: 100px;
    height: 100px;
    margin-left: -50px;
    margin-top: -50px;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ============================================
   STAGGER ANIMATIONS FOR LISTS
   ============================================ */

.stagger-children > * {
    opacity: 0;
    animation: fadeInUp 0.4s ease-out forwards;
}

.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }
.stagger-children > *:nth-child(9) { animation-delay: 400ms; }
.stagger-children > *:nth-child(10) { animation-delay: 450ms; }
.stagger-children > *:nth-child(11) { animation-delay: 500ms; }
.stagger-children > *:nth-child(12) { animation-delay: 550ms; }
.stagger-children > *:nth-child(13) { animation-delay: 600ms; }
.stagger-children > *:nth-child(14) { animation-delay: 650ms; }
.stagger-children > *:nth-child(15) { animation-delay: 700ms; }
.stagger-children > *:nth-child(16) { animation-delay: 750ms; }
.stagger-children > *:nth-child(17) { animation-delay: 800ms; }
.stagger-children > *:nth-child(18) { animation-delay: 850ms; }
.stagger-children > *:nth-child(19) { animation-delay: 900ms; }
.stagger-children > *:nth-child(20) { animation-delay: 950ms; }

/* Stagger with slide animation */
.stagger-slide > * {
    opacity: 0;
    animation: slideInRight 0.4s ease-out forwards;
}

.stagger-slide > *:nth-child(1) { animation-delay: 0ms; }
.stagger-slide > *:nth-child(2) { animation-delay: 50ms; }
.stagger-slide > *:nth-child(3) { animation-delay: 100ms; }
.stagger-slide > *:nth-child(4) { animation-delay: 150ms; }
.stagger-slide > *:nth-child(5) { animation-delay: 200ms; }
.stagger-slide > *:nth-child(6) { animation-delay: 250ms; }
.stagger-slide > *:nth-child(7) { animation-delay: 300ms; }
.stagger-slide > *:nth-child(8) { animation-delay: 350ms; }
.stagger-slide > *:nth-child(9) { animation-delay: 400ms; }
.stagger-slide > *:nth-child(10) { animation-delay: 450ms; }

/* Stagger with zoom animation */
.stagger-zoom > * {
    opacity: 0;
    animation: zoomIn 0.4s ease-out forwards;
}

.stagger-zoom > *:nth-child(1) { animation-delay: 0ms; }
.stagger-zoom > *:nth-child(2) { animation-delay: 50ms; }
.stagger-zoom > *:nth-child(3) { animation-delay: 100ms; }
.stagger-zoom > *:nth-child(4) { animation-delay: 150ms; }
.stagger-zoom > *:nth-child(5) { animation-delay: 200ms; }
.stagger-zoom > *:nth-child(6) { animation-delay: 250ms; }
.stagger-zoom > *:nth-child(7) { animation-delay: 300ms; }
.stagger-zoom > *:nth-child(8) { animation-delay: 350ms; }
.stagger-zoom > *:nth-child(9) { animation-delay: 400ms; }
.stagger-zoom > *:nth-child(10) { animation-delay: 450ms; }

/* ============================================
   PAGE TRANSITIONS
   ============================================ */

.page-transition-wrapper {
    position: relative;
}

.page-enter {
    animation: fadeIn 0.3s ease-out;
}

.page-exit {
    animation: fadeOut 0.3s ease-in;
}

.page-enter-slide-up {
    animation: slideInUp 0.4s ease-out;
}

.page-exit-slide-down {
    animation: slideOutDown 0.4s ease-in;
}

.page-enter-zoom {
    animation: zoomIn 0.3s ease-out;
}

.page-exit-zoom {
    animation: zoomOut 0.3s ease-in;
}

.page-enter-fade-right {
    animation: fadeInRight 0.4s ease-out;
}

.page-exit-fade-left {
    animation: slideOutLeft 0.4s ease-in;
}

/* ============================================
   SCROLL REVEAL ANIMATIONS
   ============================================ */

.scroll-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* ============================================
   SKELETON LOADING ANIMATIONS
   ============================================ */

.skeleton-pulse {
    background: linear-gradient(
        90deg,
        var(--skeleton-bg, #e2e8f0) 0%,
        var(--skeleton-highlight, #f1f5f9) 50%,
        var(--skeleton-bg, #e2e8f0) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   CARD AND CONTAINER ANIMATIONS
   ============================================ */

.animated-container {
    will-change: transform, opacity;
}

.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.card-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.2);
}

/* ============================================
   BUTTON ANIMATIONS
   ============================================ */

.btn-animate {
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.btn-animate::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn-animate:active::after {
    width: 200%;
    height: 200%;
}

.btn-icon-animate {
    transition: transform 0.2s ease;
}

.btn-icon-animate:hover {
    transform: scale(1.1);
}

.btn-icon-animate:active {
    transform: scale(0.95);
}

/* ============================================
   NOTIFICATION AND TOAST ANIMATIONS
   ============================================ */

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast-enter {
    animation: slideInFromRight 0.3s ease-out forwards;
}

.toast-exit {
    animation: slideOutToRight 0.3s ease-in forwards;
}

/* ============================================
   MODAL AND DIALOG ANIMATIONS
   ============================================ */

@keyframes modalBackdropIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalBackdropOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalContentIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalContentOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
}

.modal-backdrop-enter {
    animation: modalBackdropIn 0.2s ease-out forwards;
}

.modal-backdrop-exit {
    animation: modalBackdropOut 0.2s ease-in forwards;
}

.modal-content-enter {
    animation: modalContentIn 0.3s ease-out forwards;
}

.modal-content-exit {
    animation: modalContentOut 0.2s ease-in forwards;
}

/* ============================================
   DRAWER AND SIDEBAR ANIMATIONS
   ============================================ */

@keyframes drawerSlideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes drawerSlideOutLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@keyframes drawerSlideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes drawerSlideOutRight {
    from { transform: translateX(0); }
    to { transform: translateX(100%); }
}

.drawer-enter-left {
    animation: drawerSlideInLeft 0.3s ease-out forwards;
}

.drawer-exit-left {
    animation: drawerSlideOutLeft 0.3s ease-in forwards;
}

.drawer-enter-right {
    animation: drawerSlideInRight 0.3s ease-out forwards;
}

.drawer-exit-right {
    animation: drawerSlideOutRight 0.3s ease-in forwards;
}

/* ============================================
   FORM INPUT ANIMATIONS
   ============================================ */

.input-focus-animate {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input-focus-animate:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.15);
}

.input-label-animate {
    transition: all 0.2s ease;
}

.input-wrapper:focus-within .input-label-animate {
    transform: translateY(-2px);
    color: var(--primary-color, #4299e1);
}

/* ============================================
   LOADING AND PROGRESS ANIMATIONS
   ============================================ */

.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background-color: currentColor;
    border-radius: 50%;
    animation: loadingDot 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.progress-bar-animate {
    position: relative;
    overflow: hidden;
}

.progress-bar-animate::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ============================================
   SUCCESS AND ERROR STATE ANIMATIONS
   ============================================ */

.success-checkmark {
    animation: scaleIn 0.3s ease-out, pulse 0.5s ease-in-out 0.3s;
}

.error-shake {
    animation: shake 0.5s ease-in-out;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Visibility utilities */
.invisible-until-animated {
    opacity: 0;
}

.visible-after-animation {
    opacity: 1;
}

/* Performance optimization */
.will-animate {
    will-change: transform, opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right,
    .scroll-reveal-scale {
        opacity: 1;
        transform: none;
    }
}
