/* ================================================
   BAZAAR - Advanced Animations & Micro-interactions
   Creative Professional Enhancements
   ================================================ */

/* ===== Glassmorphism Effects ===== */
.glass-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .glass-card {
  background: rgba(26, 26, 58, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.15);
}

[data-theme="light"] .glass-card {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.1);
}

/* ===== Neumorphism Elements ===== */
.neu-btn {
  background: var(--card-bg);
  box-shadow: 
    8px 8px 16px rgba(0, 0, 0, 0.1),
    -8px -8px 16px rgba(255, 255, 255, 0.05);
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.neu-btn:hover {
  box-shadow: 
    4px 4px 8px rgba(0, 0, 0, 0.15),
    -4px -4px 8px rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.neu-btn:active {
  box-shadow: 
    inset 4px 4px 8px rgba(0, 0, 0, 0.1),
    inset -4px -4px 8px rgba(255, 255, 255, 0.05);
  transform: translateY(0);
}

/* ===== Magnetic Button Effect ===== */
.magnetic-btn {
  position: relative;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.magnetic-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--primary), var(--gold), var(--primary));
  border-radius: inherit;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s;
  animation: borderRotate 3s linear infinite;
}

.magnetic-btn:hover::before {
  opacity: 1;
}

@keyframes borderRotate {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ===== Floating Particles Background ===== */
.particles-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: -1;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 15s infinite ease-in-out;
}

.particle:nth-child(2n) {
  background: var(--gold);
  animation-delay: -5s;
  animation-duration: 20s;
}

.particle:nth-child(3n) {
  background: var(--success);
  animation-delay: -10s;
  animation-duration: 18s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.3;
  }
  90% {
    opacity: 0.3;
  }
  100% {
    transform: translateY(-100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ===== 3D Card Tilt Effect ===== */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tilt-card:hover {
  transform: rotateX(5deg) rotateY(5deg) translateZ(20px);
}

.tilt-card-content {
  transform: translateZ(30px);
}

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

.ripple::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.3) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10, 10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.5s;
}

.ripple:active::after {
  transform: scale(0, 0);
  opacity: 0.3;
  transition: 0s;
}

/* ===== Shimmer Loading Effect ===== */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ===== Morphing Shape Animation ===== */
.morph-shape {
  animation: morph 8s ease-in-out infinite;
}

@keyframes morph {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
  }
  50% {
    border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
  }
}

/* ===== Text Gradient Animation ===== */
.gradient-text {
  background: linear-gradient(
    90deg,
    var(--primary),
    var(--gold),
    var(--primary)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientText 3s linear infinite;
}

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

/* ===== Pulse Glow Effect ===== */
.pulse-glow {
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  }
  50% {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.8), 0 0 60px rgba(245, 158, 11, 0.4);
  }
}

/* ===== Bounce In Animation ===== */
.bounce-in {
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== Slide Up Stagger ===== */
.slide-up-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  animation: slideUp 0.6s ease forwards;
}

.slide-up-stagger > *:nth-child(1) { animation-delay: 0.1s; }
.slide-up-stagger > *:nth-child(2) { animation-delay: 0.2s; }
.slide-up-stagger > *:nth-child(3) { animation-delay: 0.3s; }
.slide-up-stagger > *:nth-child(4) { animation-delay: 0.4s; }
.slide-up-stagger > *:nth-child(5) { animation-delay: 0.5s; }

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

/* ===== Typewriter Effect ===== */
.typewriter {
  overflow: hidden;
  border-right: 3px solid var(--gold);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

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

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--gold); }
}

/* ===== Counter Animation ===== */
.counter {
  display: inline-block;
  animation: countUp 2s ease-out forwards;
}

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

/* ===== Hover Lift Effect ===== */
.hover-lift {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* ===== Icon Spin on Hover ===== */
.icon-spin:hover svg {
  animation: iconSpin 0.6s ease-in-out;
}

@keyframes iconSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Scale on Click ===== */
.scale-click {
  transition: transform 0.1s ease;
}

.scale-click:active {
  transform: scale(0.95);
}

/* ===== Wave Animation ===== */
.wave {
  position: relative;
}

.wave::before,
.wave::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: inherit;
  border-radius: inherit;
  z-index: -1;
}

.wave::before {
  animation: wave 3s ease-in-out infinite;
}

.wave::after {
  animation: wave 3s ease-in-out infinite;
  animation-delay: -1.5s;
}

@keyframes wave {
  0%, 100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.1);
    opacity: 0;
  }
}

/* ===== Glitch Effect ===== */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  animation: glitch-1 2s infinite linear alternate-reverse;
  color: var(--primary);
  z-index: -1;
}

.glitch::after {
  animation: glitch-2 3s infinite linear alternate-reverse;
  color: var(--gold);
  z-index: -2;
}

@keyframes glitch-1 {
  0%, 100% {
    clip-path: inset(0 0 95% 0);
    transform: translate(-2px, 2px);
  }
  20% {
    clip-path: inset(30% 0 40% 0);
    transform: translate(2px, -2px);
  }
  40% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(-2px, 2px);
  }
  60% {
    clip-path: inset(70% 0 10% 0);
    transform: translate(2px, -2px);
  }
  80% {
    clip-path: inset(10% 0 60% 0);
    transform: translate(-2px, 2px);
  }
}

