/* ==========================================================================
   CALCULATOR LAYOUT — Extracted from demo/other-calcs.html + demo/slc-calc.html
   Two-panel app window matching the rebuild design system exactly
   ========================================================================== */

/* --- Page Wrapper --- */
.calculator-page {
  padding: 64px 24px 120px;
}

/* --- Header --- */
.bf-calc-header {
  text-align: center;
  margin-bottom: 48px;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
}
.bf-calc-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 16px;
}
.bf-calc-header p {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* --- App Window (Two-Panel Grid) --- */
.bf-app-window {
  max-width: var(--container-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 1024px) {
  .bf-app-window {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   LEFT PANEL: CONFIGURATION INPUTS
   ========================================================================== */
.bf-panel-config {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-subtle);
  padding: 32px;
}

/* Config body wrapper (scrollable content area) */
.bf-config-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.bf-config-section {
  margin-bottom: 32px;
}
.bf-config-section:last-child {
  margin-bottom: 0;
}

/* --- Input groups and headers --- */
.bf-input-group {
  margin-bottom: 20px;
}
.bf-input-group:last-child {
  margin-bottom: 0;
}
.bf-input-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}
.bf-input-header label {
  margin-bottom: 0;
}

/* --- Input method groups (show/hide based on tab selection) --- */
.input-method-group {
  margin-top: 8px;
}
.input-method-group.hidden {
  display: none;
}

/* --- Area summary row (SLC total area display) --- */
.bf-area-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.bf-area-summary-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}
.bf-area-summary-value {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}
.bf-area-summary-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Custom specs grid (SLC custom product fields) --- */
.bf-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 600px) {
  .bf-custom-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Collapsible content (expandable sections) --- */
.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.collapsible-content.open {
  max-height: 500px;
}

/* --- Text button (add room, etc.) --- */
.bf-btn-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--accent-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  transition: color var(--transition-base);
}
.bf-btn-text:hover {
  color: var(--accent-hover);
}

/* --- Slider value display --- */
.bf-slider-val {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  min-width: 40px;
  text-align: right;
}

.bf-config-section-title {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* --- Input Groups ---
   Each input-group contains a label + input (or select).
   Tighter spacing keeps the form compact and scannable. */
.input-group {
  margin-bottom: 16px;
}
.input-group:last-child {
  margin-bottom: 0;
}

.input-group > label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.input-group small,
.helper-text,
.sub-label {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Selects --- */
.bf-select {
  width: 100%;
  padding: 12px 40px 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-overflow: ellipsis;
  transition: all var(--transition-base);
}
.bf-select:focus {
  background-color: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}

/* --- Inline Inputs & Rows --- */
.input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.input-field {
  flex: 1 1 90px;
  min-width: 0;
  position: relative;
}
/* Sub-labels inside input-row fields (e.g., "Cost" / "Markup" under "Material") */
.input-row .input-field > label,
.input-row > .input-field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.input-field input,
.input-group > input {
  width: 100%;
  padding: 12px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-base);
}
.input-field input:focus,
.input-group > input:focus {
  background: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}

.unit-select {
  width: 110px;
  flex-shrink: 0;
}
.unit-select select {
  width: 100%;
  height: 100%;
  padding: 0 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

/* --- Catch-all: Any input/select inside config panel that isn't already styled --- */
.bf-panel-config input[type='number'],
.bf-panel-config input[type='text'] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-base);
}
.bf-panel-config input[type='number']:focus,
.bf-panel-config input[type='text']:focus {
  background: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}
.bf-panel-config select {
  width: 100%;
  padding: 12px 40px 12px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  transition: all var(--transition-base);
}
.bf-panel-config select:focus {
  background-color: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}
.bf-panel-config label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

/* --- SLC Inline Input selects (override width for unit dropdowns) --- */
.bf-inline-input select {
  width: auto;
  min-width: 60px;
  padding: 8px 28px 8px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: all var(--transition-base);
}
.bf-inline-input select:focus {
  background-color: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}
.bf-inline-input input {
  width: 80px;
}

