/* Qoffa Smart — Premium bundle-detail modal
   Shared CSS only: preserves the existing modal markup and JavaScript actions. */

:root {
  --bundle-deep-green: #104b37;
  --bundle-green: #177b58;
  --bundle-mint: #e9f7ee;
  --bundle-cream: #fffaf1;
  --bundle-gold: #d6b36a;
  --bundle-ink: #17392d;
}

.bundle-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10080 !important;
  display: grid !important;
  place-items: center !important;
  padding: clamp(0.9rem, 3vw, 2.5rem) !important;
  overflow: auto !important;
  isolation: isolate;
  background:
    radial-gradient(circle at 15% 8%, rgba(199, 239, 139, 0.2), transparent 31%),
    radial-gradient(circle at 88% 94%, rgba(214, 179, 106, 0.16), transparent 30%),
    rgba(12, 38, 29, 0.68) !important;
  -webkit-backdrop-filter: blur(14px) saturate(118%);
  backdrop-filter: blur(14px) saturate(118%);
  animation: bundleOverlayIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
}

.bundle-modal-overlay::before,
.bundle-modal-overlay::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(2px);
}

.bundle-modal-overlay::before {
  width: min(34vw, 27rem);
  aspect-ratio: 1;
  top: -14rem;
  right: -9rem;
  background: radial-gradient(circle, rgba(188, 235, 131, 0.24), transparent 68%);
}

.bundle-modal-overlay::after {
  width: min(38vw, 31rem);
  aspect-ratio: 1;
  bottom: -17rem;
  left: -12rem;
  background: radial-gradient(circle, rgba(221, 182, 105, 0.2), transparent 67%);
}

.bundle-modal {
  position: relative !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  width: min(100%, 50rem) !important;
  max-height: min(90dvh, 49rem) !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, 0.72) !important;
  border-radius: clamp(1.25rem, 3vw, 2rem) !important;
  background: linear-gradient(145deg, #ffffff 0%, #fdfaf1 100%) !important;
  box-shadow:
    0 2rem 6rem rgba(3, 27, 17, 0.38),
    0 0.4rem 1.25rem rgba(3, 58, 39, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  direction: rtl;
  animation: bundleModalIn 0.42s cubic-bezier(0.2, 0.85, 0.22, 1.08) both !important;
}

.bundle-modal::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  z-index: 4;
  background: linear-gradient(90deg, var(--bundle-gold), #dff3b4 42%, #2c9368 76%, var(--bundle-deep-green));
}

.bundle-modal-header {
  position: relative !important;
  z-index: 2 !important;
  order: initial !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 1rem !important;
  padding: clamp(1rem, 2.7vw, 1.55rem) clamp(1.15rem, 3vw, 1.8rem) !important;
  min-height: 5.2rem;
  color: #fff !important;
  background:
    radial-gradient(circle at 12% 0%, rgba(219, 245, 171, 0.26), transparent 32%),
    linear-gradient(125deg, #0d3f30 0%, #145940 56%, #1b805b 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 0.75rem 1.8rem rgba(10, 57, 39, 0.17) !important;
}

.bundle-modal-header::after {
  content: "";
  position: absolute;
  inset: auto 1.6rem 0 auto;
  width: 4.75rem;
  height: 0.25rem;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--bundle-gold), rgba(255, 255, 255, 0));
}

.bundle-modal-title {
  min-width: 0;
  margin: 0 !important;
  color: #fff !important;
  font-family: "Cairo", sans-serif !important;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem) !important;
  font-weight: 800 !important;
  line-height: 1.45 !important;
  letter-spacing: -0.025em;
  text-shadow: 0 0.15rem 0.8rem rgba(0, 0, 0, 0.16) !important;
}

.bundle-modal-close {
  flex: 0 0 auto !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 2.7rem !important;
  height: 2.7rem !important;
  padding: 0 !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border: 1px solid rgba(255, 255, 255, 0.35) !important;
  border-radius: 50% !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  cursor: pointer;
  transition: transform 0.22s ease, background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease !important;
}

.bundle-modal-close:hover,
.bundle-modal-close:focus-visible {
  color: var(--bundle-deep-green) !important;
  background: #fffdf6 !important;
  border-color: #fffdf6 !important;
  box-shadow: 0 0.55rem 1.2rem rgba(0, 0, 0, 0.16) !important;
  transform: rotate(90deg) scale(1.04) !important;
  outline: none;
}

.bundle-modal-body {
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  min-height: 11rem;
  padding: clamp(0.75rem, 2vw, 1.2rem) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  background:
    linear-gradient(135deg, rgba(234, 247, 237, 0.92), rgba(255, 252, 244, 0.94)),
    #f7f7f1 !important;
}

.bundle-modal-body::before {
  content: "";
  position: absolute;
  width: 12rem;
  height: 12rem;
  top: -7rem;
  left: -6.5rem;
  border-radius: 50%;
  background: rgba(202, 235, 156, 0.24);
  pointer-events: none;
}