@keyframes glitch-2 {
  0%, 100% {
    clip-path: inset(95% 0 0 0);
    transform: translate(2px, -2px);
  }
  20% {
    clip-path: inset(40% 0 30% 0);
    transform: translate(-2px, 2px);
  }
  40% {
    clip-path: inset(30% 0 50% 0);
    transform: translate(2px, -2px);
  }
  60% {
    clip-path: inset(10% 0 70% 0);
    transform: translate(-2px, 2px);
  }
  80% {
    clip-path: inset(60% 0 10% 0);
    transform: translate(2px, -2px);
  }
}

/* ===== Smooth Scroll Indicator ===== */
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  animation: scrollBounce 2s infinite;
}

@keyframes scrollBounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-20px);
  }
  60% {
    transform: translateX(-50%) translateY(-10px);
  }
}

/* ===== Loading Dots ===== */
.loading-dots {
  display: inline-flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: 50%;
  animation: loadingDot 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

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

/* ===== Progress Ring ===== */
.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
  transform-origin: 50% 50%;
}

/* ===== Notification Badge Animation ===== */
.notification-badge {
  animation: badgePop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes badgePop {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

/* ===== Card Flip Effect ===== */
.flip-card {
  perspective: 1000px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-card-back {
  transform: rotateY(180deg);
}

/* ===== Spotlight Effect ===== */
.spotlight {
  position: relative;
  overflow: hidden;
}

.spotlight::before {
  content: '';
  position: absolute;
  top: var(--y, 50%);
  left: var(--x, 50%);
  width: 300px;
  height: 300px;
  background: radial-gradient(
    circle,
    rgba(99, 102, 241, 0.15) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.spotlight:hover::before {
  opacity: 1;
}

/* ===== Text Reveal Animation ===== */
.text-reveal {
  overflow: hidden;
}

.text-reveal span {
  display: inline-block;
  transform: translateY(100%);
  animation: textReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes textReveal {
  to {
    transform: translateY(0);
  }
}

/* ===== Morphing Border ===== */
.morphing-border {
  position: relative;
}

.morphing-border::before {
  content: '';
  position: absolute;
  inset: -3px;
  background: linear-gradient(45deg, var(--primary), var(--gold), var(--success), var(--primary));
  border-radius: inherit;
  z-index: -1;
  animation: morphingBorder 4s linear infinite;
  background-size: 400% 400%;
}

@keyframes morphingBorder {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ===== Elastic Button ===== */
.elastic-btn {
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.elastic-btn:hover {
  transform: scale(1.05);
}

.elastic-btn:active {
  transform: scale(0.95);
}

/* ===== Skeleton Screen ===== */
.skeleton-screen {
  background: linear-gradient(
    90deg,
    var(--subtle) 25%,
    var(--border) 50%,
    var(--subtle) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
}

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

/* ===== Success Checkmark Animation ===== */
.checkmark-animation {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: var(--success);
  stroke-miterlimit: 10;
  animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-animation circle {
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-width: 2;
  stroke-miterlimit: 10;
  fill: none;
  animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-animation path {
  transform-origin: 50% 50%;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

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

@keyframes scale {
  0%, 100% { transform: none; }
  50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
  100% { box-shadow: inset 0px 0px 0px 50px rgba(16, 185, 129, 0.1); }
}

/* ===== Floating Action Button ===== */
.fab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.fab:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

/* ===== Tooltip Animation ===== */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 8px 12px;
  background: var(--dark-800);
  color: white;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* ===== Marquee Animation ===== */
.marquee {
  overflow: hidden;
  white-space: nowrap;
}

.marquee-content {
  display: inline-block;
  animation: marquee 20s linear infinite;
}

@keyframes marquee {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ===== Parallax Effect ===== */
.parallax {
  transform: translateZ(0);
  will-change: transform;
}

/* ===== Image Zoom on Hover ===== */
.img-zoom {
  overflow: hidden;
}

.img-zoom img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-zoom:hover img {
  transform: scale(1.15);
}

/* ===== Accordion Animation ===== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-content.active {
  max-height: 500px;
}

/* ===== Tab Animation ===== */
.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

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

/* ===== Rating Stars Animation ===== */
.star-rating {
  display: inline-flex;
  gap: 4px;
}

.star-rating span {
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
}

.star-rating span:hover {
  transform: scale(1.3);
  color: var(--gold);
}

/* ===== Progress Bar Animation ===== */
.progress-bar {
  height: 8px;
  background: var(--subtle);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--gold));
  border-radius: 4px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(99, 102, 241, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.8);
  }
}

/* ===== Notification Slide ===== */
.notification-slide {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.notification-slide.hide {
  animation: slideOutRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ===== Responsive Animations ===== */
@media (max-width: 768px) {
  .tilt-card:hover {
    transform: none;
  }
  
  .hover-lift:hover {
    transform: translateY(-5px);
  }
  
  .fab {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 20px;
    right: 20px;
  }
}

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