/* ============================================
   VIAZU - Animaciones y Keyframes
   Sistema de animaciones premium
   ============================================ */

/* === KEYFRAMES PRINCIPALES === */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  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); }
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes scaleOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.85); }
}

@keyframes bounceIn {
  0%   { opacity: 0; transform: scale(0.3); }
  50%  { opacity: 1; transform: scale(1.05); }
  70%  { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.05); opacity: 0.8; }
}

@keyframes pulsate {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 200, 83, 0.7); }
  70%  { transform: scale(1.03); box-shadow: 0 0 0 15px rgba(0, 200, 83, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 200, 83, 0); }
}

@keyframes ripple {
  0%   { transform: scale(0); opacity: 1; }
  100% { transform: scale(4); opacity: 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinReverse {
  from { transform: rotate(360deg); }
  to   { transform: rotate(0deg); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(0,200,83,0.3); }
  50%       { box-shadow: 0 0 30px rgba(0,200,83,0.7), 0 0 60px rgba(0,200,83,0.3); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

@keyframes carMove {
  0%   { transform: translateX(-10px) rotate(-3deg); }
  50%  { transform: translateX(10px) rotate(3deg); }
  100% { transform: translateX(-10px) rotate(-3deg); }
}

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
  40%           { transform: scale(1); opacity: 1; }
}

@keyframes progressBar {
  from { width: 0%; }
  to   { width: var(--progress, 100%); }
}

@keyframes waveMove {
  0%   { transform: translateX(0) scaleY(1); }
  50%  { transform: translateX(-25%) scaleY(0.8); }
  100% { transform: translateX(-50%) scaleY(1); }
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes radarPing {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes countUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes typewriter {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes cursor {
  from, to { border-color: transparent; }
  50%       { border-color: var(--color-primary); }
}

@keyframes morphBtn {
  0%   { border-radius: var(--border-radius-full); width: 200px; }
  30%  { border-radius: var(--border-radius-full); width: 56px; }
  60%  { border-radius: 50%; width: 56px; height: 56px; }
  100% { border-radius: 50%; width: 56px; height: 56px; }
}

@keyframes checkmark {
  0%   { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

@keyframes confetti {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes mapMarkerBounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-20px); }
  50%  { transform: translateY(-5px); }
  70%  { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

@keyframes ringAlert {
  0%   { transform: rotate(0deg); }
  10%  { transform: rotate(-15deg); }
  20%  { transform: rotate(15deg); }
  30%  { transform: rotate(-10deg); }
  40%  { transform: rotate(10deg); }
  50%  { transform: rotate(-5deg); }
  60%  { transform: rotate(5deg); }
  100% { transform: rotate(0deg); }
}

/* === CLASES DE ANIMACIÓN === */

.animate-fade-in       { animation: fadeIn var(--transition) forwards; }
.animate-fade-in-up    { animation: fadeInUp 0.5s ease forwards; }
.animate-fade-in-down  { animation: fadeInDown 0.5s ease forwards; }
.animate-slide-up      { animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.animate-scale-in      { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.animate-bounce-in     { animation: bounceIn 0.6s ease forwards; }
.animate-pulse         { animation: pulse 2s ease-in-out infinite; }
.animate-pulsate       { animation: pulsate 2s ease infinite; }
.animate-spin          { animation: spin 1s linear infinite; }
.animate-float         { animation: float 3s ease-in-out infinite; }
.animate-glow          { animation: glowPulse 2s ease-in-out infinite; }
.animate-shimmer       {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
  background-size: 200% auto;
  animation: shimmer 1.8s linear infinite;
}
.animate-ring          { animation: ringAlert 1s ease 0.5s; }
.animate-radar         { animation: radarPing 1.5s ease-out infinite; }

/* === DELAYS === */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-700 { animation-delay: 0.7s; }
.delay-1000 { animation-delay: 1s; }

/* === SKELETON LOADING === */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-black-4) 0%,
    var(--color-black-5) 50%,
    var(--color-black-4) 100%
  );
  background-size: 200% auto;
  animation: shimmer 1.5s linear infinite;
  border-radius: var(--border-radius);
}

.skeleton-text  { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-btn   { height: 44px; border-radius: var(--border-radius-full); }
.skeleton-card  { height: 120px; }

/* === LOADER VIAZU === */
.viazu-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.viazu-loader span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.viazu-loader span:nth-child(1) { animation-delay: 0s; }
.viazu-loader span:nth-child(2) { animation-delay: 0.2s; }
.viazu-loader span:nth-child(3) { animation-delay: 0.4s; }

/* === SPINNER CIRCULAR === */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-white-10);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm { width: 24px; height: 24px; border-width: 2px; }
.spinner-lg { width: 60px; height: 60px; border-width: 4px; }

/* === RIPPLE EFFECT === */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple-container::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.15);
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.ripple-container.rippling::after {
  animation: ripple 0.6s linear;
}

/* === TRANSITION GROUPS === */
.transition-enter    { opacity: 0; transform: translateY(10px); }
.transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.transition-exit     { opacity: 1; }
.transition-exit-active  {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* === HOVER EFFECTS === */
.hover-lift {
  transition: transform var(--transition), box-shadow var(--transition);
}
.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.hover-scale {
  transition: transform var(--transition);
}
.hover-scale:hover { transform: scale(1.03); }

.hover-glow {
  transition: box-shadow var(--transition);
}
.hover-glow:hover {
  box-shadow: var(--shadow-green);
}

/* === ACTIVE PRESS EFFECT === */
.press-effect {
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  cursor: pointer;
}
.press-effect:active {
  transform: scale(0.97);
  box-shadow: none;
}

/* === STAGGER ANIMATIONS === */
.stagger-container > * {
  opacity: 0;
  transform: translateY(20px);
}

.stagger-container.animated > *:nth-child(1) { animation: fadeInUp 0.5s 0.1s ease forwards; }
.stagger-container.animated > *:nth-child(2) { animation: fadeInUp 0.5s 0.2s ease forwards; }
.stagger-container.animated > *:nth-child(3) { animation: fadeInUp 0.5s 0.3s ease forwards; }
.stagger-container.animated > *:nth-child(4) { animation: fadeInUp 0.5s 0.4s ease forwards; }
.stagger-container.animated > *:nth-child(5) { animation: fadeInUp 0.5s 0.5s ease forwards; }
.stagger-container.animated > *:nth-child(6) { animation: fadeInUp 0.5s 0.6s ease forwards; }

/* === MAP ANIMATIONS === */
.map-marker-bounce { animation: mapMarkerBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

.radar-pulse::before,
.radar-pulse::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  animation: radarPing 2s ease-out infinite;
}
.radar-pulse::after { animation-delay: 1s; }

/* === SOS BUTTON ANIMATION === */
.sos-btn {
  animation: pulsate 1.5s ease infinite;
  background: var(--color-danger) !important;
}

/* === VEHICLE ANIMATION === */
.vehicle-icon {
  animation: float 2s ease-in-out infinite;
  filter: drop-shadow(0 8px 15px rgba(0,200,83,0.4));
}

/* === STATUS DOT === */
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulsate 2s ease infinite;
}

.status-dot.offline { background: var(--color-white-40); animation: none; }
.status-dot.busy    { background: var(--color-warning); }

/* === NOTIFICATION BELL === */
.bell-animate { animation: ringAlert 0.8s ease; }

/* === PAGE TRANSITIONS === */
.page-enter {
  animation: fadeIn 0.4s ease forwards;
}
.page-exit {
  animation: scaleOut 0.3s ease forwards;
}
