/*
 * Modern Faceted Search - Animation Styles
 * Transitions, scroll animations, and interactive effects
 */

/* ---------- Scroll Animations ---------- */
.anim-fade-in {
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.anim-fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.anim-fade-in-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.anim-slide-in-right {
  opacity: 0;
  transform: translateX(30px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.anim-slide-in-right.is-visible {
  opacity: 1;
  transform: translateX(0);
}

/* ---------- Stagger Delay for List Items ---------- */
.anim-fade-in-up:nth-child(1) {
  transition-delay: 0.1s;
}

.anim-fade-in-up:nth-child(2) {
  transition-delay: 0.2s;
}

.anim-fade-in-up:nth-child(3) {
  transition-delay: 0.3s;
}

.anim-fade-in-up:nth-child(4) {
  transition-delay: 0.4s;
}

.anim-fade-in-up:nth-child(5) {
  transition-delay: 0.5s;
}

/* ---------- Hover Effects ---------- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.hover-scale {
  transition: transform var(--transition-base);
}

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

/* ---------- Loading Spinner ---------- */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--indigo-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Skeleton Loading ---------- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--slate-200) 0%,
    var(--slate-100) 50%,
    var(--slate-200) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

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

/* ---------- Pulse Effect ---------- */
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ---------- Bounce Effect ---------- */
.bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* ---------- Slide In Animations ---------- */
.slide-in-bottom {
  animation: slide-in-bottom 0.5s ease-out;
}

@keyframes slide-in-bottom {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.slide-in-top {
  animation: slide-in-top 0.5s ease-out;
}

@keyframes slide-in-top {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ---------- Scale Animations ---------- */
.scale-in {
  animation: scale-in 0.3s ease-out;
}

@keyframes scale-in {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.scale-out {
  animation: scale-out 0.2s ease-in;
}

@keyframes scale-out {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(0.9);
    opacity: 0;
  }
}

/* ---------- Shake Animation (Error States) ---------- */
.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

/* ---------- Progress Bar Animation ---------- */
.progress-bar {
  position: relative;
  overflow: hidden;
  background-color: var(--slate-200);
  border-radius: var(--radius-full);
  height: 8px;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent,
    var(--indigo-700),
    transparent
  );
  animation: progress-indeterminate 1.5s ease-in-out infinite;
}

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

/* ---------- Ripple Effect (Click Feedback) ---------- */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
  width: 200px;
  height: 200px;
}

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

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 0 5px var(--primary-color),
                0 0 10px var(--primary-color);
  }
  50% {
    box-shadow: 0 0 20px var(--primary-color),
                0 0 30px var(--primary-color);
  }
}

/* ---------- Gradient Animation ---------- */
.gradient-shift {
  background: linear-gradient(
    270deg,
    var(--primary-color),
    var(--indigo-700),
    var(--primary-color)
  );
  background-size: 200% 200%;
  animation: gradient-shift 3s ease infinite;
}

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

/* ---------- Typewriter Effect ---------- */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--slate-800);
  white-space: nowrap;
  animation: typewriter 3.5s steps(40) 1s 1 normal both,
             blink 0.75s step-end infinite;
}

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

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

/* ---------- Attention Seeker ---------- */
.attention-seeker {
  animation: attention-seeker 1s ease-in-out;
}

@keyframes attention-seeker {
  0%,
  100% {
    transform: scale(1);
  }
  25% {
    transform: scale(1.1);
  }
  50% {
    transform: scale(0.9);
  }
  75% {
    transform: scale(1.05);
  }
}

/* ---------- Flip Animation ---------- */
.flip {
  animation: flip 0.6s ease-in-out;
}

@keyframes flip {
  0% {
    transform: perspective(400px) rotateY(0);
  }
  100% {
    transform: perspective(400px) rotateY(360deg);
  }
}

/* ---------- Smooth Scroll ---------- */
html {
  scroll-behavior: smooth;
}

/* Disable smooth scroll when user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Page Transition ---------- */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.2s ease-in, transform 0.2s ease-in;
}

/* ---------- Interactive State Transitions ---------- */
button,
a,
.interactive {
  transition: all var(--transition-base);
}

/* Smooth transition for all interactive elements */
input,
textarea,
select {
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base);
}

/* ---------- Focus Ring Animation ---------- */
@keyframes focus-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(67, 56, 202, 0.5);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(67, 56, 202, 0);
  }
}

:focus-visible {
  animation: focus-ring 0.4s ease-out;
}
