/* ==========================================================================
   MUSCLEMIE - COMPONENTS & 3D BEST SELLERS CAROUSEL
   Adapted from AQWAKE 3D Amphitheater Concave Carousel & Sleek Component System
   ========================================================================== */

/* ==========================================================================
   3D BEST SELLERS CAROUSEL STAGE (EXACT AQWAKE EFFECT, OPTIMIZED FOR MOBILE)
   ========================================================================== */

.bestsellers-3d-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  overflow: visible;
  touch-action: pan-y;
  user-select: none;
}

/* Flanking Stage Nav Arrows */
.bestsellers-3d-stage-wrap .stage-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #181a20;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-left {
  left: 10px;
}

.bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-right {
  right: 10px;
}

@media (min-width: 1200px) {
  .bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-left {
    left: -20px;
  }
  .bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-right {
    right: -20px;
  }
}

.bestsellers-3d-stage-wrap .stage-nav-arrow:hover {
  background: var(--primary-orange);
  color: #0b0c0e;
  border-color: var(--primary-orange);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 12px 30px rgba(248, 156, 35, 0.45);
}

.bestsellers-3d-stage-wrap .stage-nav-arrow:active {
  transform: translateY(-50%) scale(0.95);
}

/* 3D Ring Stage */
.bestsellers-3d-ring {
  position: relative;
  width: 100%;
  min-height: 490px;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  user-select: none;
}

/* Product Card in 3D Stage */
.bestsellers-3d-ring .product-card {
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  margin-top: -235px !important;
  margin-left: -135px !important;
  transform-origin: center center !important;
  width: 270px !important;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.45s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease,
              border-color 0.3s ease;
  will-change: transform, opacity;
}

.bestsellers-3d-ring .product-card.card-center {
  border-color: rgba(248, 156, 35, 0.45);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 35px rgba(248, 156, 35, 0.25);
}

.bestsellers-3d-ring .product-card:hover {
  border-color: var(--primary-orange);
}

/* Product Card Media */
.bestsellers-3d-ring .card-media-wrap {
  height: 220px;
  position: relative;
  background: radial-gradient(circle at center, #232630 0%, #15171d 100%);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.bestsellers-3d-ring .card-media-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
}

.bestsellers-3d-ring .product-card:hover .card-media-wrap img {
  transform: scale(1.08);
}

/* Card Badges */
.card-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.badge-best {
  background: var(--primary-orange);
  color: #0b0c0e;
}

.badge-sale {
  background: #ff4757;
  color: #ffffff;
}

.badge-halal {
  background: #2ed573;
  color: #0b0c0e;
}

.badge-macro {
  background: rgba(19, 21, 24, 0.9);
  color: var(--accent-peach);
  border: 1px solid rgba(253, 212, 162, 0.3);
}

/* Quick Action Buttons on hover */
.card-quick-actions {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 6;
}

.bestsellers-3d-ring .product-card:hover .card-quick-actions,
.bestsellers-3d-ring .product-card.card-center .card-quick-actions {
  opacity: 1;
  transform: translateY(0);
}

.card-quick-btn {
  flex: 1;
  background: rgba(11, 12, 14, 0.88);
  backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.card-quick-btn:hover {
  background: var(--primary-orange);
  color: #0b0c0e;
  border-color: var(--primary-orange);
}

/* Card Body */
.bestsellers-3d-ring .card-body {
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--bg-dark-card);
}

.bestsellers-3d-ring .card-category {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary-orange);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.bestsellers-3d-ring .card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bestsellers-3d-ring .card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.card-stars-mini {
  color: #ffaa33;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 2px;
}

.card-stars-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 3px;
}

.card-macro-pill {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-peach);
  background: rgba(248, 156, 35, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

/* Card Price Row & Add Button */
.bestsellers-3d-ring .card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

.card-pricing {
  display: flex;
  flex-direction: column;
}

.card-price {
  font-size: 1.18rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1;
}

.card-price-per-serve {
  font-size: 0.72rem;
  color: var(--accent-peach);
  margin-top: 2px;
}

.card-add-btn {
  background: var(--primary-orange);
  color: #0b0c0e;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px var(--primary-orange-glow);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.card-add-btn:hover {
  background: #ffffff;
  transform: scale(1.15) rotate(90deg);
}

/* Indicators */
.carousel-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 2rem;
}

.carousel-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.carousel-indicator-dot.active {
  width: 30px;
  background: var(--primary-orange);
  box-shadow: 0 0 12px var(--primary-orange);
}

/* ==========================================================================
   MOBILE RESPONSIVE TUNING FOR 3D STAGE
   "smaller on mobile, make sure nothing is off screen"
   ========================================================================== */
@media (max-width: 768px) {
  .bestsellers-3d-stage-wrap {
    min-height: 420px;
    perspective: 850px;
  }

  .bestsellers-3d-ring {
    min-height: 400px;
  }

  .bestsellers-3d-ring .product-card {
    width: 210px !important;
    margin-top: -190px !important;
    margin-left: -105px !important;
    border-radius: 16px;
  }

  .bestsellers-3d-ring .card-media-wrap {
    height: 165px;
    padding: 0.75rem;
  }

  .bestsellers-3d-ring .card-body {
    padding: 0.85rem 0.95rem;
  }

  .bestsellers-3d-ring .card-title {
    font-size: 0.9rem;
  }

  .bestsellers-3d-ring .card-price {
    font-size: 1rem;
  }

  .bestsellers-3d-ring .card-price-per-serve {
    font-size: 0.65rem;
  }

  .bestsellers-3d-stage-wrap .stage-nav-arrow {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-left {
    left: 2px;
  }

  .bestsellers-3d-stage-wrap .stage-nav-arrow.arrow-right {
    right: 2px;
  }
}

@media (max-width: 420px) {
  .bestsellers-3d-stage-wrap {
    min-height: 390px;
  }

  .bestsellers-3d-ring {
    min-height: 370px;
  }

  .bestsellers-3d-ring .product-card {
    width: 185px !important;
    margin-top: -175px !important;
    margin-left: -92px !important;
  }

  .bestsellers-3d-ring .card-media-wrap {
    height: 145px;
  }
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 85px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

@media (max-width: 768px) {
  .toast-container {
    bottom: calc(var(--bottom-bar-height) + 16px);
    right: 16px;
    left: 16px;
  }
}

.toast {
  background: rgba(19, 21, 25, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--primary-orange);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 15px rgba(248, 156, 35, 0.3);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  color: var(--primary-orange);
  font-size: 1.1rem;
}

/* ==========================================================================
   LIVE SEARCH MODAL OVERLAY
   ========================================================================== */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  z-index: 550;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.search-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.search-modal-box {
  width: 90%;
  max-width: 620px;
  background: var(--bg-dark-card);
  border: 1px solid var(--border-dark);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
}

.search-input-row {
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-dark);
  gap: 1rem;
}

.search-input-row i {
  color: var(--primary-orange);
  font-size: 1.2rem;
}

.search-input-field {
  flex: 1;
  font-size: 1.1rem;
  color: #ffffff;
}

.search-close-btn {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-results-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 1rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  transition: background 0.2s ease;
  cursor: pointer;
}

.search-result-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.search-result-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background: #20232a;
}
