/* ==========================================================================
   Product detail page
   ========================================================================== */

.product-detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  /* deliberately not align-items:start — the media column must stretch to
     the row height so its sticky child has room to actually stick as the
     page scrolls (with align-items:start the grid cell only wraps its
     content and sticky has no range to move within). */
}

.product-detail-media-wrap { min-width: 0; }

.product-detail-media {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(155deg, var(--slate-100), #E7ECF3);
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 90px;
}
.product-detail-media img { width: 100%; height: 100%; object-fit: contain; padding: 6%; box-sizing: border-box; }
.product-detail-media svg { width: 30%; height: 30%; color: var(--navy); opacity: 0.85; }

.product-detail-thumbs { display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.product-detail-thumb {
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: linear-gradient(155deg, var(--slate-100), #E7ECF3);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.product-detail-thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8%; box-sizing: border-box; }
.product-detail-thumb.is-active { border-color: var(--navy); }

.product-detail-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--slate-100);
  color: var(--navy);
}
.badge svg { width: 14px; height: 14px; }
.badge-condition { background: #E7F5EC; color: #15803D; }
.badge-warning { background: #FEF2F2; color: #B91C1C; }

.product-detail-title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem); margin-bottom: var(--space-3); }
.product-detail-price { font-family: var(--font-heading); font-weight: 700; font-size: 2rem; color: var(--navy); margin-bottom: var(--space-2); }
.product-detail-stock { display: flex; align-items: center; gap: 6px; font-size: 14.5px; color: #15803D; margin-bottom: var(--space-5); }
.product-detail-stock svg { width: 16px; height: 16px; }

.product-detail-desc { font-size: 1.02rem; color: var(--color-text); line-height: 1.6; margin-bottom: var(--space-6); }

.product-detail-actions { display: flex; gap: var(--space-3); margin-bottom: var(--space-6); flex-wrap: wrap; }
.product-detail-actions .btn { flex: 1 1 200px; }

.warranty-picker {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.warranty-picker-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14.5px;
  margin-bottom: var(--space-3);
}
.warranty-picker-label svg { width: 17px; height: 17px; color: var(--coral); }
.warranty-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14.5px;
}
.warranty-option:hover { background: var(--color-bg-alt); }
.warranty-option:has(input:checked) { background: #FDECEE; }
.warranty-option input[type="radio"], .warranty-option input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--coral); flex-shrink: 0; }
.warranty-option .warranty-price { margin-left: auto; font-weight: 600; color: var(--navy); }

.fob-required-tag {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #DC2626;
  background: #FEF2F2;
  border-radius: 999px;
  padding: 2px 8px;
}
.fob-picker-hint { font-size: 13px; color: var(--color-text-muted); margin-top: var(--space-2); padding: 0 var(--space-3); }
.fob-picker-error { font-size: 13.5px; color: #DC2626; margin-top: var(--space-2); padding: 0 var(--space-3); font-weight: 600; }
.key-option { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); font-size: 14.5px; }
.key-option-each { display: block; font-size: 13px; color: var(--color-text-muted); }
.key-stepper { margin-left: auto; display: inline-flex; align-items: center; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.key-stepper button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 18px; line-height: 1; color: var(--navy); cursor: pointer; }
.key-stepper button:hover:not(:disabled) { background: var(--color-bg-alt); }
.key-stepper button:disabled { opacity: 0.35; cursor: default; }
.key-stepper [data-key-count] { min-width: 30px; text-align: center; font-weight: 600; }

.spec-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
}
.spec-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
}
.spec-row:nth-child(even) { background: var(--color-bg-alt); }
.spec-row dt { font-weight: 600; color: var(--navy); }
.spec-row dd { margin: 0; color: var(--color-text-muted); }

.detail-note {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: 13.5px;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
}
.detail-note svg { width: 18px; height: 18px; color: var(--coral); flex-shrink: 0; margin-top: 1px; }
.detail-note.warning { background: #FEF2F2; color: #7F1D1D; }
.detail-note.warning svg { color: #DC2626; }

.product-not-found {
  text-align: center;
  padding: var(--space-9) var(--space-5);
}
.product-not-found svg { width: 48px; height: 48px; color: var(--slate); margin: 0 auto var(--space-4); }

@media (max-width: 900px) {
  .product-detail-layout { grid-template-columns: 1fr; }
  .product-detail-media { position: static; aspect-ratio: 4/3; }
  .spec-row { grid-template-columns: 130px 1fr; }
}

.related-products { margin-top: var(--space-6); padding: var(--space-6) 0 0; border-top: 1px solid var(--color-border); }
.related-products h2 { font-size: 1.3rem; margin-bottom: var(--space-4); }
.related-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1024px) { .related-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .related-grid { grid-template-columns: 1fr; } }

.product-detail-rating { display: inline-block; font-size: 14.5px; color: var(--color-text-muted); text-decoration: none; margin-bottom: var(--space-4); }
.product-detail-rating:hover { color: var(--coral); }
.review-stars { color: #F5A524; letter-spacing: 1px; }
.product-reviews { margin-top: var(--space-6); padding: var(--space-6) 0 0; border-top: 1px solid var(--color-border); max-width: 760px; }
.product-reviews h2 { font-size: 1.3rem; margin-bottom: var(--space-2); }
.reviews-summary { margin-bottom: var(--space-4); font-size: 15px; }
.review-card { border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4); margin-bottom: var(--space-3); background: #fff; }
.review-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.review-verified { font-size: 12.5px; font-weight: 600; color: #15803D; background: #DCFCE7; border-radius: 999px; padding: 2px 9px; }
.review-card-body { line-height: 1.6; }
.review-card-date { font-size: 13px; color: var(--color-text-muted); margin-top: var(--space-2); }

.upgrade-choice { padding: var(--space-2) var(--space-3) var(--space-1) calc(var(--space-3) + 29px); }
.upgrade-choice label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.upgrade-choice select { width: 100%; max-width: 420px; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 8px 10px; font: inherit; font-size: 14.5px; background: #fff; }
.upgrade-choice .fob-picker-error { padding: 0; }

/* Full-screen photo viewer (product-detail.js) */
.product-detail-media img.is-zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10, 18, 32, 0.94);
  display: flex; align-items: center; justify-content: center;
  padding: 56px 16px;
}
.lightbox[hidden] { display: none; }
.lightbox-img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: var(--radius-md); }
.lightbox-close, .lightbox-nav {
  position: absolute; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); color: #fff; cursor: pointer;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255, 255, 255, 0.26); }
.lightbox-close svg, .lightbox-nav svg { width: 22px; height: 22px; }
.lightbox-close { top: 12px; right: 12px; }
.lightbox-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lightbox-count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, 0.8); font-size: 14px; }
@media (max-width: 560px) {
  .lightbox { padding: 64px 8px; }
  .lightbox-nav { top: auto; bottom: 8px; transform: none; }
  .lightbox-count { bottom: 20px; }
}

/* "What's Included" checklist under the description */
.product-includes { background: var(--color-bg-alt); border-radius: var(--radius-lg); padding: var(--space-4); margin: calc(-1 * var(--space-3)) 0 var(--space-5); }
.product-includes-title { font-size: 1rem; margin-bottom: var(--space-3); }
.product-includes ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.product-includes li { display: flex; align-items: flex-start; gap: var(--space-2); font-size: 15px; line-height: 1.45; }
.product-includes li svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; color: #15803D; }
