/**
 * Elvora Home - Luxury Soft Animations Engine
 * Provides subtle, organic, and ultra-smooth animations across the store:
 * 1. Soft Page Transitions (Silky crossfades & top editorial progress bar on redirects)
 * 2. Soft Button Click Ripple & Micro-Haptic Feedback (Radial ripple waves + soft spring press)
 * 3. Soft Upload & Processing States (Shimmer progress bars, glowing pulse, upload preview)
 * 4. Soft Scroll Reveals (Gentle IntersectionObserver entrance)
 * 5. Soft Floating Micro-Interactions (Elevated card hovers, elegant toasts)
 */

/* Smooth document-level scrolling */
html {
  scroll-behavior: smooth;
}

/* 1. ULTRA-FAST NON-BLOCKING TRANSITIONS */
body {
  opacity: 1;
  transition: opacity 0.15s ease-out;
}
body.page-leaving {
  opacity: 0.95;
}

/* Editorial Top Redirect Progress Line */
#luxuryRedirectLoader {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, #A45D39, #D98E68, #E5BA97, #A45D39);
  background-size: 200% 100%;
  animation: redirectLoaderGradient 2s ease infinite;
  z-index: 999999;
  box-shadow: 0 0 12px rgba(164, 93, 57, 0.5);
  transition: width 0.28s cubic-bezier(0.1, 0.9, 0.2, 1), opacity 0.2s ease;
  pointer-events: none;
  opacity: 0;
}

#luxuryRedirectLoader.active {
  opacity: 1;
  width: 78%;
}

#luxuryRedirectLoader.finish {
  opacity: 1;
  width: 100%;
  transition: width 0.12s ease-out, opacity 0.2s ease-out 0.08s;
}

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

/* 2. SOFT BUTTON CLICK RIPPLE & TACTILE FEEDBACK */
.btn-3d, 
button:not(.no-ripple), 
a.btn-3d,
.soft-clickable {
  position: relative;
  overflow: hidden; /* Contains the expanding soft ripple */
  transition: transform 0.16s cubic-bezier(0.34, 1.4, 0.64, 1), 
              box-shadow 0.16s cubic-bezier(0.34, 1.4, 0.64, 1), 
              background-color 0.2s ease, 
              border-color 0.2s ease,
              color 0.2s ease;
}

/* Soft ripple wave originating from mouse click coordinates */
.soft-ripple-wave {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  pointer-events: none;
  animation: softRippleAnimation 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 10;
}

/* Default light ripple for dark backgrounds */
.soft-ripple-wave.ripple-light {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.08) 70%, transparent 100%);
}

/* Amber/warm ripple for light backgrounds */
.soft-ripple-wave.ripple-dark {
  background: radial-gradient(circle, rgba(164, 93, 57, 0.22) 0%, rgba(164, 93, 57, 0.05) 70%, transparent 100%);
}

@keyframes softRippleAnimation {
  0% {
    transform: scale(0);
    opacity: 0.85;
  }
  100% {
    transform: scale(3.8);
    opacity: 0;
  }
}

/* Micro-haptic active depression */
.btn-3d:active,
button.btn-3d:active,
a.btn-3d:active {
  transform: translateY(3px) scale(0.99) !important;
  transition-duration: 0.06s !important;
}

/* 3. SOFT UPLOAD & SUBMISSION PROGRESS STATES */
.soft-dropzone {
  border: 2px dashed #D5C7B2;
  background: #FAF7F2;
  border-radius: 16px;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.soft-dropzone:hover, 
.soft-dropzone.dragover {
  border-color: #A45D39;
  background: #F5EEE2;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(164, 93, 57, 0.08);
}

.soft-progress-track {
  width: 100%;
  height: 6px;
  background: #E8DEC9;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.soft-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #A45D39, #C87E58, #E2A781);
  border-radius: 9999px;
  width: 0%;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.soft-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: softShimmerAnim 1.6s infinite linear;
}

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

/* Upload Pulse Glow */
@keyframes softPulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(164, 93, 57, 0.28);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(164, 93, 57, 0);
    transform: scale(1.015);
  }
}

.soft-upload-pulsing {
  animation: softPulseGlow 1.8s infinite ease-in-out;
}

/* 4. SOFT SCROLL REVEALS */
.soft-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.65s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.soft-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delay classes */
.soft-delay-100 { transition-delay: 100ms; }
.soft-delay-200 { transition-delay: 200ms; }
.soft-delay-300 { transition-delay: 300ms; }
.soft-delay-400 { transition-delay: 400ms; }

/* 5. SOFT CARD ELEVATION ON HOVER */
.soft-card-hover {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.soft-card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 36px -12px rgba(36, 32, 28, 0.1);
}

/* 6. SOFT TOAST NOTIFICATION */
#softToastContainer {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.soft-toast-item {
  background: rgba(28, 25, 23, 0.94);
  color: #FAF7F2;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(196, 154, 108, 0.38);
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(196, 154, 108, 0.15);
  border-radius: 16px;
  padding: 14px 20px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 14px;
  transform: translateY(24px) scale(0.95);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.soft-toast-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, #C49A6C, #A45D39);
}

.soft-toast-item.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.soft-toast-item.hide {
  transform: translateY(-10px) scale(0.96);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

/* 7. LUXURY MODAL & DRAWER STRUCTURES */
.luxury-modal-overlay {
  background: rgba(14, 12, 10, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.luxury-modal-card {
  box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(222, 205, 179, 0.8);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  position: relative;
}

.luxury-gold-shimmer {
  background: linear-gradient(90deg, #B38749, #DFBA85, #F5DEB3, #DFBA85, #B38749);
  background-size: 200% 100%;
  animation: goldShimmerAnim 4s ease-in-out infinite;
}

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

/* Luxury Slim Scrollbar for Popups, Modals, and Drawers */
.luxury-scroll::-webkit-scrollbar,
#bagItemsList::-webkit-scrollbar,
#policyModalBody::-webkit-scrollbar,
#productModalBox::-webkit-scrollbar,
#luxuryPolicyCard .overflow-y-auto::-webkit-scrollbar {
  width: 5px;
}

.luxury-scroll::-webkit-scrollbar-track,
#bagItemsList::-webkit-scrollbar-track,
#policyModalBody::-webkit-scrollbar-track,
#productModalBox::-webkit-scrollbar-track,
#luxuryPolicyCard .overflow-y-auto::-webkit-scrollbar-track {
  background: #F4ECE0;
  border-radius: 9999px;
}

.luxury-scroll::-webkit-scrollbar-thumb,
#bagItemsList::-webkit-scrollbar-thumb,
#policyModalBody::-webkit-scrollbar-thumb,
#productModalBox::-webkit-scrollbar-thumb,
#luxuryPolicyCard .overflow-y-auto::-webkit-scrollbar-thumb {
  background: #CBB79F;
  border-radius: 9999px;
}

.luxury-scroll::-webkit-scrollbar-thumb:hover,
#bagItemsList::-webkit-scrollbar-thumb:hover,
#policyModalBody::-webkit-scrollbar-thumb:hover,
#productModalBox::-webkit-scrollbar-thumb:hover,
#luxuryPolicyCard .overflow-y-auto::-webkit-scrollbar-thumb:hover {
  background: #A45D39;
}

/* Soft Spinner for Buttons */
.soft-btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #FFFFFF;
  animation: softSpin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

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