/**
 * แอนิเมชันและเอฟเฟกต์สำหรับระบบ Store Checklist
 */

/* Base Animation Variables */
:root {
  --animation-timing: cubic-bezier(0.165, 0.84, 0.44, 1);
  --animation-duration: 0.5s;
}

/* Animation for Card Loading & Entrance */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

/* Animation for Loading States */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

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

/* Animation for Progress Indicators */
@keyframes progressFill {
  from {
    width: 0%;
  }
}

@keyframes progressGlow {
  0% {
    box-shadow: 0 0 5px rgba(21, 101, 192, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(21, 101, 192, 0.4);
  }
  100% {
    box-shadow: 0 0 5px rgba(21, 101, 192, 0.2);
  }
}

@keyframes rotate360 {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Animation for Buttons & Interactions */
@keyframes buttonPush {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

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

/* Animation for Ripple Effect */
@keyframes ripple {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* Stagger Effect Classes */
.stagger-fade-in > * {
  opacity: 0;
  animation: fadeInUp var(--animation-duration) var(--animation-timing) forwards;
}

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

/* Apply Animations to Elements */
.fade-in {
  opacity: 0;
  animation: fadeInUp var(--animation-duration) var(--animation-timing) forwards;
}

.slide-in-right {
  opacity: 0;
  animation: slideInRight var(--animation-duration) var(--animation-timing) forwards;
}

.slide-in-left {
  opacity: 0;
  animation: slideInLeft var(--animation-duration) var(--animation-timing) forwards;
}

.zoom-in {
  opacity: 0;
  animation: zoomIn var(--animation-duration) var(--animation-timing) forwards;
}

/* Button Click Animation */
.btn-animated:active {
  animation: buttonPush 0.3s forwards;
}

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

.ripple-effect .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

/* Loading Shimmer Effect */
.shimmer-loading {
  position: relative;
  background: #f6f7f8;
  background: linear-gradient(90deg, 
    #f6f7f8 0%, #edeef1 20%, 
    #f6f7f8 40%, #f6f7f8 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Progress Bar Animation */
.animated-progress .progress-bar {
  animation: progressFill 1.2s ease-out forwards;
}

.animated-progress.glow .progress-bar {
  animation: progressFill 1.2s ease-out forwards, progressGlow 2s infinite;
}

/* Card Hover Animation */
.card-hover-effect {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-effect:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Success Check Animation */
.success-animation {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  position: relative;
}

.success-animation .checkmark {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: block;
  stroke-width: 2;
  stroke: #4CAF50;
  stroke-miterlimit: 10;
  box-shadow: 0 0 0 rgba(76, 175, 80, 0.4);
  animation: successPop 0.5s ease forwards;
  opacity: 0;
}

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

.success-animation .checkmark-check {
  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;
  }
}

/* Spinner Loading Animation */
.spinner-loader {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid #1565c0;
  border-radius: 50%;
  animation: rotate360 1s linear infinite;
}

/* Notification Bell Animation */
@keyframes bell {
  0% { transform: rotate(0); }
  10% { transform: rotate(20deg); }
  20% { transform: rotate(-20deg); }
  30% { transform: rotate(15deg); }
  40% { transform: rotate(-15deg); }
  50% { transform: rotate(10deg); }
  60% { transform: rotate(-10deg); }
  70% { transform: rotate(5deg); }
  80% { transform: rotate(-5deg); }
  100% { transform: rotate(0); }
}

.notification-bell {
  cursor: pointer;
  animation: bell 2s ease 5s infinite;
}

/* Hover Effects */
.hover-float {
  transition: transform 0.3s ease;
}

.hover-float:hover {
  transform: translateY(-5px);
}

.hover-bright {
  transition: filter 0.3s ease;
}

.hover-bright:hover {
  filter: brightness(1.1);
}

.hover-shadow {
  transition: box-shadow 0.3s ease;
}

.hover-shadow:hover {
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Page Transitions */
.page-transition {
  animation-duration: 0.5s;
  animation-fill-mode: both;
}

.page-enter {
  animation-name: fadeInUp;
}

.page-exit {
  animation-name: fadeOut;
}

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

/* Responsive Animation Adjustments */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  .stagger-fade-in > *:nth-child(n) {
    animation-delay: 0.05s;
  }
}
