/**
 * Tunisia COD Theme - Animations
 * Shine effects, urgency animations, and micro-interactions
 * Version: 4.0
 */

/* ===========================================
   SHINE / SWEEP EFFECT
   =========================================== */

/* Shine sweep animation for product images */
@keyframes shine-sweep {
    0% {
        left: -100%;
    }

    20% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

/* Button shine effect */
@keyframes button-shine {
    0% {
        left: -150%;
    }

    50% {
        left: 150%;
    }

    100% {
        left: 150%;
    }
}

/* Shine effect for buttons */
.btn-shine {
    position: relative;
    overflow: hidden;
}

.btn-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    transform: skewX(-25deg);
    animation: button-shine 3s infinite;
}

/* Logo shine effect */
.logo-shine {
    position: relative;
    display: inline-block;
    /* overflow: hidden; */
}

.logo-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.6),
            transparent);
    animation: shine-sweep 4s ease-in-out infinite;
}

/* ===========================================
   URGENCY ANIMATIONS
   =========================================== */

/* Pulse animation for urgent badges */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Countdown timer pulse */
@keyframes countdown-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

/* Stock counter shake */
@keyframes stock-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(2px);
    }
}

/* Blink animation for notifications */
@keyframes blink {

    0%,
    50%,
    100% {
        opacity: 1;
    }

    25%,
    75% {
        opacity: 0.5;
    }
}

.blink-me {
    animation: blink 1.5s ease-in-out infinite;
}

/* ===========================================
   COUNTDOWN TIMER
   =========================================== */

.countdown-timer {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--urgency-red);
    color: var(--text-white);
    border-radius: var(--radius-full);
    font-weight: var(--font-weight-semibold);
    animation: pulse 2s infinite;
}

.countdown-timer .icon {
    font-size: var(--font-size-lg);
}

.countdown-time {
    display: flex;
    gap: 2px;
}

.countdown-digit {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: var(--font-weight-bold);
    min-width: 28px;
    text-align: center;
}

.countdown-separator {
    font-weight: var(--font-weight-bold);
    animation: blink 1s infinite;
}

/* ===========================================
   STOCK COUNTER
   =========================================== */

.stock-counter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--warning-bg);
    color: #856404;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.stock-counter.low-stock {
    background: var(--danger-bg);
    color: var(--danger-color);
    animation: stock-shake 0.5s ease-in-out;
}

.stock-counter .icon {
    font-size: var(--font-size-md);
}

.stock-number {
    font-weight: var(--font-weight-bold);
}

/* ===========================================
   TRUCK DELIVERY ANIMATION
   =========================================== */

@keyframes truck-drive {
    0% {
        transform: translateX(-10px);
    }

    50% {
        transform: translateX(5px);
    }

    100% {
        transform: translateX(-10px);
    }
}

@keyframes truck-bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

.delivery-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--success-bg);
    color: var(--success-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
}

.delivery-badge .truck-icon {
    animation: truck-bounce 1s ease-in-out infinite;
}

.delivery-badge.animated .truck-icon {
    animation: truck-drive 2s ease-in-out infinite;
}

/* ===========================================
   BUTTON ANIMATIONS
   =========================================== */

/* Shaking button (for urgency) */
@keyframes shaking {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-3px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(3px);
    }
}

.btn-shake {
    animation: shaking 2s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite;
}

/* Bounce on hover */
@keyframes bounce-hover {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.btn-bounce:hover {
    animation: bounce-hover 0.4s ease;
}

/* Gradient animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.btn-gradient-animated {
    background: linear-gradient(270deg,
            #667eea,
            #764ba2,
            #667eea,
            #764ba2);
    background-size: 300% 300%;
    animation: gradient-shift 4s ease infinite;
}

/* ===========================================
   FORM FIELD ANIMATIONS
   =========================================== */

/* Focus animation */
@keyframes focus-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }

    100% {
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0);
    }
}

.input-focus-animate:focus {
    animation: focus-ring 0.3s ease;
}

/* Error shake */
@keyframes error-shake {

    0%,
    100% {
        transform: translateX(0);
        border-color: var(--danger-color);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.input-error {
    animation: error-shake 0.4s ease;
    border-color: var(--danger-color) !important;
}

/* ===========================================
   SUCCESS / COMPLETION ANIMATIONS
   =========================================== */

/* Checkmark animation */
@keyframes checkmark-draw {
    0% {
        stroke-dashoffset: 50;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.success-checkmark {
    width: 80px;
    height: 80px;
}

.success-checkmark .checkmark-circle {
    stroke: var(--success-color);
    stroke-width: 3;
    fill: none;
}

.success-checkmark .checkmark-check {
    stroke: var(--success-color);
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkmark-draw 0.5s ease 0.3s forwards;
}

/* Scale in animation */
@keyframes scale-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-scale-in {
    animation: scale-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Fade in up */
@keyframes fade-in-up {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-up {
    animation: fade-in-up 0.5s ease;
}

/* ===========================================
   LOADING STATES
   =========================================== */

/* Spinner */
@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

/* Skeleton loading */
@keyframes skeleton-loading {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            var(--bg-light) 25%,
            var(--bg-subtle) 50%,
            var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ===========================================
   HOVER EFFECTS
   =========================================== */

/* Lift on hover */
.hover-lift {
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Glow on hover */
.hover-glow {
    transition: box-shadow var(--transition-normal);
}

.hover-glow:hover {
    box-shadow: var(--shadow-glow-hover);
}

/* Scale on hover */
.hover-scale {
    transition: transform var(--transition-normal);
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* ===========================================
   ACCESSIBILITY: REDUCED MOTION
   =========================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}