/* Arkerion configurator UI kit — the website's look for every demo.
   Used by /js/configurator-ui.js. A demo supplies its own logic and 3D scene;
   the panel, controls, price footer and quote modal come from here.
   Demo-specific widgets (e.g. the door-motion box) stay in the demo's own style.css. */

body.cfg-page {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.cfg-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.cfg-stage > canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.cfg-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  text-align: center;
  padding: 20px;
  z-index: 5;
  transition: opacity 0.3s ease;
}

.cfg-loading[hidden] {
  display: none;
}

.cfg-fallback-img {
  max-width: min(420px, 80%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cfg-loading p {
  max-width: 380px;
  margin: 0;
}

/* Bottom-left corner, plain text: no box and no glow, so the scene stays visible. */
.cfg-hint {
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  pointer-events: none;
  z-index: 3;
}

/* Floating controls over the 3D view (view tabs, Reset View, View in AR ...). Put `cfg-stage-bar` on the toolbar element:
   it places the toolbar top-left, wraps it, and keeps it inside the part of the view the panel leaves free. The kit
   publishes the panel's real width as --cfg-panel-w on the stage (the panel can be dragged), so no demo needs its own
   width guess. There is no bar or box of its own: the buttons are frosted glass (--cfg-glass) so the scene shows through
   but the labels stay readable on a light wall and on a dark evening scene alike. */
.cfg-stage {
  --cfg-glass: 0.58;
}

.cfg-stage-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - var(--cfg-panel-w, 340px) - 40px);
}

.cfg-stage-bar .btn.ghost,
.cfg-stage-bar .seg {
  background: rgba(var(--panel-rgb), var(--cfg-glass));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06);
}

/* every label in the toolbar is dark, like Reset View (the view tabs used the dimmer panel grey) */
.cfg-stage-bar .seg-btn:not(.active) {
  color: var(--text);
}

/* Other floating widgets a demo puts over the view (class `cfg-stage-float`) vanish together with the toolbar when
   the panel leaves too little of the view (the kit sets `cfg-free-narrow` on the stage: under 230px free). */
.cfg-stage-bar,
.cfg-stage-float {
  transition: opacity 0.15s ease;
}

.cfg-stage.cfg-free-narrow .cfg-stage-bar,
.cfg-stage.cfg-free-narrow .cfg-stage-float {
  opacity: 0;
  pointer-events: none;
}

.btn.small {
  padding: 8px 14px;
  font-size: 0.82rem;
}

/* ---------- panel ---------- */

/* Right-docked, full-height, drag-to-resize sheet — same pattern on every
   viewport (see configurators/CONFIGURATOR_UI_GUIDELINES.md §1 and §10). */

.cfg-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(260px, 70vw, 340px);
  background: rgba(var(--panel-rgb), 0.94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 20px 0 0 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  z-index: 4;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease;
}

.cfg-panel.dragging {
  transition: none;
}

.cfg-panel.collapsed {
  width: 56px;
}

.cfg-panel-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 18px 16px 18px 20px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: none;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 20px 0 0 0;
  position: relative;
  touch-action: none;
}

.cfg-panel-handle:hover {
  background: rgba(var(--panel-rgb), 0.6);
}

.cfg-panel-handle::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 36px;
  border-radius: 999px;
  background: var(--border);
}

.cfg-panel.collapsed .cfg-panel-handle {
  justify-content: center;
  padding-left: 0;
  border-radius: 20px 0 0 0;
}

.cfg-panel.collapsed .cfg-panel-title {
  display: none;
}

.cfg-panel-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.cfg-panel-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.cfg-panel-toggle-icon svg {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
}

.cfg-panel.collapsed .cfg-panel-scroll,
.cfg-panel.collapsed .cfg-panel-footer {
  display: none;
}

.cfg-panel-scroll {
  overflow-y: auto;
  padding: 22px;
  flex: 1;
  min-height: 0;
}

.cfg-panel-footer {
  container-type: inline-size; /* lets the price row react to the sheet's actual width (it can be dragged), not just the viewport */
  flex-shrink: 0;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
  background: rgba(var(--panel-rgb), 0.98);
  border-radius: 0 0 0 20px;
}

.cfg-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.cfg-actions:empty {
  display: none;
}

/* A module's action (e.g. "Compare") on the left, "Request a Quote" on the right, on one row.
   With no action the quote button keeps the full width. */
.cfg-panel-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 8px;
}

.cfg-panel-footer > * {
  grid-column: 1 / -1;
}

.cfg-panel-footer > .cfg-actions {
  grid-column: 1;
  margin-bottom: 0;
}

.cfg-panel-footer > #cfg-quote-btn {
  grid-column: 2;
}

.cfg-panel-footer > .cfg-actions:empty + #cfg-quote-btn {
  grid-column: 1 / -1;
}

.cfg-actions .btn,
.cfg-panel-footer > #cfg-quote-btn {
  width: 100%;
  height: 100%;
  justify-content: center;
  padding: 11px 10px;
  font-size: 0.9rem;
  text-align: center;
}

/* half width: the arrow would push "Request a Quote" onto two lines */
.cfg-panel-footer > .cfg-actions:not(:empty) + #cfg-quote-btn::after {
  display: none;
}

.cfg-section {
  padding-top: 0;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.cfg-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cfg-section h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-weight: 500;
}

.cfg-field {
  margin-bottom: 14px;
}

.cfg-field:last-child {
  margin-bottom: 0;
}

.cfg-field[hidden] {
  display: none;
}

.cfg-field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
}

.cfg-field.disabled {
  opacity: 0.55;
}

/* fine-adjustment sliders */

