/* ==========================================================================
   Quick View Modal — Phase 3B
   ========================================================================== */

#truoath-qv-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99000;
}

#truoath-qv-modal.is-open {
  display: block;
}

/* Backdrop */
.tqv-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 14, 10, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: tqvFadeIn 0.3s ease forwards;
}

/* Panel */
.tqv-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1000px);
  max-height: 90vh;
  background: var(--truoath-cream, #FFFCF7);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tqvSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  border-radius: 0;
}

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

@keyframes tqvSlideUp {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 24px)); }
  to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* Close button */
.tqv-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--truoath-black, #110e0a);
  opacity: 0.5;
  transition: opacity 0.2s;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tqv-close:hover { opacity: 1; }

/* Body */
.tqv-body {
  flex: 1;
  overflow-y: auto;
  padding: 48px 48px 40px;
  -webkit-overflow-scrolling: touch;
}

/* Loading spinner */
.tqv-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

.tqv-spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(196, 168, 130, 0.3);
  border-top-color: var(--truoath-brown, #c4a882);
  border-radius: 50%;
  animation: truoath-spin 0.8s linear infinite;
}

/* Error state */
.tqv-error {
  text-align: center;
  color: var(--truoath-warm-grey, #8a7f74);
  padding: 40px 20px;
  font-size: 0.9rem;
}

.tqv-error a {
  color: var(--truoath-brown, #c4a882);
  text-decoration: underline;
}

/* ==========================================================================
   QV Inner Layout — mirrors the product page layout (2-col)
   ========================================================================== */

.tqv-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

/* Gallery */
.tqv-gallery__main {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f4f1eb;
  margin-bottom: 12px;
}

.tqv-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s ease;
  display: block;
}

.tqv-thumbs {
  display: flex;
  gap: 8px;
}

.tqv-thumb {
  width: 64px;
  height: 64px;
  border: 1.5px solid transparent;
  cursor: pointer;
  overflow: hidden;
  background: #f4f1eb;
  padding: 0;
  transition: border-color 0.2s;
}

.tqv-thumb:hover,
.tqv-thumb.is-active {
  border-color: var(--truoath-brown, #c4a882);
}

.tqv-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Summary */
.tqv-summary {
  padding-top: 4px;
}

.tqv-category {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--truoath-warm-grey, #8a7f74);
  margin-bottom: 8px;
  font-weight: 600;
}

.tqv-title {
  font-family: var(--font-heading, 'Cormorant Garamond', serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--truoath-black, #110e0a);
  margin: 0 0 10px;
  line-height: 1.2;
}

.tqv-price {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--truoath-black, #110e0a);
  margin-bottom: 24px;
}

.tqv-price del {
  color: var(--truoath-warm-grey, #8a7f74);
  font-size: 0.9rem;
  margin-right: 8px;
  font-weight: 400;
}

.tqv-divider {
  border: none;
  border-top: 1px solid rgba(196, 168, 130, 0.3);
  margin: 20px 0;
}

/* Variation pills inside QV */
.tqv-summary .truoath-variant-pills {
  margin-bottom: 16px;
}

/* ATC form inside QV */
.tqv-summary .cart {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.tqv-summary .qty {
  display: none; /* hide quantity input in QV — keeps it simple */
}

.tqv-summary .single_add_to_cart_button,
.tqv-summary button[type="submit"] {
  width: 100%;
  padding: 16px;
  background: var(--truoath-black, #111111);
  color: var(--truoath-cream, #FFFCF7);
  border: none;
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.2s;
  border-radius: 0;
}

.tqv-summary .single_add_to_cart_button:hover {
  opacity: 0.8;
}

.tqv-view-full {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--truoath-warm-grey, #8a7f74);
  text-decoration: none;
  margin-top: 12px;
  transition: color 0.2s;
}

.tqv-view-full:hover {
  color: var(--truoath-black, #110e0a);
  text-decoration: underline;
}

/* Quick View button on shop card (Circular FAB) */
.truoath-quick-view-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--truoath-white, #FFFFFF);
  color: var(--truoath-black, #111111);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 3;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.truoath-quick-view-btn:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.truoath-product-card:hover .truoath-quick-view-btn {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Badge redesign */
.truoath-product-card__badge--soldout {
  background: var(--truoath-black, #110e0a);
  color: var(--truoath-cream, #faf7f2);
}

.truoath-product-card__badge--bestseller {
  background: #7a5c38;
  color: var(--truoath-cream, #faf7f2);
}

/* Hover second image (3A) */
.truoath-product-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.truoath-product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.truoath-product-card__img--primary {
  z-index: 1;
  transition: opacity 0.45s ease;
}

.truoath-product-card__img--hover {
  z-index: 0;
  opacity: 0;
  transition: opacity 0.45s ease;
}

/* On hover: primary fades, hover image reveals */
.truoath-product-card--has-hover:hover .truoath-product-card__img--primary {
  opacity: 0;
}

.truoath-product-card--has-hover:hover .truoath-product-card__img--hover {
  opacity: 1;
}

/* image-wrap must be relative + overflow hidden for this to work */
.truoath-product-card__image-wrap {
  position: relative;
  overflow: hidden;
  background: #f4f1eb;
  aspect-ratio: 1 / 1;
  margin-bottom: 20px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .tqv-panel {
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    animation: tqvSlideUpMobile 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  #truoath-qv-modal.is-open .tqv-panel {
    transform: translateY(0);
  }

  @keyframes tqvSlideUpMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .tqv-inner {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .tqv-body {
    padding: 32px 20px 28px;
  }

  .truoath-quick-view-btn {
    opacity: 1;
    transform: none !important;
    position: absolute;
    top: 8px;
    right: 8px;
    left: auto;
    bottom: auto;
    width: 36px;
    height: 36px;
  }
}