.bundle-modal-body img {
  position: relative;
  z-index: 1;
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: min(54dvh, 34rem) !important;
  object-fit: contain !important;
  border: 1px solid rgba(22, 91, 62, 0.12);
  border-radius: clamp(0.75rem, 2vw, 1.25rem) !important;
  background: #fff !important;
  box-shadow: 0 1rem 2.25rem rgba(20, 83, 55, 0.16) !important;
}

.bundle-image-loader {
  position: relative;
  z-index: 1;
  width: 3.2rem !important;
  height: 3.2rem !important;
  border: 0.28rem solid rgba(20, 107, 73, 0.15) !important;
  border-top-color: var(--bundle-green) !important;
  border-radius: 50% !important;
  animation: bundleSpin 0.8s linear infinite !important;
}

.bundle-modal-footer {
  position: relative !important;
  z-index: 2 !important;
  order: initial !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.9rem !important;
  padding: clamp(0.9rem, 2.5vw, 1.25rem) clamp(1.15rem, 3vw, 1.8rem) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  border-top: 1px solid rgba(20, 88, 59, 0.11) !important;
  box-shadow: 0 -0.6rem 1.8rem rgba(28, 83, 57, 0.05) !important;
}

.bundle-price-display {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
  min-width: 0;
  padding: 0.55rem 0.85rem !important;
  color: var(--bundle-deep-green) !important;
  font-family: "Cairo", sans-serif !important;
  font-size: clamp(0.95rem, 2vw, 1.12rem) !important;
  font-weight: 800 !important;
  white-space: nowrap;
  background: linear-gradient(135deg, #eff9dd, #e7f7eb) !important;
  border: 1px solid rgba(79, 151, 88, 0.2) !important;
  border-radius: 999px !important;
}

.bundle-price-display > span:first-child {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  font-size: 0.86rem;
  background: #fffdf7;
  border-radius: 50%;
}

.btn-add-cart-modal {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  min-height: 2.8rem;
  padding: 0.72rem 1.15rem !important;
  color: #fff !important;
  font-family: "Cairo", sans-serif !important;
  font-size: 0.9rem !important;
  font-weight: 800 !important;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  background: linear-gradient(135deg, #0f5a40, #1b8c63 70%, #34a978) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 0.92rem !important;
  box-shadow: 0 0.7rem 1.4rem rgba(21, 117, 80, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease !important;
}

.btn-add-cart-modal:hover,
.btn-add-cart-modal:focus-visible {
  color: #fff !important;
  filter: brightness(1.06) saturate(1.05);
  box-shadow: 0 1rem 1.9rem rgba(21, 117, 80, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22) !important;
  transform: translateY(-2px) !important;
  outline: none;
}

.bundle-modal-overlay.closing {
  animation: bundleOverlayOut 0.25s ease both !important;
}

.bundle-modal.closing {
  animation: bundleModalOut 0.25s cubic-bezier(0.4, 0, 0.2, 1) both !important;
}

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

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

@keyframes bundleModalIn {
  from { opacity: 0; transform: translateY(1.25rem) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bundleModalOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(1.2rem) scale(0.975); }
}

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

@media (max-width: 37.5rem) {
  .bundle-modal-overlay {
    align-items: end !important;
    padding: 0.7rem !important;
  }

  .bundle-modal {
    width: 100% !important;
    max-height: min(91dvh, 48rem) !important;
    border-radius: 1.35rem 1.35rem 1.05rem 1.05rem !important;
  }

  .bundle-modal-header {
    min-height: 4.45rem;
    padding: 0.85rem 1rem !important;
  }

  .bundle-modal-header::after { right: 1rem; }

  .bundle-modal-close {
    width: 2.45rem !important;
    height: 2.45rem !important;
  }

  .bundle-modal-body {
    min-height: 8rem;
    padding: 0.65rem !important;
  }

  .bundle-modal-body img {
    max-height: min(50dvh, 26rem) !important;
    border-radius: 0.8rem !important;
  }

  .bundle-modal-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 0.8rem 1rem calc(0.85rem + env(safe-area-inset-bottom)) !important;
  }

  .bundle-price-display {
    align-self: center;
  }

  .btn-add-cart-modal {
    width: 100% !important;
    min-height: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bundle-modal-overlay,
  .bundle-modal,
  .bundle-modal-overlay.closing,
  .bundle-modal.closing,
  .bundle-image-loader {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .bundle-modal-close,
  .btn-add-cart-modal {
    transition-duration: 0.01ms !important;
  }
}

/* Avoid a horizontal scroller when the supplied bundle sheet is wider than its panel. */
.bundle-modal-body {
  min-width: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.bundle-modal-body img {
  min-width: 0 !important;
}

/* Full-width bundle sheet: edge-to-edge from the right to the left within the modal. */
.bundle-modal {
  width: min(calc(100vw - clamp(1.5rem, 7vw, 7rem)), 62rem) !important;
}

.bundle-modal-body {
  display: block !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  background: #f5f8f1 !important;
}

.bundle-modal-body img {
  display: block !important;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

@media (max-width: 37.5rem) {
  .bundle-modal {
    width: 100% !important;
  }
}

/* The sheet is now edge-to-edge; remove the former off-canvas decorative circle to keep scrollWidth equal to the panel width. */
.bundle-modal-body::before {
  display: none !important;
}
