/* ============================================
   MAQTOU Animations
   Emergency pulse, scroll reveals, transitions
   ============================================ */

/* --- Keyframes --- */
@keyframes emergency-pulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(255, 92, 0, 0.3), 0 0 60px rgba(255, 92, 0, 0.1);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 92, 0, 0.5), 0 0 100px rgba(255, 92, 0, 0.2);
    }
}

@keyframes glow-rotate {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(20deg); }
}

@keyframes hero-glow {
    0% {
        transform: translateY(-5%) scale(1);
        opacity: 0.6;
    }
    100% {
        transform: translateY(5%) scale(1.1);
        opacity: 1;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@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 ripple {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

@keyframes borderGlow {
    0%, 100% {
        border-color: rgba(255, 92, 0, 0.3);
    }
    50% {
        border-color: rgba(255, 92, 0, 0.6);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 92, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(255, 92, 0, 0);
    }
}

@keyframes dash-progress {
    0% { stroke-dashoffset: 100; }
    100% { stroke-dashoffset: 0; }
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- Scroll Reveal Classes --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-right.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1);
}

/* Staggered reveals */
.reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-stagger.visible > *:nth-child(1) { transition-delay: 0.1s; }
.reveal-stagger.visible > *:nth-child(2) { transition-delay: 0.2s; }
.reveal-stagger.visible > *:nth-child(3) { transition-delay: 0.3s; }
.reveal-stagger.visible > *:nth-child(4) { transition-delay: 0.4s; }
.reveal-stagger.visible > *:nth-child(5) { transition-delay: 0.5s; }
.reveal-stagger.visible > *:nth-child(6) { transition-delay: 0.6s; }

.reveal-stagger.visible > * {
    opacity: 1;
    transform: translateY(0);
}

/* --- Live Status Animations --- */
.status-pulse {
    animation: statusPulse 2s ease-in-out infinite;
}

.status-dot-live {
    position: relative;
}

.status-dot-live::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    animation: ripple 2s ease-out infinite;
}

/* ETA countdown animation */
.eta-counter {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-primary);
    animation: pulse 2s ease-in-out infinite;
}

/* Merchant incoming job card */
.job-card-incoming {
    animation: borderGlow 2s ease-in-out infinite;
    border: 2px solid rgba(255, 92, 0, 0.3);
}

/* --- Page Transition --- */
.page-transition {
    animation: fadeInUp 0.4s ease forwards;
}

/* --- Floating Elements --- */
.float {
    animation: float 6s ease-in-out infinite;
}

.float-delay-1 { animation-delay: -1s; }
.float-delay-2 { animation-delay: -2s; }
.float-delay-3 { animation-delay: -3s; }

/* --- Hover Lift --- */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* --- Glowing Border Effect --- */
.glow-border {
    position: relative;
}

.glow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--color-primary), transparent 40%, transparent 60%, var(--color-primary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.glow-border:hover::before {
    opacity: 1;
}

/* --- Orange Light Trail (background effect) --- */
.light-trail {
    position: relative;
    overflow: hidden;
}

.light-trail::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 92, 0, 0.05), transparent);
    transition: none;
}

.light-trail:hover::after {
    left: 100%;
    transition: left 0.6s ease;
}

/* --- Number Counter Animation --- */
.counter {
    animation: countUp 0.3s ease forwards;
}

/* --- Notification Toast --- */
.toast {
    position: fixed;
    top: 90px;
    right: 20px;
    padding: 16px 24px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transform: translateX(120%);
    transition: transform var(--transition-base);
    max-width: 380px;
}

.toast.show {
    transform: translateX(0);
}

/* --- City Pulse (Map Markers) --- */
@keyframes cityPulse {
    0%, 100% {
        filter: drop-shadow(0 0 3px rgba(255, 92, 0, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(255, 92, 0, 0.8));
    }
}

/* --- Live Coverage Dot --- */
@keyframes livePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
}

/* --- Dispatch Text Cycle --- */
@keyframes dispatchFade {
    0%, 90%, 100% { opacity: 1; }
    95% { opacity: 0; }
}

.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast-error {
    border-left: 4px solid var(--color-error);
}

.toast-warning {
    border-left: 4px solid var(--color-warning);
}

/* --- Reduce Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal, .reveal-left, .reveal-right, .reveal-scale {
        opacity: 1;
        transform: none;
    }

    .reveal-stagger > * {
        opacity: 1;
        transform: none;
    }
}
