/* ═══════════════════════════════════════════════
   LifeSync – animations.css
   Keyframes, transitions, micro-animations
   ═══════════════════════════════════════════════ */

/* ─── Base Keyframes ─── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

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

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

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

@keyframes toastIn {
  from { opacity: 0; transform: translateX(60px) scale(0.9); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(60px) scale(0.9); }
}

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

/* ─── Task Complete Tick Animation ─── */
@keyframes tickPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.85); }
  70%  { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes taskComplete {
  0%   { background-color: transparent; }
  30%  { background-color: rgba(16,185,129,0.08); }
  100% { background-color: transparent; }
}

.task-card.completing {
  animation: taskComplete 0.5s ease;
}

.task-checkbox.checking {
  animation: tickPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Skeleton Shimmer ─── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

/* ─── Pulse Glow (for today indicator) ─── */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(99,102,241,0.4); }
  50%       { box-shadow: 0 0 20px rgba(99,102,241,0.7); }
}

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

.today-pulse {
  animation: pulseGlow 2s ease-in-out infinite;
}

/* ─── Streak Fire Animation ─── */
@keyframes firePop {
  0%, 100% { transform: scale(1) rotate(-3deg); }
  50%       { transform: scale(1.15) rotate(3deg); }
}

.streak-fire {
  display: inline-block;
  animation: firePop 2s ease-in-out infinite;
}

/* ─── Floating Action Button Pulse ─── */
@keyframes fabPulse {
  0%   { box-shadow: 0 2px 12px rgba(99,102,241,0.4); }
  50%  { box-shadow: 0 4px 24px rgba(99,102,241,0.7); }
  100% { box-shadow: 0 2px 12px rgba(99,102,241,0.4); }
}

/* ─── View Transitions ─── */
.view {
  animation: fadeIn 0.2s ease;
}

/* ─── Task List Entrance ─── */
.task-card {
  animation: slideUp 0.2s ease both;
}

.task-card:nth-child(1) { animation-delay: 0ms; }
.task-card:nth-child(2) { animation-delay: 30ms; }
.task-card:nth-child(3) { animation-delay: 60ms; }
.task-card:nth-child(4) { animation-delay: 90ms; }
.task-card:nth-child(5) { animation-delay: 120ms; }
.task-card:nth-child(n+6) { animation-delay: 150ms; }

/* ─── Stat Card Entrance ─── */
.stat-card {
  animation: slideUp 0.3s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }
.stat-card:nth-child(4) { animation-delay: 180ms; }

/* ─── Week Day Column Entrance ─── */
.week-day-col {
  animation: slideUp 0.3s ease both;
}

.week-day-col:nth-child(1) { animation-delay: 0ms; }
.week-day-col:nth-child(2) { animation-delay: 40ms; }
.week-day-col:nth-child(3) { animation-delay: 80ms; }
.week-day-col:nth-child(4) { animation-delay: 120ms; }
.week-day-col:nth-child(5) { animation-delay: 160ms; }
.week-day-col:nth-child(6) { animation-delay: 200ms; }
.week-day-col:nth-child(7) { animation-delay: 240ms; }

/* ─── Confetti (JS-driven, canvas) ─── */
/* Canvas positioned globally in HTML */

/* ─── Progress Ring Spin on Load ─── */
@keyframes ringAppear {
  from {
    stroke-dashoffset: 314.16;
    opacity: 0;
  }
}

.ring-fill {
  animation: ringAppear 0s ease;
}

/* ─── Hover Lift ─── */
.hover-lift {
  transition: transform var(--trans-normal), box-shadow var(--trans-normal);
}

.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* ─── Ripple Effect ─── */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  width: 100px; height: 100px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
  animation: rippleAnim 0.4s ease;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ─── Notification Bell Shake ─── */
@keyframes bellShake {
  0%   { transform: rotate(0); }
  15%  { transform: rotate(15deg); }
  30%  { transform: rotate(-12deg); }
  45%  { transform: rotate(10deg); }
  60%  { transform: rotate(-8deg); }
  75%  { transform: rotate(5deg); }
  90%  { transform: rotate(-3deg); }
  100% { transform: rotate(0); }
}

.bell-shake {
  animation: bellShake 0.6s ease;
}