/* --- Segmented Radio Controls --- */
.radio-group {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
}
.radio-group label {
  flex: 1;
  text-align: center;
  position: relative;
  cursor: pointer;
}
.radio-group input[type='radio'] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}
.radio-group span {
  display: block;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all var(--transition-base);
}
.radio-group input[type='radio']:checked ~ span {
  background: var(--bg-base);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* --- Bag Size Options (Concrete calculator) --- */
.bag-size-row,
.sheet-size-row {
  display: flex;
  gap: 8px;
}
.bag-option,
.sheet-option {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}
.bag-option:hover,
.sheet-option:hover {
  border-color: #cbd5e1;
}
/* --- Unified selection state ---
   All clickable option cards share the same selected/active indicator:
   terracotta border + subtle outer glow. This covers:
   - .bag-option.selected (concrete bag sizes)
   - .sheet-option.selected (drywall sheet sizes)
   - .radio-option.selected (brick project type, pattern, mortar, etc.)
   - .brick-option.selected (brick size grid)
   - .bf-product-card.active / .product-card.active (SLC product selection)
*/
.bag-option.selected,
.sheet-option.selected,
.radio-option.selected,
.brick-option.selected,
.bf-product-card.active,
.product-card.active {
  background: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(224, 93, 54, 0.15);
}

/* --- Radio option cards (brick calculator, shared pattern) --- */
/* When a radio-group contains .radio-option cards, allow wrapping */
.radio-group:has(.radio-option) {
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
}
.radio-option {
  flex: 1 1 auto;
  min-width: 120px;
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-main);
}
.radio-option:hover {
  border-color: #cbd5e1;
}
.radio-option input[type='radio'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.radio-option label {
  cursor: pointer;
  display: block;
}

/* --- Brick size grid + option cards --- */
.brick-size-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}
.brick-option {
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}
.brick-option:hover {
  border-color: #cbd5e1;
}

.bag-size,
.sheet-size {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}
.bag-weight,
.sheet-dimensions {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Brick option card details --- */
.brick-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}
.brick-dimensions {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.brick-coverage {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* --- Area cards (drywall rooms, mulch shapes) --- */
.areas-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.area-card {
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}
.area-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
@media (max-width: 480px) {
  .area-inputs {
    grid-template-columns: 1fr;
  }
}

/* --- Inline radio button pairs (Yes/No toggles) ---
   Compact segmented toggle for binary choices. Hides the radio dot
   and uses background color to indicate selection. */
.bf-panel-config label:has(> input[type='radio']) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-right: 6px;
  margin-top: 6px;
}
.bf-panel-config label:has(> input[type='radio']:checked) {
  background: var(--bg-base);
  border-color: var(--accent-primary);
  color: var(--text-main);
  font-weight: 600;
}
.bf-panel-config label > input[type='radio'] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-primary);
  margin: 0;
}

/* --- Calculator results wrapper (shared across multiple calculators) --- */
.calculator-results {
  margin-top: 0;
}

/* --- Add opening button (brick calculator) --- */
.add-opening-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--accent-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 16px;
  margin-top: 8px;
  transition: all var(--transition-base);
}
.add-opening-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(224, 93, 54, 0.04);
}

/* --- Inline label (next to input on same line) --- */
.inline-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* --- Tooltips --- */
.tooltip {
  position: relative;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.75rem;
  color: var(--text-light);
  vertical-align: middle;
  margin-left: 4px;
}
.tooltip:hover {
  color: var(--accent-primary);
}
.tooltiptext {
  visibility: hidden;
  position: absolute;
  z-index: 10;
  bottom: 125%;
  left: 0;
  background: var(--bg-dark);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 260px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* --- Diagram notes (asphalt calculator) --- */
.diagram-note {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
  margin-top: 8px;
}

/* --- Sub labels and optional indicators --- */
.sub-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.optional-label {
  font-size: 0.8rem;
  color: var(--text-light);
  font-weight: 400;
}

/* --- Spacing utility for stacked inputs --- */
.mt-input {
  margin-top: 16px;
}

/* --- Checkbox Groups --- */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.checkbox-group input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}
.checkbox-group label {
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
}

/* --- Calculator Action Buttons ---
   Primary (Calculate) takes visual weight. Reset is subtle.
   Both are compact -- they're utility actions, not CTAs. */