.cfg-fine-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem !important;
  color: var(--text-dim) !important;
  font-weight: 400 !important;
}

.cfg-fine-label span:last-child {
  font-family: var(--font-mono);
  color: var(--text);
}

.cfg-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 6px;
}

/* segmented controls */

.seg {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.seg-btn {
  flex: 1;
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}

.seg-btn + .seg-btn {
  border-left: 1px solid var(--border);
}

.seg-btn.active {
  background: var(--accent);
  color: #fbfbf8;
  font-weight: 600;
}

.seg-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.seg.wrap2 .seg-btn,
.seg.wrap3 .seg-btn {
  padding: 8px 6px;
}

/* five options: a grid of two rows (3 + 2), no stray borders */

.seg.grid5 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.seg.grid5 .seg-btn {
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 3px;
  font-size: 0.74rem;
  line-height: 1.2;
}

.seg.grid5 .seg-btn:nth-child(3n) {
  border-right: none;
}

.seg.grid5 .seg-btn:nth-last-child(-n + 2) {
  border-bottom: none;
}

.seg.grid5 .seg-btn:last-child {
  border-right: none;
}

/* on/off switch: the label on the left, the switch on the right */

.cfg-field.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cfg-field.row label {
  margin-bottom: 0;
}

.cfg-toggle {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  position: relative;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.cfg-toggle span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}

.cfg-toggle[aria-checked="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.cfg-toggle[aria-checked="true"] span {
  transform: translateX(18px);
}

/* card: a bordered group of controls (e.g. one side of a pergola); a labelled control inside it is set off by a rule */

.cfg-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.cfg-card + .cfg-card {
  margin-top: 14px;
}

.cfg-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.cfg-card-title span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.cfg-card > .cfg-field {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* swatches */

.cfg-swatch-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cfg-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--sw);
  cursor: pointer;
  padding: 0;
}

.cfg-swatch:hover {
  border-color: var(--text-dim);
}

.cfg-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.cfg-selected-name {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.85rem;
}

.cfg-selected-name strong {
  color: var(--text);
  font-weight: 600;
}

.cfg-selected-name span {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.cfg-option-note {
  margin: 10px 0 0;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.cfg-option-note[hidden] {
  display: none;
}

/* summary */

.cfg-summary {
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  row-gap: 8px;
  column-gap: 12px;
  font-size: 0.85rem;
}

.cfg-summary dt {
  color: var(--text-dim);
}

.cfg-summary dd {
  margin: 0;
  color: var(--text);
  text-align: right;
  font-weight: 500;
}

.cfg-reset {
  width: 100%;
  justify-content: center;
}

.cfg-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0;
  margin-bottom: 12px;
}

/* The total row doubles as the collapse toggle; the itemised breakdown opens beneath it (closed by default). */
.cfg-price-toggle {
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

/* On a narrow sheet the label may wrap onto two lines, but the amount never breaks. */
.cfg-price-label {
  font-size: 0.85rem;
  line-height: 1.25;
  color: var(--text-dim);
  margin-right: auto;
  min-width: 0;
}

.cfg-price-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.cfg-price-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  color: var(--text-dim);
}

.cfg-price-toggle:hover .cfg-price-toggle-icon {
  color: var(--text);
  border-color: var(--text-dim);
}

.cfg-price-toggle-icon svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

/* The section grows upward, so the chevron points up while closed ("open") and down once open ("fold away"). */
.cfg-price-toggle[aria-expanded="true"] .cfg-price-toggle-icon svg {
  transform: rotate(180deg);
}

.cfg-price-note {
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin: 0 0 14px;
}

/* optional small line under the total (priceCaption option); the -8px cancels most of .cfg-price's bottom margin so it hugs the total */
.cfg-price-caption {
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin: -8px 0 12px;
}

.cfg-price-lines {
  margin: 0 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(34vh, 220px);
  overflow-y: auto;
}

.cfg-price-lines[hidden] {
  display: none;
}

.cfg-price-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.cfg-price-line span:last-child {
  color: var(--text);
  white-space: nowrap;
}

/* Not enough room for "Estimated price" beside the amount (narrow sheet / phones): keep just the total, the chevron and the quote button. */
@container (max-width: 279px) {
  .cfg-price-label,
  .cfg-price-caption {
    display: none;
  }

  .cfg-price-value {
    margin-right: auto;
  }
}

/* quote modal */

.cfg-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

.cfg-modal-backdrop[hidden] {
  display: none;
}

.cfg-modal {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}

.cfg-modal h2 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.cfg-modal-lead {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.cfg-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.cfg-modal-close:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.cfg-modal-config {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  white-space: pre-line;
  line-height: 1.6;
}

/* ---------- mobile ---------- */

@media (max-width: 780px) {
  .cfg-stage-bar {
    top: 12px;
    left: 12px;
    gap: 6px;
    max-width: calc(100% - var(--cfg-panel-w, 56px) - 24px);
  }

  .cfg-stage-bar .btn.small {
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .cfg-stage-bar .seg-btn {
    padding: 7px 10px;
    font-size: 0.78rem;
  }

  body.cfg-page header.site .nav-links,
  body.cfg-page header.site nav.site > .btn {
    display: none;
  }

  body.cfg-page header.site .wrap {
    height: 52px;
    padding-top: 0;
    padding-bottom: 0;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  body.cfg-page header.site nav.site {
    width: auto;
    flex-wrap: nowrap;
    margin-left: auto;
  }

  .cfg-hint {
    display: none;
  }

  .cfg-panel-scroll {
    padding: 16px 18px 22px;
  }

  .cfg-panel-footer {
    padding: 12px 18px 16px;
  }

  .cfg-price-value {
    font-size: 1.25rem;
  }
}
