/* ======================================
   towFlow v2 - Animations
   ====================================== */

/* ======= Page Transitions ======= */
.screen-transition-enter {
    animation: screenEnter 300ms ease-out forwards;
  }
  
  @keyframes screenEnter {
    from {
      opacity: 0;
      transform: translateX(20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  .screen-transition-exit {
    animation: screenExit 300ms ease-in forwards;
  }
  
  @keyframes screenExit {
    from {
      opacity: 1;
      transform: translateX(0);
    }
    to {
      opacity: 0;
      transform: translateX(-20px);
    }
  }
  
  /* ======= Card Animations ======= */
  .card-enter {
    animation: cardEnter 400ms ease-out backwards;
  }
  
  @keyframes cardEnter {
    from {
      opacity: 0;
      transform: translateY(30px) scale(0.95);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
  
  .card-press {
    animation: cardPress 150ms ease-out;
  }
  
  @keyframes cardPress {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(0.98);
    }
  }
  
  /* ======= Swipe Animations ======= */
  .swipe-hint {
    animation: swipeHint 2s ease-in-out 1s;
  }
  
  @keyframes swipeHint {
    0%, 100% {
      transform: translateX(0);
    }
    25% {
      transform: translateX(-10px);
    }
    75% {
      transform: translateX(10px);
    }
  }
  
  .swipe-left {
    animation: swipeLeft 300ms ease-out forwards;
  }
  
  @keyframes swipeLeft {
    to {
      transform: translateX(-100%);
      opacity: 0;
    }
  }
  
  .swipe-right {
    animation: swipeRight 300ms ease-out forwards;
  }
  
  @keyframes swipeRight {
    to {
      transform: translateX(100%);
      opacity: 0;
    }
  }
  
  /* ======= Progress Animations ======= */
  .progress-complete {
    animation: progressComplete 500ms ease-out;
  }
  
  @keyframes progressComplete {
    0% {
      transform: scale(1);
    }
    50% {
      transform: scale(1.2);
    }
    100% {
      transform: scale(1);
    }
  }
  
  .progress-line-fill {
    animation: progressLineFill 300ms ease-out forwards;
  }
  
  @keyframes progressLineFill {
    from {
      width: 0;
    }
    to {
      width: 100%;
    }
  }
  
  /* ======= Button Animations ======= */
  .button-tap {
    animation: buttonTap 200ms ease-out;
  }
  
  @keyframes buttonTap {
    0%, 100% {
      transform: scale(1);
    }
    50% {
      transform: scale(0.95);
    }
  }
  
  .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0);
    animation: rippleEffect 600ms ease-out;
    pointer-events: none;
  }
  
  @keyframes rippleEffect {
    to {
      transform: scale(4);
      opacity: 0;
    }
  }
  
  /* ======= FAB Animations ======= */
  .fab-enter {
    animation: fabEnter 300ms ease-out 500ms backwards;
  }
  
  @keyframes fabEnter {
    from {
      opacity: 0;
      transform: scale(0) rotate(-180deg);
    }
    to {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }
  }
  
  .fab-tap {
    animation: fabTap 300ms ease-out;
  }
  
  @keyframes fabTap {
    0%, 100% {
      transform: scale(1) rotate(0deg);
    }
    50% {
      transform: scale(1.1) rotate(90deg);
    }
  }
  
  /* ======= Success Animations ======= */
  .success-checkmark {
    animation: successCheckmark 500ms ease-out;
  }
  
  @keyframes successCheckmark {
    0% {
      transform: scale(0) rotate(-45deg);
      opacity: 0;
    }
    50% {
      transform: scale(1.2) rotate(-45deg);
    }
    100% {
      transform: scale(1) rotate(0deg);
      opacity: 1;
    }
  }
  
  .success-circle {
    animation: successCircle 500ms ease-out;
  }
  
  @keyframes successCircle {
    from {
      stroke-dashoffset: 100;
      opacity: 0;
    }
    to {
      stroke-dashoffset: 0;
      opacity: 1;
    }
  }
  
  /* ======= Photo Capture Animations ======= */
  .camera-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    pointer-events: none;
    animation: cameraFlash 300ms ease-out;
  }
  
  @keyframes cameraFlash {
    0% {
      opacity: 0;
    }
    50% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
  
  .photo-preview-enter {
    animation: photoPreviewEnter 400ms ease-out;
  }
  
  @keyframes photoPreviewEnter {
    from {
      opacity: 0;
      transform: scale(0.8) rotate(5deg);
    }
    to {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }
  }
  
  /* ======= AR Guide Animations ======= */
  .ar-corner-pulse {
    animation: arCornerPulse 2s ease-in-out infinite;
  }
  
  @keyframes arCornerPulse {
    0%, 100% {
      opacity: 0.5;
      transform: scale(1);
    }
    50% {
      opacity: 1;
      transform: scale(1.05);
    }
  }
  
  .ar-scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, 
      transparent 0%, 
      rgba(253, 162, 6, 0.8) 50%, 
      transparent 100%);
    animation: arScanLine 2s linear infinite;
  }
  
  @keyframes arScanLine {
    from {
      top: 0;
    }
    to {
      top: 100%;
    }
  }
  
  /* ======= Loading Animations ======= */
  .skeleton-shimmer {
    background: linear-gradient(90deg, 
      #f0f0f0 0%, 
      #f8f8f8 50%, 
      #f0f0f0 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
  }
  
  @keyframes shimmer {
    from {
      background-position: -200% 0;
    }
    to {
      background-position: 200% 0;
    }
  }
  
  .dots-loading {
    display: inline-flex;
    gap: 4px;
  }
  
  .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-blue);
    animation: dotPulse 1.4s ease-in-out infinite;
  }
  
  .dot:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .dot:nth-child(3) {
    animation-delay: 0.4s;
  }
  
  @keyframes dotPulse {
    0%, 80%, 100% {
      opacity: 0.3;
      transform: scale(1);
    }
    40% {
      opacity: 1;
      transform: scale(1.5);
    }
  }
  
  /* ======= Micro Interactions ======= */
  .hover-lift {
    transition: transform 200ms ease-out, box-shadow 200ms ease-out;
  }
  
  .hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  .hover-grow {
    transition: transform 200ms ease-out;
  }
  
  .hover-grow:hover {
    transform: scale(1.05);
  }
  
  .focus-ring {
    transition: box-shadow 200ms ease-out;
  }
  
  .focus-ring:focus {
    box-shadow: 0 0 0 3px rgba(30, 44, 102, 0.3);
    outline: none;
  }
  
  /* ======= Status Change Animations ======= */
  .status-change {
    animation: statusChange 600ms ease-out;
  }
  
  @keyframes statusChange {
    0% {
      transform: scale(1);
    }
    30% {
      transform: scale(0.95);
    }
    60% {
      transform: scale(1.05);
    }
    100% {
      transform: scale(1);
    }
  }
  
  .status-badge-update {
    animation: badgeUpdate 400ms ease-out;
  }
  
  @keyframes badgeUpdate {
    0% {
      background-color: var(--primary-yellow);
    }
    50% {
      background-color: var(--status-new);
      transform: scale(1.1);
    }
    100% {
      transform: scale(1);
    }
  }
  
  /* ======= Navigation Animations ======= */
  .nav-slide-in {
    animation: navSlideIn 300ms ease-out;
  }
  
  @keyframes navSlideIn {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(0);
    }
  }
  
  .nav-slide-out {
    animation: navSlideOut 300ms ease-in forwards;
  }
  
  @keyframes navSlideOut {
    from {
      transform: translateX(0);
    }
    to {
      transform: translateX(-100%);
    }
  }
  
  /* ======= Form Animations ======= */
  .form-error-shake {
    animation: errorShake 500ms ease-out;
  }
  
  @keyframes errorShake {
    0%, 100% {
      transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
      transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
      transform: translateX(5px);
    }
  }
  
  .input-success {
    animation: inputSuccess 400ms ease-out;
  }
  
  @keyframes inputSuccess {
    from {
      border-color: var(--border);
    }
    to {
      border-color: var(--status-new);
    }
  }
  
  /* ======= Scroll Animations ======= */
  .fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 400ms ease-out forwards;
  }
  
  @keyframes fadeInUp {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .stagger-animation > * {
    opacity: 0;
    animation: fadeInUp 400ms ease-out forwards;
  }
  
  .stagger-animation > *:nth-child(1) { animation-delay: 0ms; }
  .stagger-animation > *:nth-child(2) { animation-delay: 50ms; }
  .stagger-animation > *:nth-child(3) { animation-delay: 100ms; }
  .stagger-animation > *:nth-child(4) { animation-delay: 150ms; }
  .stagger-animation > *:nth-child(5) { animation-delay: 200ms; }
  
  /* ======= Pull to Refresh ======= */
  .pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 300ms ease-out;
  }
  
  .pull-to-refresh.pulling {
    transform: translateX(-50%) translateY(60px);
  }
  
  .pull-to-refresh.refreshing {
    animation: pullRefreshSpin 1s linear infinite;
  }
  
  @keyframes pullRefreshSpin {
    from {
      transform: translateX(-50%) translateY(60px) rotate(0deg);
    }
    to {
      transform: translateX(-50%) translateY(60px) rotate(360deg);
    }
  }
  
  /* ======= Performance Optimizations ======= */
  .hardware-accelerated {
    transform: translateZ(0);
    will-change: transform;
  }
  
  .disable-animations * {
    animation-duration: 0s !important;
    transition-duration: 0s !important;
  }