/* Loading Modal Animations */
@keyframes spin-smooth {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse-gentle {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

@keyframes bounce-dots {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.7;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fade-in-backdrop {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slide-in-up {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Circular Progress Animation */
@keyframes rotate-circle {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes progress-dash {
    0% {
        stroke-dasharray: 1, 200;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 100, 200;
        stroke-dashoffset: -15;
    }
    100% {
        stroke-dasharray: 100, 200;
        stroke-dashoffset: -125;
    }
}

/* Enhanced dot animations */
@keyframes bounce-sequence {
    0%, 80%, 100% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    40% {
        transform: translateY(-8px) scale(1.2);
        opacity: 1;
    }
}

/* Glowing pulse animation */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.8);
        transform: scale(1.1);
    }
}

/* Modal entrance animation */
@keyframes modal-enter {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Backdrop fade-in */
@keyframes backdrop-fade {
    0% {
        opacity: 0;
        -webkit-backdrop-filter: blur(0px);
        backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
    }
}

/* Enhanced Loading Modal Classes */
.loading-modal-backdrop {
    animation: fade-in-backdrop 0.3s ease-out;
}

.loading-modal-content {
    animation: slide-in-up 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-spinner {
    animation: rotate-circle 1.5s linear infinite;
}

.loading-pulse {
    animation: pulse-gentle 1.5s ease-in-out infinite;
}

.loading-dots .dot-1 {
    animation: bounce-sequence 1.4s infinite;
    animation-delay: 0s;
}

.loading-dots .dot-2 {
    animation: bounce-sequence 1.4s infinite;
    animation-delay: 0.15s;
}

.loading-dots .dot-3 {
    animation: bounce-sequence 1.4s infinite;
    animation-delay: 0.3s;
}

/* Circular progress enhancement */
.loading-modal .animate-spin {
    animation: rotate-circle 1.2s linear infinite;
}

.loading-modal .animate-bounce {
    animation: bounce-sequence 1.4s infinite;
}

.loading-modal .animate-pulse {
    animation: pulse-gentle 2s ease-in-out infinite;
}

/* Additional loading states */
.loading-ring {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin-smooth 1s linear infinite;
}

.loading-wave {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
    animation: bounce-dots 1.4s infinite;
}

/* Order Confirmation Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-scaleIn {
    animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure loading modal is always on top */
.loading-modal {
    z-index: 999999 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: auto !important;
    animation: backdrop-fade 0.3s ease-out;
}

.loading-modal > div:first-child {
    animation: backdrop-fade 0.3s ease-out;
}

.loading-modal > div:last-child {
    animation: modal-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loading-modal * {
    pointer-events: auto !important;
}

/* Enhanced spinning animations */
.loading-modal .animate-spin {
    animation: rotate-circle 1s linear infinite;
}

.loading-modal .animate-pulse {
    animation: glow-pulse 2s ease-in-out infinite;
}

.loading-modal .animate-bounce {
    animation: bounce-sequence 1.4s infinite;
}

.loading-wave:nth-child(1) { animation-delay: 0s; }
.loading-wave:nth-child(2) { animation-delay: 0.1s; }
.loading-wave:nth-child(3) { animation-delay: 0.2s; }
.loading-wave:nth-child(4) { animation-delay: 0.3s; }
.loading-wave:nth-child(5) { animation-delay: 0.4s; }