/* ============================================================
   3D Spaces by Amenify — room builder (Amenify brand)
   ============================================================ */
:root {
  /* theme synced to amenify.ai (see css/styles.css) */
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --brand-light: #eff6ff;
  --ink: #0f172a;
  --ink-soft: #64748B;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --line: rgba(15, 23, 42, 0.10);
  --radius: 12px;
  --btn-radius: 9999px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--surface-alt); }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-size: 0.92rem; margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 700 0.92rem var(--font); padding: 11px 24px; border-radius: var(--btn-radius);
  border: 1px solid transparent; cursor: pointer; transition: all 0.15s ease; letter-spacing: -0.01em;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 14px -4px rgba(191,219,254,0.9), 0 3px 6px -4px rgba(191,219,254,0.9); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.btn-ghost:disabled { opacity: 0.4; cursor: default; }

.builder-layout { display: flex; height: 100vh; height: 100dvh; }

/* ---------- wizard panel ---------- */
.wizard {
  width: 420px; min-width: 420px; background: var(--surface); padding: 26px 30px;
  display: flex; flex-direction: column; gap: 6px; overflow-y: auto;
  border-right: 1px solid var(--line);
}
.wizard-home { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); text-decoration: none; margin-bottom: 10px; display: inline-block; }
.wizard-home:hover { color: var(--brand); }
.wizard-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); text-decoration: none; margin-bottom: 26px; }
.wizard-brand em { font-style: normal; font-weight: 500; color: var(--ink-soft); font-size: 0.85em; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff;
  font-size: 0.85rem; font-weight: 800;
}
.step-label { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); }
h1 { font-size: 1.55rem; letter-spacing: -0.01em; margin: 4px 0 20px; }
.step { flex: 1; }

/* shapes */
.shape-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.shape-card {
  background: none; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 12px; cursor: pointer; font: 600 0.88rem var(--font); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.shape-card svg { width: 90px; height: 68px; }
.shape-card svg rect, .shape-card svg path { fill: #e7edf6; stroke: var(--ink); stroke-width: 3; }
.shape-card.active { border-color: var(--brand); background: var(--brand-light); }

/* floorplan box */
.floorplan-box { margin-top: 22px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.floorplan-box h4 { font-size: 0.86rem; margin-bottom: 8px; }

/* GoToScan request panel */
.fp-scan { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.fp-scan h5 { font-size: 0.85rem; margin: 0 0 4px; }
.fp-scan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.fp-scan-grid input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px;
  font: 500 0.86rem var(--font); box-sizing: border-box;
}
.fp-scan-grid input:focus { outline: none; border-color: var(--brand); }
.fp-scan-grid #scan-street { grid-column: 1 / -1; }

/* processing progress dialog (floor-plan analysis / photo build) */
.rb-progress-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  /* solid scrim (NO backdrop-filter blur — blurring over the live WebGL
     preview every frame pins the compositor and can freeze the page) */
  background: rgba(15, 23, 42, 0.55);
}
.rb-progress-card {
  width: min(380px, 90vw); background: #fff; border-radius: 16px;
  padding: 30px 28px 26px; text-align: center; box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.rb-progress-spinner {
  width: 44px; height: 44px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid var(--brand-light, #e6edff); border-top-color: var(--brand, #2563eb);
  animation: rb-spin 0.8s linear infinite;
}
@keyframes rb-spin { to { transform: rotate(360deg); } }
.rb-progress-card h3 { font-size: 1.1rem; margin: 0 0 6px; }
.rb-progress-card p { margin: 0 0 16px; font-size: 0.9rem; }
.rb-progress-track {
  height: 8px; border-radius: 999px; background: var(--line, #e5e7eb); overflow: hidden;
}
.rb-progress-bar {
  height: 100%; width: 0%; border-radius: 999px; background: var(--brand, #2563eb);
  transition: width 0.4s ease;
}
.rb-progress-bar.indeterminate {
  width: 40% !important;
  animation: rb-indet 1.1s ease-in-out infinite;
}
@keyframes rb-indet {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}
.fp-result {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px;
  font-size: 0.84rem;
}
.fp-result a { color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; }

/* the .btn display rule otherwise defeats the hidden attribute */
.btn[hidden], [hidden] { display: none !important; }

/* building autocomplete */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 280px; overflow-y: auto;
}
.ac-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: 10px 13px; border: none; background: none; cursor: pointer; border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:hover, .ac-item.active { background: var(--brand-light); }
.ac-item strong { font: 600 0.88rem var(--font); color: var(--ink); }
.ac-item span { font-size: 0.78rem; color: var(--ink-soft); }

/* AI-detected rooms */
#fp-rooms h4 { font-size: 0.86rem; margin: 10px 0 8px; }
.fp-room-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fp-room-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 8px 12px; cursor: pointer; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 10px; font: 600 0.82rem var(--font);
}
.fp-room-chip span { font-weight: 500; font-size: 0.74rem; color: var(--ink-soft); }
.fp-room-chip:hover { border-color: var(--brand); }
.fp-room-chip.active { border-color: var(--brand); background: var(--brand-light); }

/* ranges */
.range-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; font-size: 0.9rem; font-weight: 600; }
.range-row em { font-style: normal; font-weight: 500; color: var(--ink-soft); margin-left: 6px; }
.range-row input[type="range"] { width: 100%; accent-color: var(--brand); cursor: pointer; }
.unit-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.unit-btn { font: 600 0.85rem var(--font); padding: 9px 20px; border: none; background: none; cursor: pointer; }
.unit-btn.active { background: var(--ink); color: #fff; }

/* openings */
.add-row { display: flex; gap: 10px; margin-bottom: 16px; }
.opening-row {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px;
  display: flex; flex-direction: column; gap: 8px; background: var(--surface);
}
.opening-row .o-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 0.9rem; }
.opening-row select {
  font: 500 0.88rem var(--font); padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
}
.opening-row input[type="range"] { width: 100%; accent-color: var(--brand); }
.o-del { background: none; border: none; cursor: pointer; color: #b3261e; font-size: 1rem; }

/* style */
.step h4 { font-size: 0.88rem; margin: 14px 0 8px; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid var(--line); }
.swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px #fff inset; }
#rb-name {
  width: 100%; font: 500 1rem var(--font); padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px; margin-top: 4px;
}
#rb-name:focus { outline: 2px solid var(--brand); }

.wizard-actions { display: flex; gap: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.wizard-actions .btn { flex: 1; }

/* ---------- 3D preview ---------- */
.plan-wrap { flex: 1; position: relative; overflow: hidden; }
#preview3d { width: 100%; height: 100%; display: block; }

@media (max-width: 860px) {
  .builder-layout { flex-direction: column; height: auto; min-height: 100dvh; }
  .wizard { width: 100%; min-width: 0; order: 2; }
  .plan-wrap { order: 1; min-height: 38dvh; flex: none; }
  .shape-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .shape-card svg { width: 64px; height: 48px; }
}
@media (max-width: 560px) {
  .wizard { padding: 18px 16px; }
  .shape-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
