/**
 * Al Ahsan Widgets - Animation Styles
 * Version: 1.0.0
 */

/* ==========================================================================
   Base Animation Setup
   ========================================================================== */
.alahsan-animate {
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.alahsan-animate.alahsan-animated {
    opacity: 1;
}

/* ==========================================================================
   Fade In Animation
   ========================================================================== */
.alahsan-fade-in {
    opacity: 0;
}

.alahsan-fade-in.alahsan-animated {
    opacity: 1;
}

/* ==========================================================================
   Slide Up Animation
   ========================================================================== */
.alahsan-slide-up {
    opacity: 0;
    transform: translateY(50px);
}

.alahsan-slide-up.alahsan-animated {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Slide Down Animation
   ========================================================================== */
.alahsan-slide-down {
    opacity: 0;
    transform: translateY(-50px);
}

.alahsan-slide-down.alahsan-animated {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   Slide Left Animation
   ========================================================================== */
.alahsan-slide-left {
    opacity: 0;
    transform: translateX(50px);
}

.alahsan-slide-left.alahsan-animated {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Slide Right Animation
   ========================================================================== */
.alahsan-slide-right {
    opacity: 0;
    transform: translateX(-50px);
}

.alahsan-slide-right.alahsan-animated {
    opacity: 1;
    transform: translateX(0);
}

/* ==========================================================================
   Scale In Animation
   ========================================================================== */
.alahsan-scale-in {
    opacity: 0;
    transform: scale(0.8);
}

.alahsan-scale-in.alahsan-animated {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   Rotate In Animation
   ========================================================================== */
.alahsan-rotate-in {
    opacity: 0;
    transform: rotate(-10deg) scale(0.9);
}

.alahsan-rotate-in.alahsan-animated {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ==========================================================================
   Flip In Animation
   ========================================================================== */
.alahsan-flip-in {
    opacity: 0;
    transform: perspective(1000px) rotateY(90deg);
}

.alahsan-flip-in.alahsan-animated {
    opacity: 1;
    transform: perspective(1000px) rotateY(0);
}

/* ==========================================================================
   Bounce In Animation
   ========================================================================== */
.alahsan-bounce-in {
    opacity: 0;
    transform: scale(0.5);
    animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.alahsan-bounce-in.alahsan-animated {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   Zoom In Animation
   ========================================================================== */
.alahsan-zoom-in {
    opacity: 0;
    transform: scale(0);
}

.alahsan-zoom-in.alahsan-animated {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================================================
   Blur In Animation
   ========================================================================== */
.alahsan-blur-in {
    opacity: 0;
    filter: blur(10px);
}

.alahsan-blur-in.alahsan-animated {
    opacity: 1;
    filter: blur(0);
}

/* ==========================================================================
   Stagger Delays (for child elements)
   ========================================================================== */
.alahsan-stagger-1 { transition-delay: 0.1s; }
.alahsan-stagger-2 { transition-delay: 0.2s; }
.alahsan-stagger-3 { transition-delay: 0.3s; }
.alahsan-stagger-4 { transition-delay: 0.4s; }
.alahsan-stagger-5 { transition-delay: 0.5s; }
.alahsan-stagger-6 { transition-delay: 0.6s; }
.alahsan-stagger-7 { transition-delay: 0.7s; }
.alahsan-stagger-8 { transition-delay: 0.8s; }

/* ==========================================================================
   Scroll to Top Button
   ========================================================================== */
.alahsan-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #C41E3A 0%, #FF8C00 100%);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 5px 20px rgba(196, 30, 58, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 9999;
}

.alahsan-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.alahsan-scroll-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(196, 30, 58, 0.5);
}

@media (max-width: 768px) {
    .alahsan-scroll-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
}

/* ==========================================================================
   Preloader
   ========================================================================== */
.alahsan-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #C41E3A 0%, #FF8C00 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.alahsan-preloader.loaded {
    opacity: 0;
    visibility: hidden;
}

.alahsan-preloader .preloader-content {
    text-align: center;
    position: relative;
}

.alahsan-preloader .preloader-spinner {
    width: 100px;
    height: 100px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: preloader-spin 1s linear infinite;
}

.alahsan-preloader .preloader-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    animation: preloader-pulse 1s ease-in-out infinite;
}

@keyframes preloader-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes preloader-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* ==========================================================================
   Hover Animations Enhancement
   ========================================================================== */

/* Card lift effect */
.alahsan-variety-card,
.alahsan-feature-card,
.alahsan-gallery-item {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Shine effect on hover */
.alahsan-variety-card::after,
.alahsan-feature-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transition: left 0.5s ease;
    pointer-events: none;
}

.alahsan-variety-card:hover::after,
.alahsan-feature-card:hover::after {
    left: 100%;
}

/* Icon animations */
.alahsan-feature-card .feature-icon,
.alahsan-desc-feature .feature-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.alahsan-feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(5deg);
}

/* Button animations */
.alahsan-btn-primary,
.alahsan-btn-secondary,
.alahsan-cta-btn,
.alahsan-desc-button {
    position: relative;
    overflow: hidden;
}

.alahsan-btn-primary::before,
.alahsan-cta-btn.primary::before,
.alahsan-desc-button::before {
    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.5s ease, height 0.5s ease;
}

.alahsan-btn-primary:hover::before,
.alahsan-cta-btn.primary:hover::before,
.alahsan-desc-button:hover::before {
    width: 300%;
    height: 300%;
}

/* Floating elements enhanced animation */
.alahsan-floating-element {
    animation: floating-enhanced 3s ease-in-out infinite;
}

.alahsan-floating-element:nth-child(1) { animation-delay: 0s; }
.alahsan-floating-element:nth-child(2) { animation-delay: 0.5s; }
.alahsan-floating-element:nth-child(3) { animation-delay: 1s; }
.alahsan-floating-element:nth-child(4) { animation-delay: 1.5s; }

@keyframes floating-enhanced {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-8px) rotate(1deg);
    }
    50% {
        transform: translateY(-15px) rotate(-1deg);
    }
    75% {
        transform: translateY(-8px) rotate(1deg);
    }
}

/* Product circle enhanced animation */
.alahsan-product-circle {
    animation: product-float 4s ease-in-out infinite, product-glow 3s ease-in-out infinite;
}

@keyframes product-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-10px) rotate(2deg);
    }
    50% {
        transform: translateY(-20px) rotate(0deg);
    }
    75% {
        transform: translateY(-10px) rotate(-2deg);
    }
}

