/* =====================================================
   Barik Theme – Quick View modal
   Shared by every theme style; colors come from the
   tokens declared in css/<style>/style.css.
   ===================================================== */

:root {
  --bq-z: 10050;
  --bq-width: 940px;
  --bq-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* The .quickview-mini card trigger inherits its look from each theme
   style's own .wish-mini / .compare-mini rules in css/<style>/style.css,
   so it always matches the buttons it sits beside. Nothing to add here. */

/* -----------------------------------
Modal shell (built by js/quickview.js)
----------------------------------- */
.bq-modal {
  position: fixed;
  inset: 0;
  z-index: var(--bq-z);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--bq-ease);
}

.bq-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.bq-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.bq-dialog {
  position: relative;
  width: 100%;
  max-width: var(--bq-width);
  max-height: calc(100vh - 48px);
  background: var(--card, #fff);
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 24px;
  box-shadow: 0 30px 70px rgba(15, 23, 42, .28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  outline: none;
  transform: translateY(14px) scale(.98);
  transition: transform 260ms var(--bq-ease);
}

.bq-modal.is-open .bq-dialog {
  transform: translateY(0) scale(1);
}

.bq-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #e5e7eb);
  background: rgba(255, 255, 255, .92);
  color: #4b5563;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.bq-close:hover {
  background: #fef2f2;
  border-color: rgba(161, 20, 20, .35);
  color: var(--primary, #a11414);
}

/* Loading + error states */
.bq-loading,
.bq-error {
  padding: 48px 24px;
  text-align: center;
  font-size: 14px;
  color: var(--muted, #6b7280);
}

.bq-spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  border-radius: 999px;
  border: 2px solid var(--line, #e5e7eb);
  border-top-color: var(--primary, #a11414);
  animation: bq-spin 700ms linear infinite;
}

@keyframes bq-spin {
  to { transform: rotate(360deg); }
}

/* -----------------------------------
Body layout
----------------------------------- */
.bq-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 24px;
  padding: 24px;
  overflow-y: auto;
}

/* -----------------------------------
Gallery
----------------------------------- */
.bq-gallery-main {
  position: relative;
  background: var(--bg-alt, #f8fafc);
  border: 1px solid var(--border-soft, #e5e7eb);
  border-radius: 20px;
  overflow: hidden;
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bq-main-img {
  max-width: 100%;
  max-height: 300px;
  height: auto;
  display: block;
}

.bq-badge-stack {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.bq-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.bq-badge--sale {
  background: rgba(161, 20, 20, .12);
  color: var(--primary, #a11414);
  border: 1px solid rgba(161, 20, 20, .3);
}

.bq-badge--soldout {
  background: rgba(17, 24, 39, .75);
  color: #f9fafb;
  border: 1px solid rgba(15, 23, 42, .45);
}

.bq-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.bq-thumb {
  width: 62px;
  height: 56px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--border-soft, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.bq-thumb img {
  max-width: 100%;
  max-height: 46px;
  object-fit: contain;
}

.bq-thumb:hover {
  border-color: var(--primary, #a11414);
  transform: translateY(-1px);
}

.bq-thumb.is-active {
  border-color: var(--primary, #a11414);
  box-shadow: 0 0 0 2px rgba(161, 20, 20, .25);
}

/* -----------------------------------
Summary
----------------------------------- */
.bq-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.bq-meta-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-right: 40px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.bq-chip-brand {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #374151;
  text-decoration: none;
}

.bq-chip-brand:hover {
  border-color: var(--primary, #a11414);
  color: var(--primary, #a11414);
}

.bq-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-main, #111827);
}

.bq-rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted, #6b7280);
}

.bq-stars {
  color: #f59e0b;
  font-size: 13px;
  letter-spacing: 1px;
}

/* Price */
.bq-price-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fef2f2;
  border: 1px solid #fee2e2;
}

.bq-price-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bq-price-current {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--primary, #a11414);
}

.bq-price-old {
  font-size: 13px;
  color: #9ca3af;
}

.bq-price-meta {
  font-size: 11px;
  color: var(--muted, #6b7280);
}

.bq-price-tag {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: #b91c1c;
  color: #fee2e2;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
}

.bq-discounts {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* Options */
.bq-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

.bq-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bq-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bq-option-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted, #6b7280);
}

.bq-option.is-required .bq-option-label::after {
  content: " *";
  color: #b91c1c;
}

.bq-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-soft, #e5e7eb);
  background: var(--bg, #fff);
  color: var(--ink, #0f172a);
  font-size: 13px;
  font-family: inherit;
}

.bq-control:focus {
  outline: none;
  border-color: var(--primary, #a11414);
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(161, 20, 20, .2));
}

.bq-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bq-swatch {
  margin: 0;
  cursor: pointer;
}

.bq-swatch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.bq-swatch span {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.bq-swatch:hover span {
  border-color: #9ca3af;
  background: var(--bg, #fff);
}

.bq-swatch input:checked + span {
  background: #fef2f2;
  border-color: var(--primary, #a11414);
  color: var(--primary, #a11414);
  box-shadow: 0 0 0 2px rgba(161, 20, 20, .15);
}

.bq-swatch input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(161, 20, 20, .2));
}

.bq-option.has-error .bq-control,
.bq-option.has-error .bq-swatch span {
  border-color: #b91c1c;
}

.bq-option.has-error .bq-option-label {
  color: #b91c1c;
}

.bq-option-link {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #a11414);
}

/* Quantity + add to cart */
.bq-purchase-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bq-qty {
  display: inline-flex;
  align-items: center;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--border-soft, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
  overflow: hidden;
}

.bq-qty-btn {
  width: 38px;
  height: 100%;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 17px;
  cursor: pointer;
}

.bq-qty-input {
  width: 50px;
  height: 100%;
  border: none;
  border-left: 1px solid var(--border-soft, #e5e7eb);
  border-right: 1px solid var(--border-soft, #e5e7eb);
  text-align: center;
  font-size: 14px;
  background: var(--bg, #fff);
  color: var(--ink, #0f172a);
}

.bq-qty-input:focus {
  outline: none;
}

.bq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease, transform 80ms ease, box-shadow 180ms ease;
}

.bq-btn--primary {
  flex: 1 1 170px;
  height: 42px;
  background: var(--primary, #a11414);
  border-color: var(--primary, #a11414);
  color: #fff;
  box-shadow: 0 12px 26px rgba(161, 20, 20, .28);
}

.bq-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(127, 29, 29, .35);
}

.bq-btn--primary[disabled] {
  opacity: .65;
  cursor: progress;
  transform: none;
}

.bq-btn--subtle {
  padding: 6px 12px;
  font-size: 12px;
  border-color: var(--border-soft, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
  color: #374151;
}

.bq-btn--subtle:hover {
  border-color: var(--primary, #a11414);
  color: var(--primary, #a11414);
}

.bq-minimum {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.bq-form-feedback {
  font-size: 13px;
}

.bq-form-feedback:empty {
  display: none;
}

.bq-form-feedback .bq-msg-error {
  color: #b91c1c;
}

.bq-form-feedback .bq-msg-success {
  color: #166534;
}

.bq-sub-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bq-stock-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: #ecfdf3;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.bq-stock-chip.is-out {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* -----------------------------------
Footer
----------------------------------- */
.bq-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--border-soft, #e5e7eb);
  background: var(--bg-alt, #f8fafc);
}

.bq-foot-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #a11414);
  text-decoration: none;
}

.bq-foot-link:hover {
  text-decoration: underline;
}

/* -----------------------------------
Responsive
----------------------------------- */
@media (max-width: 860px) {
  .bq-body {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 20px;
  }

  .bq-gallery-main {
    min-height: 200px;
  }

  .bq-main-img {
    max-height: 220px;
  }
}

@media (max-width: 560px) {
  .bq-modal {
    padding: 0;
    align-items: flex-end;
  }

  .bq-dialog {
    max-width: none;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    transform: translateY(100%);
  }

  .bq-modal.is-open .bq-dialog {
    transform: translateY(0);
  }

  .bq-foot {
    padding: 12px 20px;
  }
}

body.bq-lock {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .bq-modal,
  .bq-dialog,
  .quickview-mini,
  .bq-thumb,
  .bq-btn {
    transition: none;
  }

  .bq-spinner {
    animation: none;
  }
}
