/**
 * Backorder Quick View Modal — Redesigned QV triggered from the BO Similar Items drawer.
 * Scoped to BO drawer context only; site-wide Bootstrap QV is unaffected.
 * BEM namespace: .bo-qv
 * @see QuickViewModal.tsx (Figma design reference)
 */

/* ===== Backdrop ===== */
.bo-qv__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1060;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.bo-qv__backdrop--visible {
  opacity: 1;
}

/* ===== Modal Container ===== */
.bo-qv__modal {
  position: fixed;
  z-index: 1070;
  background: #fff;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(50px) scale(0.95);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.bo-qv__modal--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Desktop: centered, max 1140px, 85vh */
@media (min-width: 992px) {
  .bo-qv__modal {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -44%) translateY(50px) scale(0.95);
    width: calc(100% - 64px);
    max-width: 1140px;
    height: 85vh;
    max-height: 85vh;
  }

  .bo-qv__modal--visible {
    transform: translate(-50%, -44%) translateY(0) scale(1);
  }
}

/* Mobile: near full-screen */
@media (max-width: 991px) {
  .bo-qv__modal {
    inset: 16px;
    border-radius: 8px;
  }
}

/* ===== Header Bar ===== */
.bo-qv__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--brand-primary, #005dac);
  flex-shrink: 0;
}

.bo-qv__header-title {
  font-family: var(--galls-font-gt-america-condensed);
  font-size: 18px;
  font-weight: var(--galls-fw-700, 700);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
}

.bo-qv__header-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s ease;
  padding: 0;
}

.bo-qv__header-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.bo-qv__header-close svg {
  width: 22px;
  height: 22px;
}

/* ===== Content (scrollable) ===== */
.bo-qv__content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 992px) {
  .bo-qv__content {
    padding: 32px;
  }
}

/* ===== Two-Column Layout ===== */
.bo-qv__layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 992px) {
  .bo-qv__layout {
    flex-direction: row;
    gap: 48px;
  }
}

/* ===== Left: Images ===== */
.bo-qv__images {
  width: 100%;
  display: flex;
  gap: 16px;
}

@media (min-width: 992px) {
  .bo-qv__images {
    width: 50%;
  }
}

/* Thumbnail strip */
.bo-qv__thumbs {
  display: none;
  flex-direction: column;
  gap: 10px;
  width: 72px;
  flex-shrink: 0;
}

@media (min-width: 992px) {
  .bo-qv__thumbs {
    display: flex;
  }
}