.calculator-buttons {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.calculator-buttons .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
  outline: none;
  min-height: 42px;
}
.calculator-buttons .btn-primary {
  background: var(--accent-primary);
  color: #ffffff;
  border: 1px solid transparent;
  flex: 2;
}
.calculator-buttons .btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 2px 8px rgba(224, 93, 54, 0.15);
}
.calculator-buttons .btn-outline,
.calculator-buttons .btn-lg:not(.btn-primary) {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  flex: 1;
}
.calculator-buttons .btn-outline:hover,
.calculator-buttons .btn-lg:not(.btn-primary):hover {
  background: var(--bg-subtle);
  border-color: #cbd5e1;
  color: var(--text-main);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   RIGHT PANEL: DASHBOARD RESULTS
   ========================================================================== */
/* Right panel: sticky results card. min-width:0 prevents grid blowout. */
.bf-panel-dashboard {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  padding: 32px;
  position: sticky;
  top: 100px;
  min-width: 0;
  overflow: hidden;
}

/* --- "Needs Calculation" placeholder state --- */
/* Desktop: dim results and show hint overlay.
   No position override -- sticky from .bf-panel-dashboard still applies,
   and sticky establishes a containing block for the ::after overlay. */
.bf-panel-dashboard.bf-needs-calc .results-grid,
.bf-panel-dashboard.bf-needs-calc .bf-data-grid,
.bf-panel-dashboard.bf-needs-calc .bf-cost-section,
.bf-panel-dashboard.bf-needs-calc .calculator-note,
.bf-panel-dashboard.bf-needs-calc .bf-doc-header {
  opacity: 0.25;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.bf-panel-dashboard.bf-needs-calc::after {
  content: 'Hit Calculate to see your estimate';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 14px 24px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-light);
  z-index: 2;
  white-space: nowrap;
}

.bf-panel-dashboard h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-light);
}

/* Results grid: 2 columns on wide panels, 1 column when tight */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.result-item {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
  min-width: 0;
  overflow: hidden;
}

.result-label {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Emphasize the total cost row */
.total-cost-item {
  grid-column: 1 / -1;
  background: var(--bg-subtle);
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-light);
  border-bottom: none;
  margin-top: 4px;
}
.total-cost-item .result-label {
  color: var(--accent-primary);
}
.total-cost-item .result-value {
  font-size: 2.25rem;
}

/* Calculator note/disclaimer */
.calculator-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.calculator-note strong {
  color: var(--text-main);
  font-weight: 600;
}

/* Disclaimer section (building permit, etc.) */
.disclaimer-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.disclaimer-section h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}
.disclaimer-section p {
  margin-bottom: 8px;
}
.disclaimer-section p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   SLC-SPECIFIC STYLES (from slc-calc.html demo)
   ========================================================================== */

/* Inline label + input on same line */
.bf-inline-input {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bf-inline-input label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-main);
  white-space: nowrap;
}
.bf-inline-input input {
  width: 100px;
  padding: 8px 12px;
  text-align: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-main);
  outline: none;
  transition: all var(--transition-base);
}
.bf-inline-input input:focus {
  background: var(--bg-base);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(224, 93, 54, 0.1);
}
.bf-inline-input .bf-unit {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tabs */
.bf-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px;
}
.bf-tab {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--transition-base);
  border: none;
  background: transparent;
}
.bf-tab.active {
  background: var(--bg-base);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

/* Thickness presets */
.bf-thickness-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
/* .thickness-preset is a JS selector hook; styling via .bf-thickness-btn */
.thickness-preset,
.bf-thickness-btn {
  padding: 8px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
}
.bf-thickness-btn.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(224, 93, 54, 0.05);
  font-weight: 600;
}

/* Slider */
.bf-slider-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.bf-slider-group input[type='range'] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  outline: none;
  appearance: none;
  cursor: pointer;
}
.bf-slider-group input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(224, 93, 54, 0.3);
}

/* Toggle */
.bf-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.bf-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.bf-toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}
.bf-toggle.active {
  background: var(--accent-primary);
}
.bf-toggle.active::after {
  transform: translateX(20px);
}

/* Product grid */
.bf-product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.bf-product-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}
.bf-product-card:hover {
  border-color: #cbd5e1;
  background: var(--bg-base);
}
.bf-product-icon {
  width: 40px;
  height: 40px;
  background: white;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.bf-product-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}
