/* =====================================================
   Sleep Home | سليب هوم - Animations System
   ===================================================== */

/* =====================================================
   Keyframe Animations
   ===================================================== */

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade Right */
@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Fade Left */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide Up */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Ping */
@keyframes ping {
  0% { transform: scale(1); opacity: 1; }
  75%, 100% { transform: scale(1.5); opacity: 0; }
}

/* Bounce */
@keyframes bounce {
  0%, 100% { transform: translateY(0); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: translateY(-16px); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* Shimmer */
@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

/* Marquee (scrolling) */
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Gradient Shift */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Draw Line */
@keyframes drawLine {
  from { width: 0; }
  to { width: 100%; }
}

/* Counter Up (visual hint) */
@keyframes counterPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

/* Ripple */
@keyframes ripple {
  0% { transform: scale(0); opacity: 0.4; }
  100% { transform: scale(4); opacity: 0; }
}

/* =====================================================
   Animation Utility Classes
   ===================================================== */

.animate-fade-in {
  animation: fadeIn 0.6s ease both;
}

.animate-fade-up {
  animation: fadeInUp 0.65s ease both;
}

.animate-fade-down {
  animation: fadeInDown 0.65s ease both;
}

.animate-fade-right {
  animation: fadeInRight 0.6s ease both;
}

.animate-fade-left {
  animation: fadeInLeft 0.6s ease both;
}

.animate-scale {
  animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* ─── Delay Utilities ─────────────────────────────── */
/* عناصر ذات delay تبقى شفافة حتى يبدأ الأنيميشن */
.delay-100 { animation-delay: 0.1s; opacity: 0; animation-fill-mode: both; }
.delay-200 { animation-delay: 0.2s; opacity: 0; animation-fill-mode: both; }
.delay-300 { animation-delay: 0.3s; opacity: 0; animation-fill-mode: both; }
.delay-400 { animation-delay: 0.4s; opacity: 0; animation-fill-mode: both; }
.delay-500 { animation-delay: 0.5s; opacity: 0; animation-fill-mode: both; }
.delay-600 { animation-delay: 0.6s; opacity: 0; animation-fill-mode: both; }
.delay-700 { animation-delay: 0.7s; opacity: 0; animation-fill-mode: both; }
.delay-800 { animation-delay: 0.8s; opacity: 0; animation-fill-mode: both; }

/* =====================================================
   Scroll-triggered Animations (Intersection Observer)
   ===================================================== */

/* Elements start invisible and animate in when visible */
[data-animate] {
  opacity: 0;
  transition: opacity 0.7s ease, transform 0.7s ease;
}

[data-animate="fade-up"] {
  transform: translateY(40px);
}

[data-animate="fade-down"] {
  transform: translateY(-40px);
}

[data-animate="fade-right"] {
  transform: translateX(40px);
}

[data-animate="fade-left"] {
  transform: translateX(-40px);
}

[data-animate="scale"] {
  transform: scale(0.85);
}

[data-animate="fade"] {
  transform: none;
}

/* Animated state - added by JS IntersectionObserver */
[data-animate].animated {
  opacity: 1;
  transform: translateY(0) translateX(0) scale(1);
}

/* Staggered children */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

[data-stagger].animated > * {
  opacity: 1;
  transform: translateY(0);
}

[data-stagger].animated > *:nth-child(1) { transition-delay: 0.05s; }
[data-stagger].animated > *:nth-child(2) { transition-delay: 0.15s; }
[data-stagger].animated > *:nth-child(3) { transition-delay: 0.25s; }
[data-stagger].animated > *:nth-child(4) { transition-delay: 0.35s; }
[data-stagger].animated > *:nth-child(5) { transition-delay: 0.45s; }
[data-stagger].animated > *:nth-child(6) { transition-delay: 0.55s; }
[data-stagger].animated > *:nth-child(7) { transition-delay: 0.65s; }
[data-stagger].animated > *:nth-child(8) { transition-delay: 0.75s; }

/* =====================================================
   Hero Slider Animation
   ===================================================== */
.hero-slider {
  position: relative;
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.5s ease-in-out, visibility 1.5s;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

.hero-slide-bg {
  position: absolute;
  inset: 0;
  background-position: center !important;
  background-size: cover !important;
  transform: scale(1.08);
  transition: transform 6s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.hero-slide.active .hero-slide-bg {
  transform: scale(1);
}

/* Hero content animation */
.hero-content-animated .hero-tagline {
  animation: fadeInDown 0.8s 0.2s ease both;
}

.hero-content-animated .hero-title {
  animation: fadeInUp 0.8s 0.4s ease both;
}

.hero-content-animated .hero-subtitle {
  animation: fadeInUp 0.8s 0.6s ease both;
}

.hero-content-animated .hero-actions {
  animation: fadeInUp 0.8s 0.8s ease both;
}

.hero-content-animated .hero-stats {
  animation: fadeInUp 0.8s 1s ease both;
}

/* =====================================================
   Slider Dots & Arrows
   ===================================================== */
.slider-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  padding: 0;
}

.slider-dot.active {
  width: 24px;
  border-radius: 4px;
  background: var(--color-gold, #C9A96E);
}

.slider-arrow {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.slider-arrow:hover {
  background: rgba(255,255,255,0.3);
  transform: scale(1.05);
}

/* =====================================================
   Product Image Gallery Zoom
   ===================================================== */
.product-gallery {
  position: relative;
  overflow: hidden;
}

.product-gallery-main {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-xl, 24px);
  cursor: zoom-in;
  background: #F5F0E8;
}

.product-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-gallery-main:hover img {
  transform: scale(1.08);
}

.product-gallery-thumbs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.product-gallery-thumbs::-webkit-scrollbar { display: none; }

.gallery-thumb {
  width: 80px;
  height: 80px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  background: #F5F0E8;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-thumb:hover,
.gallery-thumb.active {
  border-color: var(--color-primary, var(--color-primary));
  transform: translateY(-2px);
}

/* =====================================================
   Cart Animation
   ===================================================== */
@keyframes cartBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.3) rotate(-10deg); }
  60% { transform: scale(0.9) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.cart-animate {
  animation: cartBounce 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* =====================================================
   Loading Spinner
   ===================================================== */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border, #E8E2D8);
  border-top-color: var(--color-primary, var(--color-primary));
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.8);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

/* =====================================================
   Page Transition
   ===================================================== */
.page-enter {
  animation: fadeIn 0.4s ease forwards;
}

/* =====================================================
   Ripple Effect on Buttons
   ===================================================== */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple .ripple-circle {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  width: 100px;
  height: 100px;
  margin-top: -50px;
  margin-left: -50px;
  animation: ripple 0.6s ease-out forwards;
  pointer-events: none;
}

/* =====================================================
   Progress Bar
   ===================================================== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border, #E8E2D8);
  border-radius: var(--radius-full, 9999px);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--grad-gold, linear-gradient(135deg, #C9A96E 0%, #A88A52 100%));
  border-radius: var(--radius-full, 9999px);
  transition: width 1s ease;
}

/* =====================================================
   Ticker / Marquee Banner
   ===================================================== */
.ticker-wrap {
  overflow: hidden;
  background: var(--color-primary, var(--color-primary));
  padding: 10px 0;
}

.ticker-inner {
  display: flex;
  white-space: nowrap;
  animation: marquee 25s linear infinite;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 0 32px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
}

.ticker-item::after {
  content: '✦';
  color: var(--color-gold, #C9A96E);
}

/* =====================================================
   Hover Card Shine Effect
   ===================================================== */
.shine-effect {
  position: relative;
  overflow: hidden;
}

.shine-effect::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(to right, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
  pointer-events: none;
}

.shine-effect:hover::after {
  left: 120%;
}

/* =====================================================
   Stat Counter Animation
   ===================================================== */
.stat-number {
  font-size: 3rem;
  font-weight: 900;
  color: var(--color-primary, var(--color-primary));
  line-height: 1;
  display: inline-block;
}

.stat-number.counting {
  animation: counterPop 0.5s ease;
}

/* =====================================================
   Reduce Motion (Accessibility)
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
