/* product-page.css — product-page-specific styles only.
   Shared tokens, reset, body, header, and footer live in index.css,
   which product-page.html loads before this file. */

/* ── Page layout ─────────────────────────────────────────────────────────── */

.page {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  align-items: start;
  flex: 1;
}

/* Prevent grid blowout when long field values or deeply nested content
   pushes the left column wider than its track. */
main { min-width: 0; }

/* ── Cards ───────────────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.card-head {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-head h2 {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--teal);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}

.badge {
  background: var(--teal-light);
  color: var(--teal);
  font-size: 0.58rem;
  font-weight: 600;
  padding: 3px 8px;
  margin-left: auto;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.card-body { padding: 20px 22px; }

/* ── Section title ───────────────────────────────────────────────────────── */

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dark, #1a1a1a);
  padding-top: 24px;
  padding-bottom: 4px;
  border-bottom: 2px solid currentColor;
  margin-bottom: 16px;
  margin-top: 8px;
}

.section-title:first-child { margin-top: 0; padding-top: 0; }

.section-description {
  font-size: 13px;
  color: var(--color-text-secondary, #666);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── Product overview ────────────────────────────────────────────────────── */

/* Hero image — primary product photo, full card width */
.product-hero-img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  background: transparent;
  display: block;
  margin-bottom: 16px;
  border: 1px solid var(--border-lt);
  padding: 12px;
}

/* Hero gallery (multi-image) — override standard sp-gallery slide sizing.
   .sp-gallery .sp-slide sets height:200px at specificity 0,2,0; this rule
   uses the #productHero ID to win at 1,2,0 and restore full-width behaviour. */
#productHero .sp-gallery {
  width: 100%;
  margin-bottom: 16px;
  border: 1px solid var(--border-lt);
}
#productHero .sp-gallery .sp-slide {
  height: auto;
  max-height: 420px;
  border: none;
  margin-bottom: 0;
}

/* Reference image grid — dimension/detail images below the description */
.product-reference-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.product-reference-grid img {
  width: 100%;
  height: auto;
  max-height: 130px;
  object-fit: contain;
  background: var(--teal-pale);
  border: 1px solid var(--border-lt);
  padding: 8px;
  display: block;
}

.product-desc {
  font-size: 0.79rem;
  color: var(--mid);
  line-height: 1.8;
  font-weight: 300;
}

.product-desc strong {
  color: var(--dark);
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

/* ── Contextual section reference images ─────────────────────────────────── */
/* Injected inside configuration sections by injectSectionImages() in product-page.js */

.section-reference-image {
  margin-top: 16px;
  margin-bottom: 4px;
  border: 1px solid var(--border-lt);
  background: transparent;
}

.section-reference-image img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: contain;
  display: block;
  padding: 12px;
  background: transparent;
}

/* ── Dimension fields 2-column grid ──────────────────────────────────────── */

.dims-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* ── Drawer height fields 3-column grid ──────────────────────────────────── */

.drawer-heights-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin-bottom: 14px;
}

.drawer-height-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal);
  font-size: 0.62rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* Suppress the generated label inside drawer height cells — badge replaces it */
.drawer-height-cell .field label { display: none; }
.drawer-height-cell .field { margin-bottom: 0; }

/* ── Input groups — hand-authored fields (customer details) ──────────────── */

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.input-wrap { position: relative; }

.input-wrap input,
.input-wrap select,
.input-wrap textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  resize: vertical;
  transition: border-color 0.15s;
}

.input-wrap input[type="number"] { padding-right: 40px; }

.input-wrap input:focus,
.input-wrap select:focus,
.input-wrap textarea:focus {
  outline: none;
  border-color: var(--teal-mid);
}

.input-unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 500;
  pointer-events: none;
}

.customer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

/* ── JS-generated fields (.field) ────────────────────────────────────────── */
/* product-page.js renders: .field > label + input/select + .field-description + .field-error */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.field:last-child { margin-bottom: 0; }

.field label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--dark);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 400;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--teal-mid);
}

/* ── Custom select wrapper ────────────────────────────────────────────────── */

