/* === Promptua Animations === */

/* 1. Text shimmer gradient effect for headings */
@keyframes text-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.shimmer-text {
  background: linear-gradient(90deg, var(--dark-navy) 0%, var(--primary) 25%, var(--accent) 50%, var(--primary) 75%, var(--dark-navy) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: text-shimmer 4s ease-in-out infinite;
}

/* 2. Gradient background shift */
@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* 3. Fade in up (enhanced with different distances) */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 4. Scale in */
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* 5. Counter number roll up */
@keyframes countUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 6. Confetti burst for success pages */
@keyframes confetti-fall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* 7. Animated checkmark draw */
@keyframes checkmark-draw {
  0% { stroke-dashoffset: 100; }
  100% { stroke-dashoffset: 0; }
}

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

/* 8. Floating gradient orbs */
@keyframes float-orb-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

@keyframes float-orb-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-40px, 30px) scale(1.15); }
  66% { transform: translate(25px, -40px) scale(0.85); }
}

/* 9. Pulse ring for status indicators */
@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* 10. Button ripple */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.6; }
  100% { transform: scale(4); opacity: 0; }
}

/* 11. Typing dots */
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-8px); }
}

/* 12. Slide in from right (for toast) */
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* 13. Toast progress bar shrink */
@keyframes toast-progress {
  from { width: 100%; }
  to { width: 0%; }
}

/* 14. Reading progress bar */
@keyframes progress-grow {
  from { width: 0%; }
  to { width: var(--read-progress, 0%); }
}

/* 15. Gentle float for decorative elements */
@keyframes gentle-float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

/* 16. Skeleton loading shimmer */
@keyframes skeleton-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* === Animation utility classes === */
.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.animate-fade-in-down {
  animation: fadeInDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.animate-scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
.animate-float {
  animation: gentle-float 3s ease-in-out infinite;
}

/* Stagger delay utility */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }
.delay-6 { animation-delay: 0.6s; }
.delay-7 { animation-delay: 0.7s; }
.delay-8 { animation-delay: 0.8s; }

/* Scroll-triggered: hidden by default, visible when in viewport */
[data-animate] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}
[data-animate="scale"] {
  transform: scale(0.95);
}
[data-animate="scale"].is-visible {
  transform: scale(1);
}
[data-animate="left"] {
  transform: translateX(-24px);
}
[data-animate="left"].is-visible {
  transform: translateX(0);
}
[data-animate="right"] {
  transform: translateX(24px);
}
[data-animate="right"].is-visible {
  transform: translateX(0);
}

/* Confetti container */
.confetti-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

/* Animated checkmark SVG */
.animated-checkmark {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}
.animated-checkmark .circle {
  stroke: var(--success, #10B981);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 330;
  stroke-dashoffset: 330;
  animation: checkmark-circle 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.animated-checkmark .check {
  stroke: var(--success, #10B981);
  stroke-width: 3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: checkmark-draw 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.4s forwards;
}

/* Toast notification system */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--white, #fff);
  border: 1px solid var(--border, #E2E8F0);
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  position: relative;
  overflow: hidden;
}
.toast.removing {
  animation: slideOutRight 0.3s ease forwards;
}
.toast-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.toast-content {
  flex: 1;
}
.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--dark-navy, #0F172A);
  margin-bottom: 2px;
}
.toast-message {
  font-size: 0.8rem;
  color: var(--muted, #64748B);
}
.toast-close {
  background: none;
  border: none;
  color: var(--muted, #64748B);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.toast-close:hover { opacity: 1; }
.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 0 0 12px 12px;
  animation: toast-progress linear forwards;
}
.toast.success .toast-progress { background: var(--success, #10B981); }
.toast.error .toast-progress { background: var(--error, #EF4444); }
.toast.info .toast-progress { background: var(--primary, #3066FF); }
.toast.warning .toast-progress { background: #F59E0B; }

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  z-index: 10001;
  transition: width 0.1s linear;
  width: 0%;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* Button ripple effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}
.btn-ripple .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Scroll to top button */
.scroll-top-btn {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary, #3066FF);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(48,102,255,0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}
.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.scroll-top-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(48,102,255,0.4);
}
.scroll-top-btn svg {
  width: 20px;
  height: 20px;
}

/* Availability indicator */
.availability-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  position: relative;
}
.availability-dot.online {
  background: var(--success, #10B981);
}
.availability-dot.online::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--success, #10B981);
  animation: pulse-ring 1.5s ease-out infinite;
}
.availability-dot.offline {
  background: var(--muted, #94A3B8);
}

/* Animated counter */
.stat-counter {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.stat-counter .count-num {
  font-family: var(--font-head, 'Poppins', sans-serif);
  font-weight: 700;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  color: var(--primary, #3066FF);
  line-height: 1;
}
.stat-counter .count-suffix {
  font-weight: 700;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  color: var(--primary, #3066FF);
}
.stat-counter .count-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted, #64748B);
  font-weight: 500;
  margin-top: 4px;
}

/* Stats section */
.stats-strip {
  display: flex;
  justify-content: center;
  gap: clamp(24px, 5vw, 64px);
  padding: 32px 24px;
  margin-top: 48px;
  position: relative;
}
.stats-strip::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 80%);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border, #E2E8F0), transparent);
}
.stat-item {
  text-align: center;
}

@media (max-width: 600px) {
  .stats-strip {
    gap: 20px;
    flex-wrap: wrap;
  }
  .toast {
    min-width: unset;
    max-width: calc(100vw - 40px);
  }
}
