/* 
 * Animations & Transitions for Darul Ameen Enterprises
 * Smooth, modern animations for better UX
 */

/* Fade In Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale Animations */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Slide Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Glow Effect */
@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 193, 7, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    }
}

/* Rotate Animation */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.8s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.5s ease-out forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Staggered Animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hover-grow {
    transition: transform 0.3s ease;
}

.hover-grow:hover {
    transform: scale(1.05);
}

.hover-glow {
    transition: box-shadow 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
}

/* Product Card Animations */
.product-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out forwards;
    transition: all 0.3s ease;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.product-card img {
    transition: transform 0.5s ease;
}

.product-card:hover img {
    transform: scale(1.1);
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* WhatsApp Button Animation */
.btn-success {
    animation: pulse 2s ease-in-out infinite;
}

.btn-success:hover {
    animation: none;
    transform: scale(1.05);
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 193, 7, 0.3);
    border-top-color: #ffc107;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Shimmer Loading Effect */
.skeleton-loading {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Category Card Hover */
.category-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.category-card:hover .category-icon {
    animation: bounce 0.6s ease;
}

/* Badge Animations */
.badge {
    transition: all 0.3s ease;
}

.badge:hover {
    transform: scale(1.1);
}

/* Alert Animations */
.alert {
    animation: slideInRight 0.5s ease-out;
}

/* Modal Animations */
.modal.show {
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    animation: scaleIn 0.3s ease-out;
}

/* Navbar Animations */
.navbar {
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.navbar.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Search Bar Animation */
.search-bar {
    transition: all 0.3s ease;
}

.search-bar:focus-within {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
}

/* Cart Count Badge Animation */
.cart-count {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Image Lazy Load Effect */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease-in;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* Smooth Scroll */
html {
    scroll-behavior: smooth;
}

/* Page Transition */
.page-content {
    animation: fadeIn 0.5s ease-out;
}

/* Accordion Animation */
.accordion-collapse {
    transition: all 0.3s ease;
}

/* Toast Notification */
.toast {
    animation: slideInRight 0.5s ease-out;
}

.toast.hide {
    animation: fadeInRight 0.3s ease-out reverse;
}

/* Price Badge Animation */
.price-badge {
    animation: pulse 2s ease-in-out infinite;
}

/* Stock Status Animation */
.stock-status {
    transition: all 0.3s ease;
}

.stock-status:hover {
    transform: scale(1.05);
}

/* Footer Animation */
footer {
    animation: fadeInUp 1s ease-out;
}

/* Hero Section Animation */
.hero-content {
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    animation: fadeInDown 1.2s ease-out;
}

.hero-subtitle {
    animation: fadeInUp 1.4s ease-out;
}

.hero-cta {
    animation: fadeInUp 1.6s ease-out;
}

/* Feature Box Animation */
.feature-box {
    transition: all 0.3s ease;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.feature-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.feature-box i {
    transition: transform 0.3s ease;
}

.feature-box:hover i {
    transform: scale(1.2) rotate(5deg);
}

/* Breadcrumb Animation */
.breadcrumb {
    animation: fadeInDown 0.6s ease-out;
}

/* Pagination Animation */
.pagination .page-item {
    transition: all 0.3s ease;
}

.pagination .page-item:hover {
    transform: scale(1.1);
}

/* Filter Animation */
.filter-section {
    animation: fadeInLeft 0.8s ease-out;
}

/* Review Stars Animation */
.stars i {
    transition: all 0.2s ease;
}

.stars i:hover {
    transform: scale(1.3);
    color: #ffc107;
}

/* Quantity Selector Animation */
.quantity-selector button {
    transition: all 0.2s ease;
}

.quantity-selector button:hover {
    transform: scale(1.1);
    background-color: #ffc107;
}

/* Responsive Animations */
@media (max-width: 768px) {
    .product-card {
        animation: fadeIn 0.4s ease-out forwards;
    }
    
    .hover-lift:hover {
        transform: translateY(-3px);
    }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