.select-wrap {
  position: relative;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a9e9f' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* ── Dependent (conditional) fields ─────────────────────────────────────── */

.field[data-dependent] {
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin-left: 4px;
}

/* ── Finish section ──────────────────────────────────────────────────────── */

.finish-section {
  margin-bottom: 14px;
}

.finish-section .section-title {
  margin-top: 0;
}

.finish-group {
  margin-bottom: 18px;
}

.finish-group:last-child {
  margin-bottom: 0;
}

.finish-group-title {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ── Option cards (finish selection) ─────────────────────────────────────── */

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.option-card {
  border: 1px solid var(--border);
  padding: 12px 14px;
  cursor: pointer;
  background: var(--white);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}

/* Hide the actual radio button — selection is shown via card border/bg */
.option-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.option-card:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-pale);
}

.opt-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dark);
}

.opt-sub {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
  font-weight: 300;
}

.option-price {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--teal);
  white-space: nowrap;
  align-self: center;
}

/* 3-column option grid — used for lock finish image cards */
.option-grid--3 {
  display: flex;
  justify-content: center;
  gap: 8px;
}

/* Stacked image+label card — image on top, label below */
.option-card--stacked {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  gap: 0;
}

.option-card-img {
  width: 100%;
  max-width: 100%;
  height: 120px;
  object-fit: contain;
  background: transparent;
  display: block;
  padding: 8px;
}

.option-card--stacked .opt-label {
  padding: 8px 10px;
  font-size: 0.72rem;
  text-align: center;
  line-height: 1.3;
  white-space: pre-line;
  border-top: 1px solid var(--border-lt);
}

/* Colour field inside a finish group: remove the dependent left-border indent
   since the group already provides visual context */
.finish-group .field[data-dependent] {
  border-left: none;
  padding-left: 0;
  margin-left: 0;
  margin-top: 10px;
  margin-bottom: 0;
}

.field-description {
  font-size: 0.62rem;
  color: var(--muted);
  font-weight: 300;
}

.field-error {
  font-size: 0.62rem;
  color: var(--red);
  font-weight: 400;
}

.field input.input-error,
.field select.input-error {
  border-color: var(--red);
  background: #fdf8f8;
}

/* ── Computed values bar (drawer unit contextual info) ───────────────────── */

.computed-values-bar {
  background: var(--teal-pale);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 0.75rem;
  color: var(--teal-dk);
  margin-top: 12px;
  margin-bottom: 8px;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Full-width section reference image (tradie-rack dimension diagrams) ─── */

.section-reference-image--full {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.section-reference-image--full img {
  width: 100%;
  height: auto;
  max-height: none;
  padding: 0;
}

/* ── Qty stepper (in quote panel) ────────────────────────────────────────── */

.qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border-lt);
  border-bottom: 1px solid var(--border-lt);
}

.qty-row-label {
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.qty-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
}

.qty-btn {
  width: 32px;
  height: 32px;
  background: var(--white);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 400;
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  font-family: var(--font-body);
}
.qty-btn:hover { background: var(--teal-pale); }
.qty-btn:active { background: var(--teal-light); }

.qty-val {
  min-width: 36px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--dark);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 0 8px;
  line-height: 32px;
}

/* ── Quote panel ─────────────────────────────────────────────────────────── */

.quote-panel {
  background: var(--white);
  border: 1px solid var(--border);
  position: sticky;
  top: 20px;
}

.quote-head {
  background: var(--teal-dk);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quote-head-left h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.quote-head-left p {
  font-size: 0.74rem;
  color: rgba(255, 255, 255, 0.72);
}

/* Standard client logo class — applied to all logo imgs in headers and panels */
.client-logo { max-height: 48px; max-width: 200px; width: auto; height: auto; object-fit: contain; }

.quote-body { padding: 18px 20px; }

/* ── SVG preview diagram ─────────────────────────────────────────────────── */

.preview-box {
  background: var(--teal-pale);
  border: 1px solid var(--border-lt);
  margin-bottom: 16px;
  height: 190px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Lead time box (populated by product-page.js via #productLeadTime) ────── */

.lead-time-box {
  background: var(--teal-pale);
  border: 1px solid var(--border-lt);
  border-left: 3px solid var(--teal-mid);
  padding: 9px 12px;
  font-size: 0.7rem;
  color: var(--mid);
  font-weight: 400;
  margin-bottom: 20px;
}

/* ── Quote summary content (rendered by product-page.js) ─────────────────── */

/* Each p is a key-value pair: <p><strong>Label:</strong> value</p>
   Flex + space-between naturally splits the strong (label) and the text
   node (value) to opposite sides. */

#quoteSummary {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-lt);
}

#quoteSummary p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.76rem;
  font-weight: 300;
  color: var(--dark);
  line-height: 1.65;
  margin-bottom: 8px;
}

#quoteSummary p:last-child { margin-bottom: 0; }

/* Label sits on the left: muted, lighter */
#quoteSummary p strong {
  color: var(--muted);
  font-weight: 300;
  flex-shrink: 0;
  margin-right: 12px;
}