.bf-product-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Data grid (SLC results) */
.bf-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 32px;
}
.bf-data-item {
  display: flex;
  flex-direction: column;
}
.bf-data-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  margin-bottom: 6px;
}
.bf-data-value {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.bf-data-subtext {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}
.bf-data-highlight {
  background: var(--bg-subtle);
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-light);
  grid-column: 1 / -1;
}
.bf-data-highlight .bf-data-label {
  color: var(--accent-primary);
}
.bf-data-highlight .bf-data-value {
  font-size: 2.5rem;
}

/* ==========================================================================
   INFO SECTION (Insulation calculator guide cards)
   ========================================================================== */
.bf-info-section {
  margin-bottom: 48px;
}
.bf-info-section h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 32px;
  color: var(--text-main);
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}
.info-card {
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
}
.info-card h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}
.info-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ==========================================================================
   MATERIAL LINKS (Fence hub → sub-page links)
   ========================================================================== */
.bf-material-links {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}
.bf-material-links h4 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-main);
}
.bf-material-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bf-material-links li {
  margin-bottom: 8px;
}
.bf-material-links a {
  font-size: 0.9rem;
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}
.bf-material-links a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ==========================================================================
   RELATED RESOURCES (Bottom section)
   ========================================================================== */
.resources-section {
  padding: 80px 0 0;
  max-width: var(--container-max);
  margin: 0 auto;
}
.resources-header {
  text-align: center;
  margin-bottom: 40px;
}
.resources-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.related-resources-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 900px) {
  .related-resources-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .related-resources-list {
    grid-template-columns: 1fr;
  }
}
.related-item a {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-subtle);
  text-decoration: none;
}
.related-item a:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: #cbd5e1;
}
.resource-tag {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  margin-bottom: 16px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: 4px;
}
.related-item h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.4;
}
.related-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  flex-grow: 1;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.mt-input {
  margin-top: 1.25rem;
}
.optional-label {
  font-weight: normal;
  font-size: 0.85em;
  color: var(--text-muted);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@keyframes bf-results-reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .bf-panel-dashboard {
    position: static;
    animation: bf-results-reveal 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  /* Hide results panel entirely on mobile until Calculate is clicked */
  .bf-panel-dashboard.bf-needs-calc {
    display: none;
  }
  /* Remove the desktop ::after overlay hint on mobile (panel is hidden instead) */
  .bf-panel-dashboard.bf-needs-calc::after {
    display: none;
  }
  .bf-data-grid {
    grid-template-columns: 1fr;
  }
  .bf-product-grid {
    grid-template-columns: 1fr;
  }
  /* Sticky Calculate button so it's always reachable */
  .calculator-buttons {
    position: sticky;
    bottom: 0;
    z-index: 50;
    background: var(--bg-base);
    padding: 16px 20px;
    margin: 32px -20px 0;
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.06);
  }
}

@media (max-width: 768px) {
  .calculator-page {
    padding: 48px 16px 100px;
  }
  .bf-calc-header {
    margin-bottom: 32px;
  }
  .bf-calc-header p {
    font-size: 0.95rem;
  }
  .bf-panel-config {
    padding: 24px;
  }
  .bf-panel-dashboard {
    padding: 24px;
  }
}

@media (max-width: 640px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
  .bf-calc-header h1 {
    font-size: 1.75rem;
  }
  .bf-panel-config {
    padding: 20px 16px;
  }
  .bf-panel-dashboard {
    padding: 20px 16px;
  }
  .calculator-buttons {
    flex-direction: column;
    gap: 16px;
    margin: 32px -16px 0;
    padding: 16px;
  }
  /* Prevent iOS Safari auto-zoom on input focus */
  .input-field input,
  .input-group > input,
  .bf-select {
    min-height: 48px;
    font-size: 16px;
  }
  .calculator-buttons .btn {
    min-height: 52px;
    font-size: 1rem;
  }
  .result-value {
    font-size: 1.25rem;
  }
  .total-cost-item .result-value {
    font-size: 1.75rem;
  }
  .input-row {
    flex-direction: column;
  }
  .unit-select {
    width: 100%;
  }
  .bag-size-row,
  .sheet-size-row {
    flex-wrap: wrap;
  }
  .calculator-content {
    padding: 0 16px;
  }
}

/* ==========================================================================
   ADDITIONAL RESULT STYLING
   ========================================================================== */

