/* =============================================
   SELF SERVICE — online-order.css
   Extends styles.css. Uses its variables only.
   Breakpoints: ≤1024px tablet, ≤768px mobile.
============================================= */
/* ── CARDS SECTION ── */
.ss-cards-inner { max-width: var(--max-w); margin: 0 auto; }
.ss-grid-label { margin-bottom: 24px; }
.ss-cards-grid { display: grid; grid-template-columns: repeat(4,1fr); column-gap: 16px; row-gap: 32px; align-items: stretch; }

/* ── CATEGORY TOGGLE (Gates / Fence Panels) ── */
.ss-category-toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--off-white); border: 2px solid var(--border); border-radius: var(--radius);
  margin-bottom: 24px;
}
.ss-category-btn {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: var(--text-s); font-weight: 600; color: var(--text-muted);
  padding: 9px 18px; border-radius: var(--radius); transition: background var(--transition), color var(--transition);
}
.ss-category-btn:hover { color: var(--text); }
.ss-category-btn.active { background: var(--teal-mid); color: var(--white); }

/* ── PRODUCT CARD ── */
/* Compact and content-sized — no flip, no fixed/shared height. Each
   card is only as tall as its own image + text, so a short
   description no longer drags a big empty gap along with it. The
   6-step configurator lives in one shared modal (see below) instead
   of on the back of every card. */
.ss-product-card {
  /* cursor: pointer; */
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--white);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: var(--text-s);
  display: flex; flex-direction: column;
  transition: border-color var(--transition), box-shadow var(--transition-slow);
}
.ss-product-card:hover { border-color: var(--teal-accent); box-shadow: var(--shadow-lg); }

/* ── FRONT IMAGE SLIDER ── */
.ss-front-img { position: relative; height: 220px; overflow: hidden; flex-shrink: 0; }
.ss-slides-track { display: flex; height: 100%; transition: transform 0.4s ease; }
.ss-slide { min-width: 100%; height: 100%; }
.ss-slide img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
/* Portrait product photos (e.g. a gate shot tall to show its full
   height) — cropping to fill the box would cut the top or bottom off
   the gate, so these show uncropped instead: full height, width sized
   to match instead of stretched/cropped, centred in the box. */
.ss-slide-contain img { width: auto; height: 100%; object-fit: contain; object-position: center; margin: 0 auto; background: var(--off-white); }
.ss-img-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.ss-dot { width: 6px; height: 6px; border-radius: var(--radius-circle); background: var(--on-dark-mid); transition: background var(--transition); }
.ss-dot.active { background: var(--white); }
.ss-front-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--teal-mid); color: var(--white);
  font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius);
  font-size:var(--text-s);
}
.ss-front-badge.premium { background: var(--gold); }