#quoteSummary hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* Estimated Total row — the last <p> after the pricing <hr>. */
#quoteSummary hr ~ p:last-child {
  align-items: flex-end;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-lt);
}

#quoteSummary hr ~ p:last-child strong {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding-bottom: 6px; /* align baseline to bottom of large value */
}

/* Large Cormorant price figure — applied to the span wrapping the amount. */
.total-price {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 300;
  color: var(--teal-dk);
  line-height: 1;
}

/* Placeholder shown when total is zero — no dimensions entered yet */
.total-price-placeholder {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 300;
  font-style: italic;
  line-height: 1.5;
}

/* ── Summary error block ─────────────────────────────────────────────────── */

/* Error list p's are descendants of #quoteSummary and would inherit
   display:flex. Use higher specificity to restore block layout. */
.summary-error-list {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: #fdf0ef;
  border-left: 2px solid var(--red);
}

#quoteSummary .summary-error-list p {
  display: block;
  font-family: var(--font-body);
  font-size: 0.74rem;
  color: var(--red);
  font-weight: 400;
  margin-bottom: 4px;
}

#quoteSummary .summary-error-list p:last-child { margin-bottom: 0; }

/* ── GST / pricing note ──────────────────────────────────────────────────── */

.gst-note {
  font-size: 0.64rem;
  color: var(--muted);
  font-weight: 300;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  min-height: 0;
}

.gst-note:empty { margin-bottom: 0; }

/* ── CTA note ────────────────────────────────────────────────────────────── */

.cta-note {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* ── Submit button ───────────────────────────────────────────────────────── */

.btn-submit {
  width: 100%;
  padding: 18px 32px;
  background: var(--teal-dk);
  color: var(--white);
  border: none;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(44, 67, 71, 0.25);
}

.btn-submit:not(:disabled):hover { background: var(--teal-mid); }

.btn-submit:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

/* ── Submit status message ───────────────────────────────────────────────── */

#submitStatus {
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 400;
  color: var(--mid);
  display: none;
  margin-top: 8px;
  padding: 9px 13px;
}

#submitStatus:not(:empty) { display: block; }

#submitStatus.status-ok {
  background: #eef5f0;
  border-left: 2px solid var(--green);
  color: var(--green);
}

#submitStatus.status-err {
  background: #fdf0ef;
  border-left: 2px solid var(--red);
  color: var(--red);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 780px) {
  .page {
    grid-template-columns: 1fr;
    margin: 20px auto;
  }
  /* Quote panel drops below configuration; sticky removed, full width */
  .quote-panel { position: static; width: 100%; }
  /* Hero image smaller on mobile */
  .product-hero-img { max-height: 280px; }
  .customer-grid { grid-template-columns: 1fr; }
  /* All inputs full width */
  .field input[type="number"],
  .field input[type="text"],
  .field select { width: 100%; min-width: 0; }
  /* Dimension grid: single column on mobile */
  .dims-grid { grid-template-columns: 1fr; }
  /* Drawer heights: 2 per row on mobile */
  .drawer-heights-grid { grid-template-columns: repeat(2, 1fr); }
  /* Cart panel full width on mobile */
  .cart-panel { width: 100vw; right: 0; }
  /* Header trust items hidden */
  .header-right { display: none; }
}

/* ── Embed mode (iframe embedding) ──────────────────────────────────────── */

.embed-mode {
  background: transparent;
}
.embed-mode .product-page-wrap {
  padding-top: 0;
}
