/* ============================================================
   WWSB Builder CSS  — single source of truth, no conflicts
   ============================================================ */

/* Base */
#wwsb-builder-root.wwsb-builder { margin-top: 18px; overflow-x: hidden; }
/* Never let builder content push the page wider than the viewport */
#wwsb-builder-root { max-width: 100%; overflow-x: clip; }
#wwsb-builder-root .wwsb-panel,
#wwsb-builder-root .wwsb-piececard { max-width: 100%; min-width: 0; overflow-x: clip; box-sizing: border-box; }
.wwsb-wizard { max-width: 980px; margin: 0 auto; }

/* The theme wraps the page in `.wwt` and applies `.wwt * { padding: 0 }`, which
   strips padding from our container rules that aren't prefixed with
   #wwsb-builder-root. Restore it here (higher specificity beats the reset), and
   give things a little more breathing room so the builder doesn't feel cramped. */
#wwsb-builder-root .wwsb-panel { padding: 16px; }
#wwsb-builder-root .wwsb-piececard { padding: 14px; }
#wwsb-builder-root .wwsb-callout { padding: 11px 13px; }
#wwsb-builder-root .wwsb-totalbar { padding: 13px 15px; }
#wwsb-builder-root .wwsb-pricehint { padding: 13px 15px; }
#wwsb-builder-root .wwsb-field input,
#wwsb-builder-root .wwsb-field select { padding: 10px 12px !important; }
#wwsb-builder-root .wwsb-stack { gap: 18px; }
/* Contain the absolute hidden inputs in these card types too */
#wwsb-builder-root .wwsb-leadtimecard,
#wwsb-builder-root .wwsb-cutoutcard { position: relative; }
.wwsb-header { margin-bottom: 10px; }
.wwsb-title { font-size: 20px; font-weight: 700; }
.wwsb-subtitle { font-size: 13px; color: #666; margin-top: 4px; }
.wwsb-req { color: #b00020; font-weight: 700; }

/* Stepper */
.wwsb-stepper { display:flex; align-items:center; gap:10px; margin:12px 0 14px 0; padding:10px 0; }
.wwsb-stepper-steps { display:flex; align-items:center; gap:8px; }
.wwsb-stepper-price { display:inline-flex; align-items:baseline; gap:5px; background:#f8f8f6; border:1px solid #e6e6e6; border-radius:999px; padding:7px 14px; white-space:nowrap; }
.wwsb-stepper-price-label { font-size:11px; color:#666; font-weight:600; text-transform:uppercase; letter-spacing:0.04em; }
.wwsb-stepper-price-value { font-size:15px; font-weight:800; color:#111; }
.wwsb-stepper-fixed { position:fixed; top:0; left:0; right:0; z-index:99999; background:#fff; border-bottom:1px solid #e6e6e6; box-shadow:0 2px 8px rgba(0,0,0,0.08); padding:10px 16px; display:flex; align-items:center; gap:8px; }
@media (max-width:600px) {
  .wwsb-stepper-steps { gap:6px; }
  .wwsb-stepper-price { padding:5px 10px; gap:4px; }
  .wwsb-stepper-price-label { font-size:9px; }
  .wwsb-stepper-price-value { font-size:13px; }
  .wwsb-step { padding:6px 8px; gap:5px; }
  .wwsb-step .num { width:18px; height:18px; font-size:10px; }
  .wwsb-step .lbl { font-size:11px; }
}
.wwsb-step { border:1px solid #ddd; background:#fff; border-radius:999px; padding:8px 12px; display:inline-flex; align-items:center; gap:8px; cursor:pointer; }
.wwsb-step .num { width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; border-radius:999px; border:1px solid #ddd; font-size:12px; }
.wwsb-step .lbl { font-size:13px; }
.wwsb-step.active { background:#EFBC6C; border-color:#111; }
.wwsb-step.active .lbl { color:#111; }
.wwsb-step.active .num { background:#fff; border-color:#111; color:#111; }
.wwsb-step.done { background:rgba(239,188,108,0.25); border-color:#ddd; opacity:1; }

/* Panels */
.wwsb-panel { border:1px solid #e6e6e6; background:#fff; border-radius:12px; padding:14px; margin-top:12px; }
.wwsb-callout { margin-top:12px; padding:10px 12px; border-radius:10px; background:#fafafa; border:1px solid #eee; font-size:13px; }
.wwsb-stack { display:flex; flex-direction:column; gap:12px; }

/* Dimension grid (Step 2) */
.wwsb-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
@media (max-width:900px) { .wwsb-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width:520px)  { .wwsb-grid { grid-template-columns:1fr; } }

/* Fields */
.wwsb-field label { display:block; font-size:12px; color:#444; margin-bottom:6px; }
.wwsb-field input,
.wwsb-field select { width:100%; border:1px solid #ddd; border-radius:10px; background:#fff; box-sizing:border-box; height:44px; font-size:14px; line-height:1.2; padding:10px; }
.wwsb-field select { -webkit-appearance:menulist; appearance:auto; }

/* Required asterisks removed per design — everything in the builder is required */
#wwsb-builder-root .wwsb-req { display: none; }

/* Section headers — light treatment: stylized mono caps in Dark Forest with a
   Forest-green bottom hard line to delineate each section (brand colors). */
#wwsb-builder-root .wwsb-sectionhead {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 2px 0 14px 0;
  padding: 0 0 7px 0;
  background: transparent;
  color: #3A3D35;                     /* Dark Forest text */
  font-family: "Zilla Slab", Georgia, serif;
  font-size: 13.2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  border: 0;
  border-bottom: 2px solid #697357;   /* Forest hard line */
  border-radius: 0;
}

/* ============================================================
   DESCRIPTION INFO CARDS
   ============================================================ */
/* Row wrapper — desktop: side-by-side; mobile: stacked */
#wwsb-builder-root .wwsb-stylecards-row,
#wwsb-builder-root .wwsb-speciescards-row,
#wwsb-builder-root .wwsb-finishcards-row,
#wwsb-builder-root .wwsb-shippingcards-row {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}

#wwsb-builder-root .wwsb-style-infocard,
#wwsb-builder-root .wwsb-species-infocard,
#wwsb-builder-root .wwsb-finish-infocard,
#wwsb-builder-root .wwsb-shipping-infocard {
  flex: 0 0 140px;
  background: #eaf3f8;
  border: 1px solid #c8dfe8;
  border-radius: 12px;
  padding: 14px;
  font-size: 12px;
  color: #333;
  line-height: 1.4;
}
#wwsb-builder-root .wwsb-style-infocard-headline,
#wwsb-builder-root .wwsb-species-infocard-headline,
#wwsb-builder-root .wwsb-finish-infocard-headline,
#wwsb-builder-root .wwsb-shipping-infocard-headline {
  font-weight: 800;
  font-size: 14px;
  margin: 0 0 6px 0;
  color: #111;
}
#wwsb-builder-root .wwsb-style-infocard-body,
#wwsb-builder-root .wwsb-species-infocard-body,
#wwsb-builder-root .wwsb-finish-infocard-body,
#wwsb-builder-root .wwsb-shipping-infocard-body {
  color: #444;
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
}

/* Shipping cards — info card on the left + 4-col grid (matches Finish) */
@media (min-width: 601px) {
  #wwsb-builder-root .wwsb-shippingcards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    flex: 1;
  }
  #wwsb-builder-root .wwsb-shippingcards .wwsb-speciescard-img { height: 78px; aspect-ratio: auto; }
}
@media (max-width: 600px) {
  #wwsb-builder-root .wwsb-shippingcards-row { flex-direction: column; }
  #wwsb-builder-root .wwsb-shipping-infocard { flex: none; width: 100%; box-sizing: border-box; }
  #wwsb-builder-root .wwsb-shippingcards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  #wwsb-builder-root .wwsb-shippingcards .wwsb-speciescard-label { font-size: 10px; padding: 6px 2px; line-height: 1.25; }
}

/* ============================================================
   SELECTION CARDS — hide native radios
   ============================================================ */
/* Collapse the hidden input to 1px. The Divi theme applies a global
   input{width:100%}; without this the absolutely-positioned radios balloon to
   the panel width and, escaping their static-positioned cards, push the whole
   page wider than the viewport (horizontal overflow on mobile). */
.wwsb-stylecard input,
.wwsb-speciescard input,
.wwsb-finishcard input,
#wwsb-builder-root .wwsb-leadtimecard input,
#wwsb-builder-root .wwsb-cutoutcard input {
  position:absolute; opacity:0; pointer-events:none;
  width:1px !important; height:1px; left:0; top:0; margin:0; padding:0;
}

/* Shared card base */
.wwsb-stylecard,
.wwsb-speciescard,
.wwsb-finishcard {
  position: relative; /* contain the absolute hidden input */
  display: block;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.wwsb-stylecard-inner,
.wwsb-speciescard-inner,
.wwsb-finishcard-inner { display:flex; flex-direction:column; }

/* Images */
.wwsb-stylecard-img  { aspect-ratio:16/10; background:#f6f6f6; overflow:hidden; }
.wwsb-speciescard-img,
.wwsb-finishcard-img { aspect-ratio:1/1; background:#f6f6f6; overflow:hidden; }
.wwsb-stylecard-img img,
.wwsb-speciescard-img img,
.wwsb-finishcard-img img { width:100%; height:100%; object-fit:cover; display:block; }

/* Labels */
.wwsb-stylecard-label,
.wwsb-speciescard-label,
.wwsb-finishcard-label { padding:8px 10px; font-size:13px; font-weight:700; text-align:center; }

/* Selected state */
.wwsb-stylecard:has(input:checked),
.wwsb-speciescard:has(input:checked),
.wwsb-finishcard:has(input:checked) {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(0,0,0,.12);
  background: rgba(239,188,108,0.3);
}
.wwsb-stylecard:has(input:checked) .wwsb-stylecard-inner,
.wwsb-speciescard:has(input:checked) .wwsb-speciescard-inner,
.wwsb-finishcard:has(input:checked) .wwsb-finishcard-inner {
  background: rgba(239,188,108,0.3);
}

/* ============================================================
   DESKTOP card grids (601px+)
   ============================================================ */
@media (min-width: 601px) {
  #wwsb-builder-root .wwsb-stylecards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 10px;
    flex: 1;
  }
  #wwsb-builder-root .wwsb-finishcards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 10px;
    flex: 1;
  }
  /* Species: all 5 cards on one row, scaled to fit beside the info card. */
  #wwsb-builder-root .wwsb-speciescards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    gap: 8px;
    flex: 1;
  }
  #wwsb-builder-root .wwsb-stylecard-img  { height: 90px; aspect-ratio: auto; }
  #wwsb-builder-root .wwsb-speciescard-img,
  #wwsb-builder-root .wwsb-finishcard-img { height: 78px; aspect-ratio: auto; }
}

/* ============================================================
   MOBILE card scroll (600px and below)
   ============================================================ */
@media (max-width: 600px) {
  /* Stack: info card on top, scroll row below */
  #wwsb-builder-root .wwsb-stylecards-row,
  #wwsb-builder-root .wwsb-speciescards-row,
  #wwsb-builder-root .wwsb-finishcards-row {
    flex-direction: column;
  }
  #wwsb-builder-root .wwsb-style-infocard,
  #wwsb-builder-root .wwsb-species-infocard,
  #wwsb-builder-root .wwsb-finish-infocard {
    flex: none;
    width: 100%;
    box-sizing: border-box;
  }

  /* All options across the width (grids), matching the desktop column counts:
     product type = 3, species/finish (and shipping, which reuses .wwsb-speciescards) = 4.
     minmax(0,1fr) lets cards shrink to fit instead of overflowing. */
  #wwsb-builder-root .wwsb-stylecards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  #wwsb-builder-root .wwsb-speciescards,
  #wwsb-builder-root .wwsb-finishcards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  /* Smaller labels so 4-across names don't break mid-word in narrow cards */
  #wwsb-builder-root .wwsb-speciescard-label,
  #wwsb-builder-root .wwsb-finishcard-label { font-size: 11px; padding: 6px 4px; line-height: 1.2; }
  #wwsb-builder-root .wwsb-stylecard-label { font-size: 12px; padding: 6px 4px; }

  /* Taller images on mobile */
  #wwsb-builder-root .wwsb-stylecard-img  { height: 120px !important; aspect-ratio: auto !important; }
  #wwsb-builder-root .wwsb-speciescard-img,
  #wwsb-builder-root .wwsb-finishcard-img { height: 110px !important; aspect-ratio: auto !important; }
}

/* ============================================================
   CUTOUT CARDS
   ============================================================ */
.wwsb-piecegrid { display:grid; grid-template-columns:1fr; gap:12px; }
.wwsb-piececard { border:1px solid #eee; border-radius:12px; padding:12px; background:#fff; }
.wwsb-piececard-title { font-weight:700; margin-bottom:10px; }
.wwsb-cutouts { margin-top:12px; padding-top:12px; padding-bottom:4px; border-top:1px solid #eee; display:flex; align-items:center; gap:18px; flex-wrap:wrap; }
.wwsb-cutouts-title { font-size:13px; font-weight:800; color:#111; margin-right:8px; }
.wwsb-check { font-size:14px; font-weight:700; display:inline-flex; align-items:center; gap:10px; padding:6px 8px; border-radius:10px; }
.wwsb-check:hover { background:#fafafa; }
.wwsb-check input[type="checkbox"] { width:18px; height:18px; transform:translateY(1px); }

/* (Removed dead cutout-card and edge-picker CSS — shelves use brackets, not
   CNC cutouts or edge profiles; those render functions are never called.) */

/* Review */
.wwsb-review { margin-top:12px; border-top:1px solid #eee; padding-top:12px; }
.wwsb-review-title { font-weight:700; margin-bottom:8px; }
.wwsb-review-row { display:flex; justify-content:space-between; gap:12px; font-size:13px; padding:6px 0; border-bottom:1px dashed #eee; }
.wwsb-review-row:last-child { border-bottom:0; }

/* Buttons */
.wwsb-row { display:flex; gap:12px; flex-wrap:wrap; }
.wwsb-row-center { justify-content:center; margin-top:12px; }
.wwsb-actions { display:flex; gap:10px; flex-wrap:wrap; }
.wwsb-btn { border:1px solid #111; background:#111; color:#fff; border-radius:999px; padding:10px 14px; font-size:14px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.wwsb-btn.secondary { background:#fff; color:#111; }
.wwsb-btn:disabled { opacity:0.5; cursor:not-allowed; }

/* Divi-proofing (parity with the countertop builder). Divi's global button
   styling and its injected ::after arrow were crushing the labels against the
   edges. Scope to #wwsb-builder-root so these win on specificity, reset the
   inherited metrics, kill the arrow, and give Back/Next + the Type/Size/Shipping
   steps room to breathe. Only padding/box metrics here — selected-state
   backgrounds and mobile sizing stay with the rules above. */
#wwsb-builder-root .wwsb-btn {
  padding:10px 22px; font-weight:600; line-height:normal; box-sizing:border-box;
  width:auto; height:auto; white-space:nowrap; font-family:inherit;
  letter-spacing:normal; text-transform:none;
}
#wwsb-builder-root .wwsb-btn::after { content:none !important; }
#wwsb-builder-root .wwsb-step {
  padding:9px 16px; line-height:normal; box-sizing:border-box; width:auto; height:auto;
}
#wwsb-builder-root .wwsb-step::after { content:none !important; }
/* Lead-time dots: keep all 10 on one row (they carry inline sizing, so shrink
   them with !important on mobile so they don't wrap in the narrow cards). */
#wwsb-builder-root .wwsb-leadtimecard-dots { white-space: nowrap; }
@media (max-width: 600px) {
  #wwsb-builder-root .wwsb-leadtimecard-dots span { width: 8px !important; height: 8px !important; margin: 0 1.5px !important; }
}

/* Loading state (Add to Cart) — keep the button solid, show a spinner */
#wwsb-builder-root .wwsb-btn.is-loading,
#wwsb-builder-root .wwsb-btn.is-loading:disabled { opacity:1; cursor:default; }
#wwsb-builder-root .wwsb-btn .wwsb-spinner {
  display:inline-block; width:15px; height:15px; margin-right:9px; flex:none;
  border:2px solid rgba(255,255,255,0.35); border-top-color:#fff; border-radius:50%;
  animation: wwsb-spin 0.7s linear infinite;
}
@keyframes wwsb-spin { to { transform: rotate(360deg); } }
.wwsb-nav { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:14px; }
.wwsb-step2-actionsbar { display:flex; gap:10px; flex-wrap:nowrap; align-items:center; margin-bottom:12px; }

/* Price */
.wwsb-pricebottom { margin-top:14px; }
.wwsb-pricehint { border:1px solid #eee; background:#fafafa; border-radius:12px; padding:12px 14px; font-size:13px; color:#444; }
.wwsb-totalbar { border:1px solid #e6e6e6; background:#fff; border-radius:12px; padding:12px 14px; display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.wwsb-totalbar-label { font-size:12px; color:#666; }
.wwsb-totalbar-value { font-size:20px; font-weight:800; }
.wwsb-totalbar-note { font-size:12px; color:#666; }
.wwsb-totalbar-retail { font-weight:600; color:#697357; text-decoration:line-through; text-decoration-thickness:2px; font-size:16px; margin-right:9px; }
.wwsb-trade-off { display:inline-block; margin-left:6px; background:#EFBC6C; color:#181818; font-weight:700; font-size:10px; letter-spacing:.04em; text-transform:uppercase; padding:2px 7px; border-radius:999px; vertical-align:middle; }

/* Errors / Success */
.wwsb-error { margin-top:12px; border:1px solid #ffd1d1; background:#fff5f5; border-radius:12px; padding:12px 14px; }
.wwsb-error ul { margin:8px 0 0 18px; }
.wwsb-success { margin-top:12px; border:1px solid #d8f5d8; background:#f3fff3; border-radius:12px; padding:12px 14px; }
