/* American Upholstery — Furniture Quote Tool */

.tool-app {
  --navy: #2c3e5e;
  --navy-dark: #1f2d46;
  --accent: #b86a4f;
  --accent-dark: #9c5540;
  --cream: #faf7f2;
  --paper: #ffffff;
  --ink: #2a2a28;
  --ink-soft: #6b6b66;
  --line: #e4ddd2;
  --ok: #3d6b4a;
  --err: #a63c38;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(42, 42, 40, 0.08);
}

.tool-app * { box-sizing: border-box; }
.tool-app { margin: 0; padding: 0; }
.tool-app {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
}
.tool-app button, .tool-app input, .tool-app select, .tool-app textarea { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 15px; }

.tool-app .wrap { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

.tool-app .tool-header { text-align: center; margin-bottom: 24px; }
.tool-app .tool-header h1 { font-size: 30px; font-weight: normal; letter-spacing: 0.02em; margin: 0 0 6px; color: var(--navy); }
.tool-app .tool-header p { margin: 0; color: var(--ink-soft); font-size: 16px; }
.tool-app .tool-header .tool-switch { margin-top: 10px; font-size: 13px; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .tool-header .tool-switch a { color: var(--accent-dark); }

.tool-app .layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) {
  .tool-app .layout { grid-template-columns: 1fr; }
  /* No order override here: the controls column and cart should
     follow steps 1-5 in normal document order on mobile, not jump
     above them the way "order: -1" used to force it to. */
}

.tool-app .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.tool-app .panel h2 {
  font-size: 12px; font-family: "Helvetica Neue", Arial, sans-serif; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--navy);
  margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.tool-app .panel .sub { color: var(--ink-soft); font-size: 13px; margin: -4px 0 12px; font-family: "Helvetica Neue", Arial, sans-serif; }

/* ---------- Preview band (top, spans full width) ----------
   The live piece preview used to live inside the material panel, in a
   sticky right-hand column next to the cart — which meant the piece
   image itself could scroll out of view once the swatch list made
   that column tall. It now sits in its own full-width band at the
   very top of the page, above every configurator step and the cart —
   a plain block in normal document flow, not pinned/sticky, so the
   visualization is always the first thing on screen and nothing can
   ever scroll underneath it and get covered. Mirrors the cushion
   designer's preview-band pattern so all three tools share the same
   top-level layout. */
.tool-app .preview-band { margin-bottom: 20px; }
.tool-app .preview-band-inner {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
/* Bigger than the old fixed ~260px preview, and bigger again now that
   the caption/disclaimer text moved into the info column instead of
   sitting under the image (see .preview-caption/.preview-disclaimer
   below) — the visualization is the thing people are here to look
   at, so it gets as much of the band as the info column's text
   content leaves reasonable room for. */
.tool-app .preview-stage-wrap { flex: 1 1 460px; max-width: 500px; }
.tool-app .preview-info { flex: 1 1 300px; min-width: 0; }
.tool-app .preview-info .price-line { margin-top: 0; }
@media (max-width: 780px) {
  .tool-app .preview-band-inner { flex-direction: column; }
  .tool-app .preview-stage-wrap { flex: none; width: 100%; max-width: none; }
}
.tool-app .preview-stage {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #eae3d3 0%, #d9cfba 100%);
  border-radius: 8px;
  padding: 16px;
  min-height: 220px;
}
.tool-app .preview-visual { width: 100%; }
.tool-app .preview-visual img, .tool-app .preview-visual svg { display: block; width: 100%; height: auto; }
/* Both now live at the top of .preview-info, above the price line —
   left-aligned to match the rest of that column instead of centered
   under the image the way they used to be. */
.tool-app .preview-caption {
  text-align: left; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 13px;
  color: var(--ink-soft); margin: 0 0 4px; line-height: 1.4;
}

/* ---------- Price + add ---------- */
.tool-app .price-line { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 2px; }
.tool-app .price-line .price-label { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 12px; color: var(--ink-soft); }
.tool-app .price-line .price-value { font-size: 24px; color: var(--navy); font-weight: bold; }
.tool-app .price-line .price-value.placeholder { font-size: 15px; font-weight: 600; color: var(--ink-soft); }

/* ---------- Piece tiles ---------- */
.tool-app .piece-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 480px) { .tool-app .piece-grid { grid-template-columns: repeat(2, 1fr); } }
.tool-app .piece-tile {
  border: 2px solid var(--line); border-radius: 8px; background: var(--paper);
  padding: 10px 6px 8px; text-align: center; cursor: pointer; transition: border-color 0.15s;
}
.tool-app .piece-tile:hover { border-color: var(--navy); }
.tool-app .piece-tile.selected { border-color: var(--accent); background: #faf1ec; }
.tool-app .piece-tile svg { width: 100%; height: 46px; display: block; }
.tool-app .piece-tile .pt-name { display: block; font-size: 12px; font-weight: 600; margin-top: 6px; color: var(--ink); line-height: 1.25; }

/* ---------- Coverage level (Dining Chair) ---------- */
.tool-app .coverage-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 480px) { .tool-app .coverage-grid { grid-template-columns: 1fr; } }
.tool-app .coverage-tile {
  border: 2px solid var(--line); border-radius: 8px; background: var(--paper);
  padding: 10px 12px; text-align: left; cursor: pointer; transition: border-color 0.15s;
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 13px; color: var(--ink); line-height: 1.3;
}
.tool-app .coverage-tile:hover { border-color: var(--navy); }
.tool-app .coverage-tile.selected { border-color: var(--accent); background: #faf1ec; font-weight: 700; }

/* ---------- Option cards / toggle ---------- */
.tool-app .check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.tool-app .check-item { display: flex; align-items: center; gap: 8px; font-size: 14px; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .check-item input { width: 16px; height: 16px; flex-shrink: 0; }
.tool-app .fee-row { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .oversized-row {
  background: var(--stone-2, #f4efe6); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px;
}

/* ---------- Material tier cards + range bars ---------- */
.tool-app .tier-list { display: flex; flex-direction: column; gap: 8px; }
.tool-app .tier-card {
  border: 2px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer;
  background: var(--paper); transition: border-color 0.15s;
}
.tool-app .tier-card:hover { border-color: var(--navy); }
.tool-app .tier-card.selected { border-color: var(--accent); background: #faf1ec; }
.tool-app .tier-head { display: flex; justify-content: space-between; align-items: baseline; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .tier-head .tier-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.tool-app .tier-head .tier-range { font-weight: 700; font-size: 14px; color: var(--navy); white-space: nowrap; }
.tool-app .tier-note { font-size: 11.5px; color: var(--ink-soft); margin: 3px 0 7px; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .tier-bar-track { position: relative; height: 7px; background: var(--line); border-radius: 5px; overflow: hidden; }
.tool-app .tier-bar-fill { position: absolute; top: 0; bottom: 0; background: var(--accent); border-radius: 5px; }

/* ---------- Fabric swatch picker ----------
   Every collection is shown fully expanded, all the time (see
   renderSwatches() in app.js) — a plain heading, never a click-to-
   reveal toggle, so nothing about a customer's color options is
   hidden once they've picked a material. */
.tool-app .swatch-intro { margin: -4px 0 10px !important; }
.tool-app .swatch-empty {
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 13px; color: var(--ink-soft);
  margin: 0; padding: 10px 0 2px;
}
.tool-app .swatch-coll-heading {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border-bottom: 1px solid var(--line); padding: 10px 2px 7px; margin: 12px 0 8px;
}
.tool-app .swatch-coll-heading:first-child { margin-top: 0; }
.tool-app .swatch-coll-name {
  font-family: "Helvetica Neue", Arial, sans-serif; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--navy); margin: 0;
}
.tool-app .swatch-coll-heading .coll-count {
  font-size: 11px; font-weight: 400; color: var(--ink-soft); text-transform: none; letter-spacing: normal;
}
.tool-app .swatch-coll-heading .coll-selected-tag {
  margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0;
}
/* Each collection's colors scroll horizontally in a single row instead
   of wrapping into a tall grid — a collection of 30+ colors used to run
   to several rows; now it's one compact strip you scroll sideways
   (drag, trackpad swipe, or the mouse wheel — see the wheel-to-
   horizontal-scroll handler in app.js), so the fabric step stays
   compact and the visualizer above it stays reachable without much
   scrolling. */
.tool-app .swatch-row {
  display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px;
  padding: 2px 2px 10px; margin-bottom: 4px;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
}
.tool-app .swatch-row::-webkit-scrollbar { height: 6px; }
.tool-app .swatch-row::-webkit-scrollbar-track { background: transparent; }
.tool-app .swatch-row::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.tool-app .swatch-row::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }
.tool-app .swatch-chip {
  flex: 0 0 68px; scroll-snap-align: start;
  border: none; background: none; padding: 0; cursor: pointer; text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.tool-app .swatch-img {
  display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 6px;
  border: 2px solid var(--line); background-size: cover; background-position: center;
  transition: border-color 0.15s;
}
.tool-app .swatch-chip:hover .swatch-img { border-color: var(--navy); }
.tool-app .swatch-chip.selected .swatch-img { border-color: var(--accent); box-shadow: 0 0 0 2px #faf1ec inset; }
.tool-app .swatch-label {
  display: block; font-size: 10.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tool-app .swatch-chip.selected .swatch-label { color: var(--accent-dark); font-weight: 700; }

.tool-app .estimate-note {
  font-size: 11px; font-family: "Helvetica Neue", Arial, sans-serif; color: var(--ink-soft);
  margin: 0 0 10px; line-height: 1.35;
}
.tool-app .preview-disclaimer {
  text-align: left; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 11px; font-style: italic;
  color: var(--ink-soft); margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line);
  max-width: none; line-height: 1.4;
}

.tool-app .qty-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 10px; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 13px; }
.tool-app .qty-row input { width: 60px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; }

.tool-app .btn { display: inline-block; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.tool-app .btn-primary { background: var(--accent); color: #fff; width: 100%; }
.tool-app .btn-primary:hover { background: var(--accent-dark); }
.tool-app .btn-navy { background: var(--navy); color: #fff; width: 100%; }
.tool-app .btn-navy:hover { background: var(--navy-dark); }
.tool-app .btn-navy:disabled, .tool-app .btn-primary:disabled { background: #b9b4aa; cursor: default; }
.tool-app .btn-ghost { background: none; color: var(--err); border: none; font-size: 13px; cursor: pointer; padding: 4px 6px; text-decoration: underline; }

/* ---------- Cart ---------- */
.tool-app .cart-empty { color: var(--ink-soft); font-size: 14px; font-family: "Helvetica Neue", Arial, sans-serif; margin: 0; }
.tool-app .cart-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tool-app .cart-item:last-of-type { border-bottom: none; }
.tool-app .cart-thumb { width: 44px; height: 40px; border-radius: 5px; border: 1px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--cream); }
.tool-app .cart-thumb svg { width: 30px; height: 26px; }
.tool-app .cart-detail { flex: 1; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .cart-detail .ct-title { font-size: 14px; font-weight: 600; margin: 0; }
.tool-app .cart-detail .ct-specs { font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 0; line-height: 1.45; }
.tool-app .cart-price { font-weight: bold; color: var(--navy); white-space: nowrap; font-family: "Helvetica Neue", Arial, sans-serif; text-align: right; }
.tool-app .cart-total { display: flex; justify-content: space-between; padding-top: 12px; margin-top: 4px; border-top: 2px solid var(--navy); font-family: "Helvetica Neue", Arial, sans-serif; font-weight: bold; font-size: 16px; color: var(--navy); }

/* ---------- Order form ---------- */
.tool-app .order-form { margin-top: 16px; }
.tool-app .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .tool-app .form-grid { grid-template-columns: 1fr; } }
.tool-app .form-field label { display: block; font-family: "Helvetica Neue", Arial, sans-serif; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
.tool-app .form-field input, .tool-app .form-field textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 15px; }
.tool-app .form-field.full { grid-column: 1 / -1; }
.tool-app .form-field textarea { resize: vertical; min-height: 70px; }
.tool-app .hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }
.tool-app .form-status { font-family: "Helvetica Neue", Arial, sans-serif; font-size: 14px; margin: 12px 0 0; min-height: 20px; line-height: 1.5; }
.tool-app .form-status.ok { color: var(--ok); font-weight: 600; }
.tool-app .form-status.err { color: var(--err); }
.tool-app .form-status a { color: var(--navy); }

.tool-app .success-box { background: #eef4ee; border: 1px solid #c4d8c8; border-radius: 8px; padding: 18px; text-align: center; font-family: "Helvetica Neue", Arial, sans-serif; }
.tool-app .success-box h3 { margin: 0 0 6px; color: var(--ok); }
.tool-app .success-box p { margin: 0; font-size: 14px; color: var(--ink); }

/* ---------- site integration (tool now sits inside the site header/footer) ----------
   Undo the site's element-level styles (css/styles.css) inside the tool, and give the
   tool title the site's display face so the page reads as part of americanupholstery.com. */
.tool-app { display: block; font-size: 16px; }
.tool-app h1, .tool-app h2, .tool-app h3 { text-transform: none; line-height: 1.3; }
.tool-app .tool-header h1 { font-family: var(--display); text-transform: uppercase; font-weight: 700; font-size: clamp(30px, 5vw, 44px); line-height: 1; letter-spacing: 0.02em; margin-bottom: 10px; }
.tool-app .panel h2 { text-transform: uppercase; }
.tool-app section { padding-top: 0; padding-bottom: 0; }
.tool-app .btn { gap: 0; font-family: "Helvetica Neue", Arial, sans-serif; letter-spacing: normal; text-transform: none; text-decoration: none; justify-content: center; transform: none; }
.tool-app img { display: inline-block; }
@media (max-width: 860px) { .tool-app .layout { grid-template-columns: minmax(0, 1fr); } }