.bo-qv__thumb {
  aspect-ratio: 3 / 4;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #f5f5f5;
  padding: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bo-qv__thumb--active {
  border-color: var(--brand-primary, #005dac);
  box-shadow: 0 0 0 2px var(--brand-primary, #005dac), 0 0 0 3px #fff;
}

.bo-qv__thumb:hover:not(.bo-qv__thumb--active) {
  border-color: #999;
}

.bo-qv__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bo-qv__thumbs-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 28px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: #fff;
  color: #999;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease;
}

.bo-qv__thumbs-more:hover {
  background: #f5f5f5;
}

/* Main image */
.bo-qv__main-image {
  flex: 1;
  position: relative;
  background: #f8f8f8;
  border-radius: 8px;
  overflow: hidden;
  min-height: 300px;
}

@media (min-width: 992px) {
  .bo-qv__main-image {
    min-height: 400px;
  }
}

.bo-qv__main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  padding: 16px;
}

.bo-qv__zoom-hint {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  color: #666;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* ===== Right: Details ===== */
.bo-qv__details {
  width: 100%;
}

@media (min-width: 992px) {
  .bo-qv__details {
    width: 50%;
  }
}

/* Brand */
.bo-qv__brand {
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  color: var(--brand-primary, #005dac);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* Title */
.bo-qv__title {
  font-family: var(--galls-font-gt-america-standard);
  font-size: 22px;
  font-weight: var(--galls-fw-700, 700);
  color: #1a1a1a;
  line-height: 1.3;
  margin: 0 0 4px;
}

@media (min-width: 992px) {
  .bo-qv__title {
    font-size: 26px;
  }
}

/* Item number */
.bo-qv__item-number {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

.bo-qv__item-number-sep {
  margin: 0 8px;
  color: #ccc;
}

/* Sale badge + see-in-cart */
.bo-qv__sale-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.bo-qv__sale-badge {
  display: inline-block;
  background: #D0021B;
  color: #fff;
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bo-qv__see-cart {
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  color: #D0021B;
}

/* Price */
.bo-qv__price {
  font-size: 22px;
  font-weight: var(--galls-fw-700, 700);
  color: #1a1a1a;
  margin-bottom: 8px;
}

/* New Arrival badge */
.bo-qv__new-arrival {
  display: inline-block;
  background: #E6F4EA;
  color: #1E7E34;
  font-size: 10px;
  font-weight: var(--galls-fw-700, 700);
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(30, 126, 52, 0.2);
  margin-bottom: 12px;
}

/* Ratings row */
.bo-qv__ratings {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 20px;
}

.bo-qv__stars {
  display: flex;
  gap: 1px;
}

.bo-qv__stars svg {
  width: 16px;
  height: 16px;
}

.bo-qv__review-count {
  color: #888;
}

.bo-qv__ratings-sep {
  color: #ddd;
}

.bo-qv__ask-link {
  color: #888;
  text-decoration: none;
  transition: color 0.15s ease;
}

.bo-qv__ask-link:hover {
  color: var(--brand-primary, #005dac);
  text-decoration: underline;
}

/* QTY row */
.bo-qv__qty-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.bo-qv__qty-label {
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  color: #555;
}

.bo-qv__qty-select-wrap {
  position: relative;
  width: 72px;
}

.bo-qv__qty-select {
  width: 100%;
  height: 36px;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0 28px 0 12px;
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  font-family: var(--galls-font-gt-america-standard);
  appearance: none;
  -webkit-appearance: none;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bo-qv__qty-select:focus {
  outline: none;
  border-color: #1a1a1a;
  box-shadow: 0 0 0 1px #1a1a1a;
}

.bo-qv__qty-chevron {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #888;
}

/* Divider */
.bo-qv__divider {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 20px 0;
}

/* ===== Option Groups (Color, Size, Inseam) ===== */
.bo-qv__option-group {
  margin-bottom: 20px;
}

.bo-qv__option-label-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.bo-qv__option-label {
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  color: #1a1a1a;
}

.bo-qv__option-value {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
}

/* Color swatches */
.bo-qv__color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bo-qv__color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  outline: none;
}

.bo-qv__color-swatch:hover {
  transform: scale(1.1);
}

.bo-qv__color-swatch--selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a;
  transform: scale(1.1);
}

/* Size / option chips */
.bo-qv__size-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bo-qv__size-chip {
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  font-family: var(--galls-font-gt-america-standard);
  background: #fff;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.bo-qv__size-chip:hover {
  border-color: #999;
  background: #fafafa;
}

.bo-qv__size-chip--selected {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bo-qv__size-chip--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Availability message placeholder */
.bo-qv__availability {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: var(--galls-fw-500, 500);
  color: #888;
  margin-bottom: 24px;
}

/* ===== Action Buttons ===== */
.bo-qv__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 576px) {
  .bo-qv__actions {
    flex-direction: row;
  }
}

.bo-qv__atc-btn {
  flex: 1;
  height: 44px;
  background: #1a1a1a;
  color: #fff;
  font-family: var(--galls-font-gt-america-standard);
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.bo-qv__atc-btn:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.bo-qv__atc-btn:active {
  transform: translateY(0);
}

.bo-qv__list-btn {
  flex: 1;
  height: 44px;
  background: #fff;
  color: #1a1a1a;
  font-family: var(--galls-font-gt-america-standard);
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.bo-qv__list-btn:hover {
  background: #fafafa;
  border-color: #999;
}

/* ===== Loading State ===== */
.bo-qv__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: #888;
  font-size: 14px;
}

.bo-qv__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--brand-primary, #005dac);
  border-radius: 50%;
  animation: bo-qv-spin 0.7s linear infinite;
}

@keyframes bo-qv-spin {
  to { transform: rotate(360deg); }
}

/* ===== QV injected content overrides (Figma design) ===== */
/* Restyle the AJAX-loaded QV template to match the Figma QuickViewModal design. */
.bo-qv__qv-body {
  width: 100%;
}

.bo-qv__qv-body #QuickViewForm {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Two-column layout */
@media (min-width: 992px) {
  .bo-qv__qv-body #QuickViewForm {
    flex-direction: row;
    gap: 48px;
  }
}

/* ---- Left Column: Images ---- */
.bo-qv__qv-body .samPDP_Image,
.bo-qv__qv-body .product__gallery {
  width: 100%;
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

@media (min-width: 992px) {
  .bo-qv__qv-body .samPDP_Image,
  .bo-qv__qv-body .product__gallery {
    width: 50%;
    margin-bottom: 0;
  }
}

/* Main image */
.bo-qv__qv-body #product__gallery--active {
  flex: 1;
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  mix-blend-mode: multiply;
  background: #f8f8f8;
  border-radius: 8px;
  padding: 16px;
}

/* Thumbnails strip */
.bo-qv__qv-body #product__thumbnails--scroll,
.bo-qv__qv-body .product__thumbnails--scroll {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 72px;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: 500px;
}

@media (max-width: 991px) {
  .bo-qv__qv-body #product__thumbnails--scroll,
  .bo-qv__qv-body .product__thumbnails--scroll {
    flex-direction: row;
    width: 100%;
    max-height: none;
    overflow-x: auto;
    gap: 8px;
  }
}

.bo-qv__qv-body .product__gallery--thumbnail {
  width: 68px;
  height: auto;
  aspect-ratio: 3 / 4;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  background: #f5f5f5;
  object-fit: cover;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
}

.bo-qv__qv-body .product__gallery--thumbnail.active {
  border-color: var(--brand-primary, #005dac);
  box-shadow: 0 0 0 2px var(--brand-primary, #005dac), 0 0 0 3px #fff;
}

.bo-qv__qv-body .product__gallery--thumbnail:hover:not(.active) {
  border-color: #999;
}

/* ---- Right Column: Details ---- */
.bo-qv__qv-body .samPDP_Brand {
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  color: var(--brand-primary, #005dac);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.bo-qv__qv-body .samPDP_Title {
  font-family: var(--galls-font-gt-america-standard);
  font-size: 22px;
  font-weight: var(--galls-fw-700, 700);
  color: #1a1a1a;
  line-height: 1.3;
  margin: 0 0 4px;
}

@media (min-width: 992px) {
  .bo-qv__qv-body .samPDP_Title {
    font-size: 26px;
  }
}

/* SKU / Item number */
.bo-qv__qv-body .Qsku {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
  display: block;
}

/* Price */
.bo-qv__qv-body #QpriceMsg,
.bo-qv__qv-body .QpriceMsg {
  font-size: 22px;
  font-weight: var(--galls-fw-700, 700);
  color: #1a1a1a;
  margin-bottom: 8px;
}

.bo-qv__qv-body .mapmesg {
  display: inline-block;
  background: #D0021B;
  color: #fff;
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 8px;
  vertical-align: middle;
}

.bo-qv__qv-body .listprice {
  text-decoration: line-through;
  color: #aaa;
  font-size: 14px;
  font-weight: var(--galls-fw-400, 400);
}

/* ---- Option Groups (Color / Size / Inseam) ---- */
.bo-qv__qv-body .product__options--row {
  margin-bottom: 20px;
}

.bo-qv__qv-body .product__options--row > label,
.bo-qv__qv-body .product__options--row > span[id^="QorigDesc"] {
  font-size: 11px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  color: #1a1a1a;
  display: block;
  margin-bottom: 10px;
}

.bo-qv__qv-body #Qproduct__options--color-selected,
.bo-qv__qv-body #Qproduct__options--size,
.bo-qv__qv-body #Qproduct__options--size2 {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  margin-left: 8px;
}

/* Option chips (generic: size, inseam, etc.) */
.bo-qv__qv-body ul.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.bo-qv__qv-body ul.choices li {
  min-width: 44px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  font-family: var(--galls-font-gt-america-standard);
  background: #fff;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.bo-qv__qv-body ul.choices li:hover {
  border-color: #999;
  background: #fafafa;
}

.bo-qv__qv-body ul.choices li.active,
.bo-qv__qv-body ul.choices li.selected {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.bo-qv__qv-body ul.choices li.disabled,
.bo-qv__qv-body ul.choices li[data-class="disabled"] {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* Color swatches (Qopv1UL — typically color chips) */
.bo-qv__qv-body #Qopv1UL li {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bo-qv__qv-body #Qopv1UL li:hover {
  transform: scale(1.1);
  background: inherit;
  border-color: transparent;
}

.bo-qv__qv-body #Qopv1UL li.active,
.bo-qv__qv-body #Qopv1UL li.selected {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1a1a1a;
  transform: scale(1.1);
  background: inherit;
  border-color: transparent;
}

/* Stock message */
.bo-qv__qv-body #QstockMsg {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: var(--galls-fw-500, 500);
  color: #888;
  margin-bottom: 24px;
}

/* ---- Action Buttons ---- */
.bo-qv__qv-body .samPDP_AddToCart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (min-width: 576px) {
  .bo-qv__qv-body .samPDP_AddToCart {
    flex-direction: row;
  }
}

.bo-qv__qv-body .samPDP_AddToCart button,
.bo-qv__qv-body .samPDP_AddToCart input[type="button"] {
  flex: 1;
  height: 44px;
  background: #1a1a1a;
  color: #fff;
  font-family: var(--galls-font-gt-america-standard);
  font-size: 13px;
  font-weight: var(--galls-fw-700, 700);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.bo-qv__qv-body .samPDP_AddToCart button:hover,
.bo-qv__qv-body .samPDP_AddToCart input[type="button"]:hover {
  background: #333;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.bo-qv__qv-body .samPDP_AddToCart button:active,
.bo-qv__qv-body .samPDP_AddToCart input[type="button"]:active {
  transform: translateY(0);
}

/* Divider */
.bo-qv__qv-body hr {
  border: none;
  border-top: 1px solid #f0f0f0;
  margin: 20px 0;
}

/* Hide elements not in Figma design */
.bo-qv__qv-body #hiddenOverflow {
  display: contents;
}

/* QV hidden select elements — already hidden but ensure */
.bo-qv__qv-body .styleOptionQ {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