/* ── FRONT BODY ── */
.ss-front-body { padding: 22px; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.ss-front-body h2 { font-size: var(--text-base); font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ss-front-body > p { color: var(--text-muted); line-height: var(--leading-body); margin-bottom: 12px; flex: 1; }
.ss-front-price { font-size: var(--text-base); color: var(--text-muted); margin-bottom: 10px; }
.ss-front-price strong { color: var(--teal-mid); font-size: var(--text-base); font-weight: 700; }
.ss-front-features { list-style: none; display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; font-size:var(--text-s)}
.ss-front-features li { color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.ss-front-features .fa-check { color: var(--teal-mid); font-size: 10px; }
.ss-front-cta {
  background: var(--teal-mid); color: var(--white);
  font-weight: 600; font-family: var(--font); font-size: var(--text-s);
  padding: 11px 18px; border-radius: var(--radius); border: none;
  text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background var(--transition); cursor: pointer; width: 100%;
}
.ss-product-card:hover .ss-front-cta { background: var(--teal-dark); }

/* ── CONFIGURATOR MODAL ──
   One shared overlay for every product (see comment in
   online-order.html) instead of a per-card flip — the modal box has
   no fixed height, so it always sizes to whatever the current step
   actually contains, with a max-height + internal scroll as a safety
   net for short viewports. */
.ss-modal-overlay {
  position: fixed; inset: 0; z-index: 3000;
  background: var(--overlay-black-mid);
  display: flex; align-items: start; justify-content: center;
  padding: 24px;
}
.ss-modal-overlay[hidden] { display: none; }
body.ss-modal-open { overflow: hidden; }
.ss-modal {
  width: 100%; max-width: 560px; max-height: 85vh;
  background: var(--white); border-radius: var(--radius-lg);
  border: 2px solid var(--teal-mid);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  font-size: var(--text-s);
}

/* ── BACK HEADER ── */
.ss-back-header {
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal-deeper) 100%);
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.ss-back-title { color: var(--white); font-weight: 700; font-size: var(--text-base); }
.ss-modal-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ss-back-reset {
  background: var(--overlay-white-md); border: 1px solid var(--border-on-dark-md);
  color: var(--on-dark-high); font-family: var(--font);font-size: var(--text-s);
  font-weight: 500; padding: 5px 12px;
  border-radius: var(--radius); cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: background var(--transition);
}
.ss-back-reset:hover { background: var(--overlay-white-lg); }
.ss-modal-close {
  background: var(--overlay-white-md); border: 1px solid var(--border-on-dark-md);
  color: var(--on-dark-high); width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-circle); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.ss-modal-close:hover { background: var(--overlay-white-lg); }

/* ── PROGRESS BAR ── */
.ss-back-progress {
  padding: 12px 20px 8px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.ss-prog-bar { flex: 1; height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; }
.ss-prog-fill { height: 100%; background: linear-gradient(90deg, var(--teal-mid), var(--teal-accent)); border-radius: 4px; transition: width 0.35s ease; width: 25%; }
.ss-prog-label { color: var(--text-muted); white-space: nowrap; font-size: var(--text-s)}

/* ── BACK STEPS ── */
.ss-back-steps { padding: 20px; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.ss-back-step { display: flex; flex-direction: column; flex: 1; }
.ss-back-step[hidden] { display: none; }
.ss-step-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ss-step-body > * { margin: 0 !important; }
.ss-step-body h3 { font-size: var(--text-base); font-weight: 700; color: var(--text); }
.ss-step-body > p { color: var(--text-muted); font-size: var(--text-s); }

/* Spacer pushes nav to bottom without stretching buttons */
.ss-step-spacer { flex: 1; min-height: 8px; }

/* ── STEP NAV ── */
.ss-step-nav { display: flex; gap: 8px; margin-top: 16px; }
/* Override btn-ghost for use inside dark-bordered card back */
.ss-btn-dark {
  color: var(--text-muted) !important;
  border-color: var(--border) !important;
  background: transparent !important;
}
.ss-btn-dark:hover { color: var(--text) !important; border-color: var(--teal-accent) !important; background: var(--teal-pale) !important; }
.ss-step-next, .ss-install-next, .ss-send-btn { flex: 1; }

/* ── UNIT TOGGLE (m / mm) — UI only, values are converted to metres
   before validation/pricing/storage, see toMetres() in online-order.js ── */
.ss-unit-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.ss-unit-row-label { font-weight: 600; color: var(--text); font-size: var(--text-s); }
.ss-unit-toggle {
  display: inline-flex; gap: 4px; padding: 3px;
  background: var(--off-white); border: 2px solid var(--border); border-radius: var(--radius);
}
.ss-unit-btn {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font); font-size: var(--text-s); font-weight: 600; color: var(--text-muted);
  padding: 5px 14px; border-radius: var(--radius); transition: background var(--transition), color var(--transition);
}
.ss-unit-btn:hover { color: var(--text); }
.ss-unit-btn.active { background: var(--teal-mid); color: var(--white); }

/* ── FIELDS ── */
.ss-dim-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ss-field-wrap { display: flex; flex-direction: column; gap: 4px;}
.ss-field-wrap label { font-weight: 600; color: var(--text); font-size: var(--text-s)}
.ss-field-wrap input[type="number"],
.ss-field-wrap input[type="email"],
.ss-field-wrap input[type="text"],
.ss-field-wrap input[type="tel"] {
  padding: 10px 13px; border: 2px solid var(--border); border-radius: var(--radius);
  /* 16px, not var(--text-s)/14px — iOS Safari (and Chrome/other
     browsers on iOS, which are all WebKit under the hood) auto-zooms
     the viewport on focus for any input with font-size below 16px,
     and that zoomed state is what caused the reported "page width
     overflow on mobile once you start typing". */
  font-size: var(--text-base); font-family: var(--font); color: var(--text);
  background: var(--off-white); transition: border-color var(--transition); width: 100%;
}
.ss-field-wrap input:focus { outline: none; border-color: var(--teal-mid); background: var(--white); box-shadow: 0 0 0 3px var(--focus-glow); }
.ss-field-wrap input.field-error { border-color: var(--error-border) !important; }

/* ── ERROR HIGHLIGHT for non-input choice groups (install options, colour swatches) ── */
.ss-option-stack.field-error .ss-opt-inner { border-color: var(--error-border) !important; }
.ss-colour-grid.field-error .ss-swatch { box-shadow: 0 0 0 2px var(--error-border); }
.ss-colour-groups.field-error { box-shadow: 0 0 0 2px var(--error-border); border-radius: var(--radius); }
.ss-colour-grid label{font-size: var(--text-s)}
.ss-field-wrap textarea {
  padding: 10px 13px; border: 2px solid var(--border); border-radius: var(--radius);
  font-size: var(--text-base); font-family: var(--font); color: var(--text);
  background: var(--off-white); transition: border-color var(--transition);
  width: 100%; resize: vertical; min-height: 72px;
}
.ss-field-wrap textarea:focus { outline: none; border-color: var(--teal-mid); background: var(--white); box-shadow: 0 0 0 3px var(--focus-glow); }
.ss-hint { color: var(--text-muted); }
.ss-optional { color: var(--placeholder); font-weight: 400; }

/* ── COLOUR GRID ── (.ss-colour-grid base is also reused for the gap-
   size pills below, so the 6-across layout is scoped to .ss-swatch-grid
   specifically rather than changing the shared base column count) */
.ss-colour-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ss-colour-opt { cursor: pointer; text-align: center; font-size: var(--text-s)}
.ss-colour-opt input { display: none; }
.ss-swatch { display: block; width: 100%; height: 38px; border-radius: var(--radius); margin-bottom: 4px; transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.ss-colour-opt span:last-child { color: var(--text-muted); }
.ss-colour-opt input:checked + .ss-swatch { transform: scale(1.06); box-shadow: 0 0 0 3px var(--teal-mid); }

/* Colour swatch grid: all 27 colours, 6 across. Line-clamped to the
   first 16 (most popular) via :nth-child — the 17th colour onward is
   simply not rendered while .ss-swatch-grid-clamped is present, no
   separate "more" grid needed. Toggled by the plain-text button below
   (see renderColourGrid()/renderColourGroups() in the JS). */
.ss-swatch-grid { grid-template-columns: repeat(6, 1fr); gap: 10px; }
.ss-swatch-grid .ss-swatch { height: 34px; }
.ss-swatch-grid .ss-colour-opt span:last-child { display: block; font-size: 11px; line-height: 1.2; }
.ss-swatch-grid-clamped .ss-colour-opt:nth-child(n+17) { display: none; }

/* Plain text toggle, deliberately not styled as a button (no border/
   background/pill) — just a link-like affordance under the grid. */
.ss-colour-show-more {
  display: block; width: 100%; margin-top: 10px; padding: 4px 0;
  background: none; border: none; text-align: center;
  color: var(--teal-mid); font-family: var(--font); font-size: var(--text-s); font-weight: 600;
  cursor: pointer; text-decoration: underline;
}
.ss-colour-show-more:hover { color: var(--teal-dark); }

/* ── GAP SIZE OPTIONS (plain text pills, reuses .ss-colour-grid for layout) ── */
.ss-colour-grid .radio-option {
  cursor: pointer; text-align: center;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 8px; border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--off-white); color: var(--text-muted);
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.ss-colour-grid .radio-option input { display: none; }
.ss-colour-grid .radio-option:has(input:checked) {
  border-color: var(--teal-mid); background: var(--teal-mist); color: var(--teal-mid); font-weight: 700;
}
.ss-colour-grid.field-error .radio-option { border-color: var(--error-border) !important; }

/* ── OPTION ROWS ── */
.ss-option-stack { display: flex; flex-direction: column; gap: 8px; }
.ss-opt-row { cursor: pointer; }
.ss-opt-row input { display: none; }
.ss-opt-inner {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--off-white); transition: border-color var(--transition), background var(--transition);
}
.ss-opt-row input:checked + .ss-opt-inner { border-color: var(--teal-mid); background: var(--teal-mist); }
.ss-opt-icon { width: 34px; height: 34px; background: var(--teal-pale); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--teal-mid); flex-shrink: 0; }
.ss-opt-text { flex: 1; display: flex; flex-direction: column; gap: 1px; font-size: var(--text-s)}
.ss-opt-text strong { color: var(--text); }
.ss-opt-text span { color: var(--text-muted); font-size: var(--text-s)}
.ss-opt-text small { font-size: 10px; }
.ss-chk { color: var(--border); font-size: 1rem; transition: color var(--transition); }
.ss-opt-row input:checked + .ss-opt-inner .ss-chk { color: var(--teal-mid); }

/* ── OPTION ROW — 3-across variant (e.g. gate type), to save vertical
   space over the default stacked layout. .ss-opt-inner's own default
   (row: text left, checkmark right) is kept — just narrowed into 3
   equal columns instead of one full-width stack. ── */
.ss-option-stack-row { flex-direction: row; gap: 4px; align-items: stretch; justify-content: flex-start; }
.ss-option-stack-row .ss-opt-row { flex: 0 1 auto; }
.ss-option-stack-row .ss-opt-inner { height: 100%; padding: 10px 12px; white-space: nowrap; }

/* ── GATE TYPE MEASUREMENT DIAGRAM ──
   max-height + object-fit:contain caps the diagram's rendered height
   so the whole thing (including the Next/Back buttons below it) fits
   in view without needing to scroll the modal, regardless of the
   source image's own aspect ratio. */
.ss-gate-type-diagram {
  display: block; width: 100%; height: auto; max-height: 38vh; margin: 14px auto 0;
  object-fit: contain;
  border: 2px solid var(--border); border-radius: var(--radius); background: var(--white);
}

/* ── PRICE RESULT ── */
.ss-price-result { background: var(--teal-pale); border: 2px solid var(--teal-accent); border-radius: var(--radius); padding: 0 16px; font-size: var(--text-s)}
.ss-price-summary {
  padding-bottom: 4px; border-bottom: 1px solid var(--teal-light);
  color: var(--text); line-height: var(--leading-body);
}
.ss-price-summary strong { color: var(--teal-mid); }
.ss-price-summary .ss-hint { display: block; margin-top: 2px; }
.ss-price-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; color: var(--text-muted); border-bottom: 1px solid var(--teal-light);}
.ss-price-row:last-of-type { border-bottom: none; }
.ss-price-row span:last-child { font-weight: 600; color: var(--text); }
.ss-price-row.ss-price-gst { font-style: italic; }
.ss-price-row.ss-price-total { font-size: var(--text-base); font-weight: 700; border-top: 2px solid var(--teal-accent); border-bottom: none; padding-top: 10px; }
.ss-price-row.ss-price-total span:last-child { color: var(--teal-mid); }
.ss-price-note {  color: var(--placeholder); line-height: var(--leading-body); }

/* ── FINAL ROW: Back | Captcha | Send ── */
/* ── MOBILE ≤ 768px ──
   Modal becomes a bottom sheet (anchored to the bottom edge, square
   top corners) — a more familiar mobile pattern than a centered box. ── */
@media (max-width: 768px) {
  .ss-cards-grid { grid-template-columns: 1fr; gap: 24px; }

  .ss-modal-overlay { padding: 0; align-items: center; }
  .ss-modal { max-width: none; max-height: 92vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  .ss-dim-row { grid-template-columns: 1fr; }
  .ss-colour-grid { grid-template-columns: repeat(2, 1fr); }
  .ss-swatch-grid { grid-template-columns: repeat(3, 1fr); }
  .ss-option-stack-row { flex-wrap: wrap; }
  .ss-step-nav { flex-direction: column-reverse; }
  .ss-step-nav .btn-ghost { width: 100%; justify-content: center; }
  .form-grid { grid-template-columns: 1fr !important; }
}

/* =============================================
   ADDED FOR CART / CHECKOUT FLOW
   Reuses styles.css variables only, consistent with the rest of this
   file's convention.
============================================= */

/* ── FRONT BADGE — moved from inline style="display:none" (CSP) ── */
.ss-front-badge { display: none; }
.ss-front-badge.is-visible { display: inline-block; }

/* ── COLOUR SWATCHES — moved from inline style="background:..." (CSP).
   Hex values are approximate web-reference swatches for the Colorbond®
   range, not exact paint matches — verify against a physical supplier
   chart before relying on them for customer-facing colour decisions. ── */
.ss-swatch-surfmist       { background: #D6D2C4; border: 2px solid #ccc; }
.ss-swatch-domain         { background: #D8C9A3; }
.ss-swatch-evening-haze   { background: #C7BFA8; }
.ss-swatch-paperbark      { background: #C3B08C; }
.ss-swatch-harvest        { background: #B98F52; }
.ss-swatch-sandstone      { background: #C7B48D; }
.ss-swatch-riversand      { background: #A99884; }
.ss-swatch-dune           { background: #B7AA92; }
.ss-swatch-wallaby        { background: #8E8471; }
.ss-swatch-bushland       { background: #47573A; }
.ss-swatch-pale-eucalypt  { background: #8C9A7C; }
.ss-swatch-wilderness     { background: #5B6C55; }
.ss-swatch-hedge          { background: #57684A; }
.ss-swatch-cottage-green  { background: #2C4A31; }
.ss-swatch-shale-grey     { background: #999C9C; }
.ss-swatch-windspray      { background: #83888B; }
.ss-swatch-basalt         { background: #4E5253; }
.ss-swatch-woodland-grey  { background: #5B6157; }
.ss-swatch-ironstone      { background: #4B5A65; }
.ss-swatch-headland       { background: #7A4A39; }
.ss-swatch-manor-red      { background: #6C332D; }
.ss-swatch-loft           { background: #6A4A3C; }
.ss-swatch-jasper         { background: #5B4130; }
.ss-swatch-estate         { background: #3D3125; }
.ss-swatch-deep-ocean     { background: #34506A; }
.ss-swatch-monument       { background: #313131; }
.ss-swatch-night-sky      { background: #1D1E20; }

/* ── PAYMENT / POLICY NOTICE (custom order terms) ── */
.ss-payment-notice {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--light-gold) ; border: 2px solid var(--gold); border-radius: var(--radius);
  padding: 12px 14px; margin: 14px 0;
  color: var(--text); font-size: var(--text-s);
}
.ss-payment-notice i { color: var(--gold); flex-shrink: 0; }

/* ── ORDER TERMS AGREEMENT (required before adding to order) ── */
.ss-agree-row {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  background: var(--off-white); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin: 14px 0;
  color: var(--text-muted); font-size: var(--text-s); line-height: var(--leading-body);
  transition: border-color var(--transition);
}
.ss-agree-row input { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--teal-mid); cursor: pointer; }
.ss-agree-row.field-error { border-color: var(--error-border) !important; }

/* ── HINT TEXT under an option group ── */
.ss-option-stack + .ss-hint { margin-top: 4px; }

/* TABLET PORTRAIT  768–1024px */
@media (min-width: 768px) and (max-width: 1024px) {
  .ss-cards-grid { display: grid; grid-template-columns: repeat(2,1fr); column-gap: 16px; row-gap: 32px; align-items: stretch; }
}

/* SMALL DESKTOP  1025–1280px */
@media (min-width: 1025px) and (max-width: 1280px) {
  .ss-cards-grid { display: grid; grid-template-columns: repeat(3,1fr); column-gap: 16px; row-gap: 32px; align-items: stretch; }
}