/* ============================================================
   CREST COURIER – ANIMATIONS CSS
   Version: 3.0 | 2025
   ============================================================ */

/* ---- ENTRANCE ANIMATIONS ---- */
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInUp {
  from { opacity: 0; transform: translateY(60px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-60px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes zoomOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.7); }
}
@keyframes flipInX {
  from { opacity: 0; transform: perspective(600px) rotateX(-90deg); }
  to   { opacity: 1; transform: perspective(600px) rotateX(0); }
}
@keyframes flipInY {
  from { opacity: 0; transform: perspective(600px) rotateY(-90deg); }
  to   { opacity: 1; transform: perspective(600px) rotateY(0); }
}
@keyframes elastic {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.25); }
  60%  { transform: scale(0.9); }
  80%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes rubberBand {
  0%   { transform: scaleX(1) scaleY(1); }
  30%  { transform: scaleX(1.25) scaleY(0.75); }
  40%  { transform: scaleX(0.75) scaleY(1.25); }
  60%  { transform: scaleX(1.15) scaleY(0.85); }
  100% { transform: scaleX(1) scaleY(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%  { transform: translateX(-8px); }
  40%  { transform: translateX(8px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
}
@keyframes tada {
  0%   { transform: scale(1); }
  10%,20% { transform: scale(0.9) rotate(-3deg); }
  30%,50%,70%,90% { transform: scale(1.1) rotate(3deg); }
  40%,60%,80% { transform: scale(1.1) rotate(-3deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes heartbeat {
  0%,100% { transform: scale(1); }
  14%  { transform: scale(1.15); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.15); }
  70%  { transform: scale(1); }
}
@keyframes swing {
  20%  { transform: rotate(15deg); }
  40%  { transform: rotate(-10deg); }
  60%  { transform: rotate(5deg); }
  80%  { transform: rotate(-5deg); }
  100% { transform: rotate(0deg); }
}

/* ---- CONTINUOUS ANIMATIONS ---- */
@keyframes rotateSlowCW { to { transform: rotate(360deg); } }
@keyframes rotateSlowCCW { to { transform: rotate(-360deg); } }
@keyframes breathe {
  0%,100% { transform: scale(1); opacity: 0.85; }
  50%     { transform: scale(1.06); opacity: 1; }
}
@keyframes ripple {
  0%   { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}
@keyframes waveAnim {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(-16px); }
}
@keyframes orbit {
  0%   { transform: rotate(0deg) translateX(60px) rotate(0deg); }
  100% { transform: rotate(360deg) translateX(60px) rotate(-360deg); }
}
@keyframes glowPulse {
  0%,100% { box-shadow: 0 0 15px rgba(245,166,35,0.3); }
  50%     { box-shadow: 0 0 35px rgba(245,166,35,0.7), 0 0 70px rgba(245,166,35,0.25); }
}
@keyframes borderFlow {
  0%   { border-color: rgba(245,166,35,0.2); }
  50%  { border-color: rgba(245,166,35,0.8); }
  100% { border-color: rgba(245,166,35,0.2); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes textGradient {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
@keyframes marqueeLeft {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes drawLine {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}
@keyframes counterUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes mapMarkerBounce {
  0%,100% { transform: translateY(0) scale(1); }
  50%     { transform: translateY(-12px) scale(1.1); }
}
@keyframes dotPing {
  75%,100% { transform: scale(2.5); opacity: 0; }
}
@keyframes progressFill {
  from { width: 0%; }
  to   { width: var(--progress); }
}
@keyframes typeWriter {
  from { width: 0; }
  to   { width: 100%; }
}
@keyframes blinkCaret {
  0%,100% { border-color: transparent; }
  50%     { border-color: var(--secondary); }
}
@keyframes neonGlow {
  0%,100% { text-shadow: 0 0 7px var(--secondary), 0 0 14px var(--secondary); }
  50%     { text-shadow: 0 0 14px var(--secondary), 0 0 28px var(--secondary), 0 0 42px rgba(245,166,35,0.4); }
}
@keyframes glitch {
  0%   { transform: translate(0); }
  20%  { transform: translate(-2px, 2px); }
  40%  { transform: translate(-2px, -2px); }
  60%  { transform: translate(2px, 2px); }
  80%  { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}
@keyframes morphBg {
  0%,100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
  50%     { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
}
@keyframes slideBar {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}
@keyframes scanLine {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* ---- CARD HOVER EFFECTS ---- */
.hover-lift { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.hover-lift:hover { transform: translateY(-8px); box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.hover-glow:hover { box-shadow: 0 0 30px rgba(245,166,35,0.4); }
.hover-scale { transition: transform 0.3s ease; }
.hover-scale:hover { transform: scale(1.04); }
.hover-tilt { transition: transform 0.3s ease; }
.hover-tilt:hover { transform: perspective(600px) rotateX(-5deg) rotateY(5deg) scale(1.02); }
.hover-rotate { transition: transform 0.5s ease; }
.hover-rotate:hover { transform: rotate(5deg) scale(1.05); }
.hover-shine { position: relative; overflow: hidden; }
.hover-shine::after { content: ''; position: absolute; top: 0; left: -100%; width: 70%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent); transition: left 0.5s ease; transform: skewX(-15deg); }
.hover-shine:hover::after { left: 130%; }

/* ---- TEXT ANIMATIONS ---- */
.text-shimmer {
  background: linear-gradient(90deg, var(--text-primary) 0%, var(--secondary) 40%, var(--text-primary) 80%);
  background-size: 200% auto; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; animation: shimmer 3s linear infinite;
}
.text-neon { animation: neonGlow 2s ease-in-out infinite; }
.text-typewriter { overflow: hidden; white-space: nowrap; border-right: 3px solid var(--secondary); animation: typeWriter 2.5s steps(30) 0.5s 1 normal both, blinkCaret 0.7s step-end infinite; }
.text-gradient-anim {
  background: linear-gradient(270deg, #F5A623, #FFD166, #3b82f6, #F5A623);
  background-size: 300% 300%; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; animation: gradientShift 4s ease infinite;
}

/* ---- BUTTON ANIMATIONS ---- */
.btn-ripple { position: relative; overflow: hidden; }
.btn-ripple::after { content: ''; position: absolute; width: 1px; height: 1px; border-radius: 50%; background: rgba(255,255,255,0.5); transform: scale(0); transition: transform 0.5s, opacity 0.5s; }
.btn-ripple:active::after { transform: scale(400); opacity: 0; transition: transform 0s, opacity 0.5s; }
.btn-pulse { animation: glowPulse 2s ease-in-out infinite; }
.btn-bounce:hover { animation: elastic 0.5s ease; }

/* ---- ICON ANIMATIONS ---- */
.icon-spin { animation: rotateSlowCW 8s linear infinite; }
.icon-spin-ccw { animation: rotateSlowCCW 8s linear infinite; }
.icon-bounce { animation: waveAnim 2s ease-in-out infinite; }
.icon-pulse { animation: heartbeat 1.5s ease infinite; }
.icon-swing { animation: swing 1.5s ease infinite; }
.icon-tada:hover { animation: tada 0.8s ease; }

/* ---- LOADING ANIMATIONS ---- */
.spinner {
  width: 40px; height: 40px; border: 3px solid rgba(245,166,35,0.2);
  border-top-color: var(--secondary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-sm { width: 20px; height: 20px; border-width: 2px; }
.spinner-lg { width: 60px; height: 60px; border-width: 4px; }
.dots-loader { display: flex; gap: 6px; align-items: center; }
.dots-loader span { width: 10px; height: 10px; background: var(--secondary); border-radius: 50%; animation: waveAnim 0.9s ease-in-out infinite; }
.dots-loader span:nth-child(2) { animation-delay: 0.15s; }
.dots-loader span:nth-child(3) { animation-delay: 0.3s; }
.progress-bar { height: 4px; background: var(--bg-secondary); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--gradient-secondary); border-radius: var(--radius-full); animation: slideBar 1.5s ease forwards; }
.progress-striped .progress-fill {
  background-image: linear-gradient(45deg, rgba(255,255,255,0.2) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.2) 75%, transparent 75%);
  background-size: 20px 20px; animation: slideBar 1.5s ease forwards, progressStripe 1s linear infinite;
}
@keyframes progressStripe { 0% { background-position: 0 0; } 100% { background-position: 20px 20px; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- SCROLL EFFECTS ---- */
.parallax-slow { transform: translateY(calc(var(--scroll-y, 0) * -0.2px)); will-change: transform; }
.parallax-medium { transform: translateY(calc(var(--scroll-y, 0) * -0.4px)); will-change: transform; }
.parallax-fast { transform: translateY(calc(var(--scroll-y, 0) * -0.6px)); will-change: transform; }
.sticky-reveal { position: sticky; top: 100px; }
.scroll-fade { transition: opacity 0.3s ease; }
.scroll-fade.hidden { opacity: 0; pointer-events: none; }

/* ---- PARTICLE EFFECTS ---- */
.particles-container { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.particle {
  position: absolute; border-radius: 50%; pointer-events: none;
  animation: particleFloat linear infinite;
}
@keyframes particleFloat {
  0%   { opacity: 0; transform: translateY(100vh) rotate(0deg) scale(0); }
  10%  { opacity: 0.8; }
  90%  { opacity: 0.4; }
  100% { opacity: 0; transform: translateY(-100px) rotate(720deg) scale(1); }
}
.particle-network canvas { position: absolute; inset: 0; }

/* ---- MAP ANIMATIONS ---- */
.map-marker-pulse { position: relative; }
.map-marker-pulse::before {
  content: ''; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid currentColor; animation: ripple 1.8s ease-out infinite;
}
.map-route-line { stroke-dasharray: 10 5; animation: dashMove 0.8s linear infinite; }
@keyframes dashMove { 0% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -15; } }
.delivery-pulse { animation: mapMarkerBounce 1.5s ease-in-out infinite; }

/* ---- CARD REVEAL ANIMATIONS ---- */
.card-stagger:nth-child(1) { animation-delay: 0s; }
.card-stagger:nth-child(2) { animation-delay: 0.1s; }
.card-stagger:nth-child(3) { animation-delay: 0.2s; }
.card-stagger:nth-child(4) { animation-delay: 0.3s; }
.card-stagger:nth-child(5) { animation-delay: 0.4s; }
.card-stagger:nth-child(6) { animation-delay: 0.5s; }
.card-stagger:nth-child(7) { animation-delay: 0.6s; }
.card-stagger:nth-child(8) { animation-delay: 0.7s; }
.card-stagger:nth-child(9) { animation-delay: 0.8s; }

/* ---- NOTIFICATION ANIMATIONS ---- */
.toast { animation: slideInRight 0.4s ease, fadeOut 0.4s 3.6s ease forwards; }
@keyframes fadeOut { to { opacity: 0; transform: translateX(100%); } }
.notification-pop { animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* ---- MORPHING SHAPES ---- */
.morph-blob { animation: morphBg 8s ease-in-out infinite; }
.morph-blob-2 { animation: morphBg 10s ease-in-out infinite reverse; }

/* ---- SVG PATH ANIMATIONS ---- */
.svg-draw path { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: drawLine 2s ease forwards; }
.svg-draw circle { animation: zoomIn 0.5s ease forwards; }

/* ---- COUNTER ANIMATION ---- */
.counter-animate { animation: counterUp 0.6s ease forwards; }

/* ---- HIGHLIGHT EFFECTS ---- */
.highlight-line { position: relative; }
.highlight-line::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 3px;
  background: var(--secondary); border-radius: 2px; transition: width 0.5s ease;
}
.highlight-line:hover::after, .highlight-line.active::after { width: 100%; }

/* ---- CUSTOM CURSOR ---- */
.custom-cursor {
  width: 20px; height: 20px; border: 2px solid var(--secondary); border-radius: 50%;
  position: fixed; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%); transition: all 0.15s ease;
  mix-blend-mode: difference;
}
.custom-cursor-dot {
  width: 6px; height: 6px; background: var(--secondary); border-radius: 50%;
  position: fixed; pointer-events: none; z-index: 9999;
  transform: translate(-50%, -50%);
}
.custom-cursor.expand { width: 40px; height: 40px; background: rgba(245,166,35,0.15); border-color: var(--secondary); }

/* ---- SCROLL PROGRESS BAR ---- */
.scroll-progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; z-index: 9999;
  background: var(--gradient-secondary); border-radius: 0 3px 3px 0;
  transition: width 0.1s linear;
}

/* ---- TOOLTIP ANIMATIONS ---- */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) scale(0.85);
  background: var(--primary); color: #fff; padding: 6px 14px; border-radius: var(--radius-md);
  font-size: var(--text-xs); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: all 0.2s ease; transform-origin: bottom center;
}
.tooltip:hover::after { opacity: 1; transform: translateX(-50%) scale(1); }

/* ---- FOCUS RING ---- */
:focus-visible {
  outline: 2px solid var(--secondary); outline-offset: 3px; border-radius: 4px;
}

/* ---- REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
