/* ═══════════════════════════════════════════════════════════════════════════
   D-DEY PMS — ANIMATIONS & MICRO-INTERACTIONS v4.0
   Phase 3: Page transitions, loading states, Apple-grade smoothness
═══════════════════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════
   PAGE TRANSITION SYSTEM
   Tab switching feels like native iOS app
══════════════════════════════════════════════════════ */

/* Pages hidden state */
.page-view.hidden {
  display: none !important;
}

/* Page entering from right (forward navigation) */
@keyframes pageSlideInRight {
  from {
    opacity: 0;
    transform: translateX(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Page entering from left (back navigation) */
@keyframes pageSlideInLeft {
  from {
    opacity: 0;
    transform: translateX(-18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Default page entry */
.page-view {
  animation: pageSlideInRight 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform, opacity;
  transform-origin: center;
  backface-visibility: hidden;
}

/* ══════════════════════════════════════════════════════
   STAGGERED LIST ITEM ANIMATIONS
══════════════════════════════════════════════════════ */
@keyframes itemFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cart items stagger */
.cart-item:nth-child(1) { animation-delay: 0ms; }
.cart-item:nth-child(2) { animation-delay: 40ms; }
.cart-item:nth-child(3) { animation-delay: 80ms; }
.cart-item:nth-child(4) { animation-delay: 120ms; }
.cart-item:nth-child(5) { animation-delay: 160ms; }

/* Profile cards stagger */
.profile-card-group:nth-child(1) { animation: itemFadeUp 0.32s cubic-bezier(0.22,1,0.36,1) 0ms both; }
.profile-card-group:nth-child(2) { animation: itemFadeUp 0.32s cubic-bezier(0.22,1,0.36,1) 60ms both; }
.profile-card-group:nth-child(3) { animation: itemFadeUp 0.32s cubic-bezier(0.22,1,0.36,1) 120ms both; }
.profile-header-card { animation: itemFadeUp 0.40s cubic-bezier(0.22,1,0.36,1) 0ms both; }

/* ══════════════════════════════════════════════════════
   PRESS FEEDBACK — haptic-like visual response
══════════════════════════════════════════════════════ */
.press-feedback {
  transition: transform 100ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 100ms ease;
  backface-visibility: hidden;
}
.press-feedback:active {
  transform: scale(0.96);
  opacity: 0.88;
}

/* ══════════════════════════════════════════════════════
   RIPPLE EFFECT — Material-like but subtle
══════════════════════════════════════════════════════ */
@keyframes rippleExpand {
  from {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.3;
  }
  to {
    transform: translate(-50%, -50%) scale(4);
    opacity: 0;
  }
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(13,148,136,0.25);
  width: 60px; height: 60px;
  animation: rippleExpand 0.5s ease-out both;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════
   COUNTER / NUMBER ANIMATION
══════════════════════════════════════════════════════ */
@keyframes countUp {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.count-animate {
  animation: countUp 0.3s cubic-bezier(0.22,1,0.36,1) both;
  display: inline-block;
}

/* ══════════════════════════════════════════════════════
   LIVE PULSE INDICATOR
══════════════════════════════════════════════════════ */
.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  animation: livePulse 1.8s ease infinite;
}

/* ══════════════════════════════════════════════════════
   MODAL ENTRY VARIANTS
══════════════════════════════════════════════════════ */
@keyframes modalScaleUp {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(16px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

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

.modal-scale-in {
  animation: modalScaleUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.sheet-slide-up {
  animation: sheetSlideUp 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ══════════════════════════════════════════════════════
   WIZARD STEP TRANSITIONS
══════════════════════════════════════════════════════ */
@keyframes wizStepIn {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes wizStepOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-24px);
  }
}

.wiz-step-content.wiz-step-active {
  animation: wizStepIn 0.28s cubic-bezier(0.22,1,0.36,1) both;
}

/* ══════════════════════════════════════════════════════
   BOTTOM NAV TAP ANIMATION
══════════════════════════════════════════════════════ */
@keyframes navIconBounce {
  0%   { transform: translateY(0) scale(1); }
  40%  { transform: translateY(-5px) scale(1.15); }
  70%  { transform: translateY(1px) scale(0.95); }
  100% { transform: translateY(0) scale(1); }
}

.nav-item.just-activated .material-icons-outlined {
  animation: navIconBounce 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ══════════════════════════════════════════════════════
   SEARCH BAR EXPANSION
══════════════════════════════════════════════════════ */
@keyframes searchFocus {
  from { box-shadow: var(--shadow-sm); }
  to { box-shadow: var(--shadow-sm), var(--glow-teal); }
}

.search-box:focus-within {
  animation: searchFocus 0.2s ease both;
}

/* ══════════════════════════════════════════════════════
   SCAN BUTTON PULSE (when actively scanning)
══════════════════════════════════════════════════════ */
@keyframes scanPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13,148,136,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(13,148,136,0); }
}

.scan-trigger.scanning {
  animation: scanPulse 1.2s ease infinite;
  background: rgba(13,148,136,0.20) !important;
  color: var(--primary) !important;
}

/* ══════════════════════════════════════════════════════
   KPI CARD NUMBER COUNT UP ANIMATION
══════════════════════════════════════════════════════ */
@keyframes kpiReveal {
  from {
    opacity: 0;
    transform: translateY(6px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

#total-sales-amount, #total-orders-count {
  animation: kpiReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

/* ══════════════════════════════════════════════════════
   EXPIRY / STATUS SCREEN ANIMATIONS
══════════════════════════════════════════════════════ */
@keyframes expiryIconBounce {
  0%   { transform: scale(0) rotate(-10deg); }
  60%  { transform: scale(1.15) rotate(3deg); }
  80%  { transform: scale(0.95) rotate(-1deg); }
  100% { transform: scale(1) rotate(0); }
}

.expiry-icon-animated {
  animation: expiryIconBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

/* ══════════════════════════════════════════════════════
   TABLE ROW HOVER TRANSITION
══════════════════════════════════════════════════════ */
#inventory-table tbody tr {
  transition: background var(--t-fast) ease;
}

/* ══════════════════════════════════════════════════════
   FILTER PILL ACTIVE TRANSITION
══════════════════════════════════════════════════════ */
.filter-btn, .an-filter-pill {
  transition:
    background var(--t-base) var(--ease-out),
    color var(--t-base),
    border-color var(--t-base),
    box-shadow var(--t-base),
    transform var(--t-fast) var(--ease-spring);
}

.filter-btn:active, .an-filter-pill:active {
  transform: scale(0.95);
}

/* ══════════════════════════════════════════════════════
   INPUT FLOAT LABEL ANIMATION (future enhancement)
══════════════════════════════════════════════════════ */
@keyframes labelFloat {
  from { transform: translateY(0) scale(1); color: var(--text-light); }
  to { transform: translateY(-20px) scale(0.82); color: var(--primary); }
}

/* ══════════════════════════════════════════════════════
   PROGRESS BAR ANIMATION
══════════════════════════════════════════════════════ */
@keyframes progressFill {
  from { width: 0%; }
  to { width: var(--progress-width, 100%); }
}

.ds-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.ds-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--brand-sky));
  border-radius: var(--radius-full);
  animation: progressFill 0.8s cubic-bezier(0.22,1,0.36,1) 0.3s both;
}

/* ══════════════════════════════════════════════════════
   REDUCE MOTION ACCESSIBILITY
══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════
   SMOOTH CARD HOVER LIFT
══════════════════════════════════════════════ */
.glass-card,
.modal-box,
.profile-card,
.billing-left-card,
.billing-right-card,
.table-wrapper {
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.18s ease;
  will-change: transform;
  backface-visibility: hidden;
}

/* ══════════════════════════════════════════════
   SMOOTH OVERLAY BACKDROP
══════════════════════════════════════════════ */
.modal-overlay {
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