@keyframes product-glow {
    0%, 100% {
        box-shadow: 0 30px 60px rgba(255, 140, 0, 0.4);
    }
    50% {
        box-shadow: 0 30px 80px rgba(255, 140, 0, 0.6);
    }
}

/* Calendar table row hover */
.alahsan-calendar-table tbody tr {
    transition: all 0.3s ease;
}

.alahsan-calendar-table tbody tr:hover {
    transform: scale(1.01);
}

/* Gallery zoom animation */
.alahsan-gallery-item .gallery-image,
.alahsan-gallery-item .gallery-placeholder {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.alahsan-gallery-item:hover .gallery-image,
.alahsan-gallery-item:hover .gallery-placeholder {
    transform: scale(1.1);
}

/* Stats counter animation */
.alahsan-stat-number {
    display: inline-block;
    transition: transform 0.3s ease;
}

.alahsan-stat-item:hover .alahsan-stat-number {
    transform: scale(1.1);
}

/* Badge pulse animation */
.alahsan-desc-badge,
.alahsan-cta-badge,
.alahsan-hero-badge {
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .alahsan-animate,
    .alahsan-floating-element,
    .alahsan-product-circle,
    .alahsan-variety-card,
    .alahsan-feature-card,
    .alahsan-gallery-item,
    .alahsan-scroll-top,
    .alahsan-preloader {
        animation: none !important;
        transition: none !important;
    }
    
    .alahsan-animate {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* ==========================================================================
   Elementor Editor Compatibility
   ========================================================================== */
.elementor-editor-active .alahsan-animate {
    opacity: 1 !important;
    transform: none !important;
}

.elementor-editor-active .alahsan-preloader {
    display: none !important;
}
