/* ============================================
   MICRO-ANIMATIONS & MICRO-INTERACTIONS CSS
   ============================================ */

/* --- Page Transitions --- */
.page-enter {
  animation: pageEnter 0.4s ease-out forwards;
}

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

/* --- Card Animations --- */
.card-animate {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-animate:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.1);
}

.dark .card-animate:hover {
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4);
}

/* --- Button Micro-Interactions --- */
.btn-animate {
  position: relative;
  overflow: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-animate::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-animate:hover::after {
  opacity: 1;
}

.btn-animate:active {
  transform: scale(0.97);
}

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

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

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

/* --- Touch Active State --- */
.touch-active {
  opacity: 0.85;
  transform: scale(0.98);
  transition: all 0.1s ease;
}

/* --- Form Field Animations --- */
.form-field-animate {
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-field-animate:focus-within {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
  transform: scale(1.005);
}

/* --- Floating Label Animation --- */
.float-label {
  position: relative;
}

.float-label label {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.float-label input:focus + label,
.float-label input:not(:placeholder-shown) + label {
  transform: translateY(-1.4rem) scale(0.85);
  color: #f97316;
}

/* --- Skeleton Loading Animation --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

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

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

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

/* --- Notification Badge --- */
.notification-badge {
  animation: badgeBounce 2s ease-in-out infinite;
}

@keyframes badgeBounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* --- Slide In Animations --- */
.slide-in-right {
  animation: slideInRight 0.3s ease-out forwards;
}

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

.slide-in-left {
  animation: slideInLeft 0.3s ease-out forwards;
}

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

.slide-in-up {
  animation: slideInUp 0.3s ease-out forwards;
}

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

/* --- Fade Scale --- */
.fade-scale-in {
  animation: fadeScaleIn 0.3s ease-out forwards;
}

@keyframes fadeScaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Breadcrumb Animations --- */
.breadcrumb-item {
  transition: color 0.2s ease, transform 0.2s ease;
}

.breadcrumb-item:hover {
  color: #f97316;
  transform: translateX(2px);
}

.breadcrumb-separator {
  transition: opacity 0.2s ease;
}

/* --- Swiper Custom Styles --- */
.swiper-pagination-bullet {
  transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
  background: #f97316 !important;
  transform: scale(1.3);
}

.swiper-button-next,
.swiper-button-prev {
  color: #f97316 !important;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
  transform: scale(1.1);
}

/* --- Responsive Button System --- */
.btn-responsive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  min-height: 44px;
  min-width: 44px;
}

.btn-responsive-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-responsive-md {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
}

.btn-responsive-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Mobile-first responsive buttons */
@media (max-width: 639px) {
  .btn-responsive {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
  }
  
  .btn-group-responsive {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .btn-group-responsive > * {
    width: 100%;
  }
}

@media (min-width: 640px) {
  .btn-group-responsive {
    flex-direction: row;
    gap: 0.75rem;
  }
}

/* Tablet responsive */
@media (min-width: 640px) and (max-width: 1023px) {
  .btn-responsive-md {
    padding: 0.625rem 1.25rem;
  }
}

/* Desktop responsive */
@media (min-width: 1024px) {
  .btn-responsive-lg {
    padding: 0.75rem 2rem;
  }
}

/* --- Sidebar Link Animation --- */
.sidebar-link-animate {
  position: relative;
  overflow: hidden;
}

.sidebar-link-animate::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: #f97316;
  border-radius: 0 2px 2px 0;
  transition: height 0.2s ease;
}

.sidebar-link-animate:hover::before,
.sidebar-link-animate.active::before {
  height: 60%;
}

/* --- Stagger Animation Classes --- */
.stagger-item {
  opacity: 0;
  transform: translateY(10px);
}

.stagger-item.visible {
  animation: staggerFadeIn 0.4s ease-out forwards;
}

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

/* --- Dark Mode Transition Enhancement --- */
html.transitioning * {
  transition-duration: 0.4s !important;
}

/* --- Focus Ring Animation --- */
@keyframes focusRing {
  0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4); }
  100% { box-shadow: 0 0 0 4px rgba(249, 115, 22, 0); }
}

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

/* --- Scroll Progress Indicator --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, #f97316, #fb923c);
  z-index: 9999;
  transition: width 0.1s linear;
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