/* Change order subtotal/final emphasis */
.subtotal-item {
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  margin-top: 8px;
}
.final-price-item {
  background: var(--bg-subtle);
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-light);
  margin-top: 8px;
}
.final-price-item .result-label {
  color: var(--accent-primary);
}
.final-price-item .result-value {
  font-size: 2.75rem;
}

/* ==========================================================================
   DOCUMENT-STYLE RESULTS HEADER (SLC and future document-style calculators)
   Used by calculators that show a formal estimate document layout.
   ========================================================================== */

/* Header area above the data grid */
.bf-doc-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
}

/* Title + subtitle group */
.bf-doc-title-group h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0 0 4px;
}

/* Icon next to the title */
.bf-doc-title-icon {
  flex-shrink: 0;
  color: var(--accent-primary);
}

/* Subtitle line under the title */
.bf-doc-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Date meta tag */
.bf-doc-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Dashboard content wrapper */
.bf-dashboard-content {
  padding: 4px 0;
}

/* ==========================================================================
   TOGGLE ROW LABELS (primer checkboxes, optional add-ons)
   Shared across any calculator that uses checkbox + label + hint pattern.
   ========================================================================== */
.bf-toggle-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.bf-toggle-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 1px;
}

/* Style the raw checkbox to look more intentional */
.bf-toggle-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* ==========================================================================
   COST BREAKDOWN SECTION
   ========================================================================== */
.bf-cost-section {
  margin-top: 32px;
  padding: 24px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}
.bf-cost-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
}
.bf-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  font-size: 0.95rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
}
.bf-cost-row:last-child {
  border-bottom: none;
}
.bf-cost-row-value {
  font-weight: 600;
  font-family: var(--font-display);
}
.bf-cost-total {
  font-weight: 700;
  border-top: 2px solid var(--text-main);
  border-bottom: none;
  padding-top: 12px;
  margin-top: 4px;
  font-size: 1.1rem;
}
.bf-cost-total .bf-cost-row-value {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

/* ==========================================================================
   ACTION BUTTONS (Share, Print)
   ========================================================================== */
.bf-dash-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.bf-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-primary);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  min-height: 48px;
  flex: 1;
  transition: all var(--transition-base);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 2px 4px rgba(224, 93, 54, 0.2);
}
.bf-btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 4px 12px rgba(224, 93, 54, 0.3);
}
.bf-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  cursor: pointer;
  min-height: 48px;
  flex: 1;
  transition: all var(--transition-base);
}
.bf-btn-secondary:hover {
  border-color: var(--text-main);
  background: var(--bg-subtle);
}

/* Copy feedback toast */
#copy-feedback {
  text-align: center;
  font-size: 0.8rem;
  color: #16a34a;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
  body {
    padding-top: 0;
  }
  .site-header,
  .site-footer,
  .breadcrumb-container,
  .no-print,
  #bf-bridge-bar {
    display: none !important;
  }
  .bf-app-window {
    grid-template-columns: 1fr;
  }
  .bf-panel-config {
    display: none;
  }
  .bf-panel-dashboard {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .calculator-page {
    padding: 0;
  }
}

/* SLC area badge */
.text-green-600 {
  color: #16a34a;
}
.text-xs {
  font-size: 0.75rem;
}
.font-bold {
  font-weight: 700;
}
.opacity-0 {
  opacity: 0;
}
.transition-opacity {
  transition: opacity 0.2s ease;
}

/* Calculator content wrapper (SLC) */
.calculator-content {
  padding: 0 24px;
}

/* Input unit suffix ($ sign, %, etc.)
   Positioned absolutely inside the input field, vertically centered.
   The parent input-group gets position:relative so the suffix aligns
   to the input's bottom edge, not the label above it. */
.input-unit {
  position: absolute;
  right: 12px;
  bottom: 12px; /* align to input's vertical center from bottom */
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  pointer-events: none;
  line-height: 1;
}

/* Make parent relative for absolute positioning of .input-unit */
.input-group {
  position: relative;
}
.input-field {
  position: relative;
}

/* Add right padding to inputs that have a unit suffix so text doesn't overlap */
.input-group:has(.input-unit) input,
.input-field:has(.input-unit) input,
.bf-panel-config div:has(> input + .input-unit) input {
  padding-right: 32px;
}
