/* Alenpich bulk quantity — UX patches injected over the Boom theme React SPA. */

/* Hide native number-input spinners across all our inputs */
.alenpich-qty-input::-webkit-outer-spin-button,
.alenpich-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.alenpich-qty-input {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ---------- Catalog card gradient pill ---------- */
.alenpich-qty-input-card {
  width: 44px;
  min-width: 44px;
  height: 24px;
  border: 0;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  padding: 0 4px;
  font-family: inherit;
  direction: ltr;
  transition: background 0.15s ease;
}
.alenpich-qty-input-card:focus {
  background: rgba(255, 255, 255, 0.32);
}
.alenpich-qty-input-card::placeholder { color: rgba(255,255,255,0.6); }

/* ---------- Product-page add-to-cart with quantity input ---------- */
.alenpich-pdp-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
}
.alenpich-pdp-qty {
  width: 96px;
  flex-shrink: 0;
  height: auto;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  transition: border-color 0.15s ease;
}
.alenpich-pdp-qty:focus-within {
  border-color: var(--primary, #f97316);
}
.alenpich-pdp-qty input {
  width: 100%;
  height: 100%;
  min-height: 48px;
  border: 0;
  background: transparent;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  font-family: inherit;
  direction: ltr;
  color: #1b1f22;
}
.alenpich-pdp-row > .buttonsAddToCard,
.alenpich-pdp-row > [class*="buttonsAddToCard"] {
  flex: 1;
}

/* ---------- Mini-cart drawer + cart page rows ---------- */
.alenpich-qty-input-row {
  width: 56px;
  height: 32px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  padding: 0 4px;
  font-family: inherit;
  direction: ltr;
  color: #1b1f22;
  transition: border-color 0.15s ease;
}
.alenpich-qty-input-row:focus {
  border-color: var(--primary, #f97316);
}

/* Always-visible trash button for cart contexts */
.alenpich-trash-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #fecaca;
  background: #fff;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ef4444;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
  flex-shrink: 0;
}
.alenpich-trash-btn:hover {
  background: #fef2f2;
  color: #dc2626;
}
.alenpich-trash-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.alenpich-trash-btn svg { width: 15px; height: 15px; }

/* When our trash button is rendered inside the gradient pill, restyle for the dark background */
.bg-gradient-to-r.from-primary .alenpich-trash-btn,
.from-primary.to-primary-500 .alenpich-trash-btn {
  border: 0;
  background: transparent;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 12px;
}
.bg-gradient-to-r.from-primary .alenpich-trash-btn:hover,
.from-primary.to-primary-500 .alenpich-trash-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ---------- Archive / category page injected add-to-cart widget ---------- */
.alenpich-archive-cart {
  position: absolute;
  bottom: 12px;
  right: 8px;
  display: flex;
  align-items: center;
  z-index: 5;
}
/* Round orange + button — matches the homepage card style */
.alenpich-archive-add-btn {
  width: 38px;
  height: 38px;
  background: var(--primary, #f97316);
  color: #fff;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}
.alenpich-archive-add-btn:hover { opacity: 0.88; }
.alenpich-archive-add-btn:active { transform: scale(0.93); }
.alenpich-archive-add-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Gradient pill shown when item is in cart */
.alenpich-archive-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(to left, var(--primary, #f97316), #fb923c);
  border-radius: 14px;
  padding: 3px 4px 3px 6px;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.3);
}
.alenpich-qty-input-archive {
  width: 58px;
  min-width: 58px;
  height: 24px;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  padding: 0 4px;
  font-family: inherit;
  direction: ltr;
  transition: background 0.15s ease;
}
.alenpich-qty-input-archive:focus { background: rgba(255, 255, 255, 0.38); }
.alenpich-qty-input-archive::placeholder { color: rgba(255,255,255,0.6); }

@media (max-width: 640px) {
  .alenpich-archive-add-btn { width: 32px; height: 32px; }
  .alenpich-qty-input-archive { width: 50px; min-width: 50px; }
}

/* ---------- Mobile product page fixed bottom bar quantity input ---------- */
.alenpich-mobile-pdp-qty {
  width: 62px;
  height: 42px;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  padding: 0 6px;
  font-family: inherit;
  direction: ltr;
  color: #fff;
  align-self: center;
  transition: border-color 0.15s ease, background 0.15s ease;
  margin: 0 6px;
}
.alenpich-mobile-pdp-qty::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
.alenpich-mobile-pdp-qty:focus {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.2);
}

/* ---------- Mobile bottom-nav cart badge ---------- */
.alenpich-cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--primary, #f97316);
  color: #fff;
  border-radius: 9px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  z-index: 10;
  box-sizing: border-box;
  border: 1.5px solid #fff;
  white-space: nowrap;
}

/* Loading state */
.alenpich-busy {
  opacity: 0.6;
  pointer-events: none;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  .alenpich-qty-input-card {
    width: 40px;
    min-width: 40px;
  }
  .alenpich-pdp-qty {
    width: 84px;
  }
  .alenpich-qty-input-row {
    width: 48px;
  }
}

/* ============================================================
   Product page image — override Boom theme's fixed box
   ============================================================ */

/* Desktop: transparent bg (mix-blend-multiply handles white photo bg cleanly),
   fill the full column width as a square */
div:has(> #resultImage) {
  background: transparent !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  border-radius: 16px !important;
  margin: 0 !important;
}
#resultImage {
  width: 100% !important;
  height: 100% !important;
  border-radius: 0 !important;
  /* Keep original mix-blend-multiply and object-contain from the theme —
     they make the product float cleanly on the white card background */
}

/* Mobile: full-bleed hero image, cover-crop fills edge-to-edge.
   "left 50% + translateX(-50%)" centres the element on the viewport
   independently of any ancestor padding — more reliable than negative margins
   which only work if you know every ancestor's exact padding. */
@media (max-width: 767px) {
  /* Remove overflow-hidden from the white card so children can bleed out */
  div.bg-white[class*="overflow-hidden"]:has(#resultImage) {
    overflow: visible !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  div.bg-white[class*="overflow-hidden"]:has(#resultImage) > div:first-child {
    overflow: visible !important;
  }
  /* Image container: pin to viewport centre, stretch full width.
     Height is set by JS (fitMobileImage) to match the image's natural ratio —
     this eliminates both side-strips (no scale hack needed) and top/bottom
     clipping. The 80vw fallback keeps layout sane until the image loads. */
  div:has(> #resultImage) {
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 100vw !important;
    margin-top: -15px !important;
    margin-bottom: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
    aspect-ratio: auto !important;
    height: 80vw !important;     /* JS overrides this once image is loaded */
    max-height: 80vh !important; /* never taller than most of the viewport */
    overflow: hidden !important;
  }
  #resultImage {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    mix-blend-mode: normal !important;
    /* no transform — JS sizes the container to match the image ratio exactly */
  }
}

/* ============================================================
   Product image magnifier
   ============================================================ */

/* Hover zoom panel — floats fixed next to cursor on desktop */
.alenpich-zoom-panel {
  display: none;
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 16px;
  background-repeat: no-repeat;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  z-index: 9000;
  pointer-events: none;
  overflow: hidden;
}

/* Lightbox overlay */
.alenpich-lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: alenpich-lb-in 0.18s ease;
}
.alenpich-lb-overlay.alenpich-lb-out {
  animation: alenpich-lb-out 0.2s ease forwards;
}
@keyframes alenpich-lb-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes alenpich-lb-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Inner wrapper catches overflow when image is panned past edges */
.alenpich-lb-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
}
.alenpich-lb-wrap.grabbing { cursor: grabbing; }

.alenpich-lb-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  will-change: transform;
}

.alenpich-lb-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
  z-index: 100001;
  padding: 0;
}
.alenpich-lb-close:hover { background: rgba(255, 255, 255, 0.28); }

/* Zoom hint badge shown briefly on open */
.alenpich-lb-hint {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  pointer-events: none;
  animation: alenpich-lb-hint-fade 2.5s ease forwards;
  white-space: nowrap;
}
@keyframes alenpich-lb-hint-fade {
  0%   { opacity: 1; }
  60%  { opacity: 1; }
  100% { opacity: 0; }
}
