/* Floorplan editor (docs/floorplan-editor.md). Arrangement and drawing visuals only; controls, spacing and dialogs come
   from the shared UI foundation and the existing graphic editor workspace (palette | viewport | inspector). */
.floorplanWorkspace { grid-template-columns: 200px minmax(320px, 1fr) 300px; }
.floorplanViewport { padding: 0; overflow: hidden; height: min(72vh, 820px); min-height: 420px; }
.floorplanCanvas, .floorplan3d, .floorplan3dCanvas { display: block; width: 100%; height: 100%; }
/* The editor switches views with the hidden attribute; display rules above must not override it. */
.floorplanCanvas[hidden], .floorplan3d[hidden], .floorplanToolbar > .floorplan3dOptions[hidden] { display: none; }
.floorplanCanvas { background: #f8fafc; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; cursor: default; }
.floorplanViewport { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.floorplanViewport ::selection { background: transparent; }
.floorplanCanvas[data-tool="wall"], .floorplanCanvas[data-tool="room-rect"], .floorplanCanvas[data-tool="room-poly"],
.floorplanCanvas[data-tool="dimension"], .floorplanCanvas[data-tool="door"], .floorplanCanvas[data-tool="window"],
.floorplanCanvas[data-tool="opening"], .floorplanCanvas[data-tool="item"], .floorplanCanvas[data-tool="object"],
.floorplanCanvas[data-tool="template"] { cursor: crosshair; }
.floorplanCanvas[data-tool="select"] [data-kind]:not([data-kind="background"]) { cursor: move; }
.floorplanCanvas text { font-family: inherit; pointer-events: none; }
.fp-room-label { fill: #334155; font-weight: 600; }
.fp-dimension-text { fill: #0f172a; }
.fp-object-label, .fp-instance-label { fill: #205578; }
.fp-instance-label { fill: #6d28d9; font-weight: 600; }
.fp-live { fill: #205578; font-weight: 600; }
.fp-handle { fill: #ffffff; stroke: #287db5; stroke-width: 2; vector-effect: non-scaling-stroke; cursor: grab; }
.floorplan3dCanvas { touch-action: none; cursor: grab; background: #e8ecf1; }
.floorplan3dFallback { padding: 24px; color: #334155; }
.floorplanPalette button[aria-pressed="true"], .floorplanPalette button.active { border-color: #287db5; background: #e0eef8; color: #205578; }
.floorplanPalette h4 { margin: 10px 0 2px; font-size: 12px; color: #64748b; }
.floorplanLibrary summary { cursor: pointer; font-weight: 600; margin-top: 12px; }
/* Furniture library: search, category, surface variant and a list with preview, name and size (arrangement only). */
.floorplanLibrary > input, .floorplanLibrary > select { width: 100%; margin-top: 6px; }
.floorplanFurnitureList { display: grid; gap: 4px; margin-top: 6px; }
.floorplanFurnitureList h4 { margin-bottom: 0; }
.floorplanPalette button.floorplanFurniture { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 8px; align-items: center; text-align: left; height: auto; padding: 4px 6px; }
.floorplanFurniture .floorplanThumb { grid-row: 1 / span 2; width: 56px; height: 42px; object-fit: contain; }
.floorplanFurnitureName { font-weight: 600; overflow-wrap: break-word; hyphens: auto; min-width: 0; }
.floorplanFurnitureSize { color: #64748b; font-size: 11px; }
.floorplanStatus { min-height: 1.4em; margin: 0 0 8px; }
.floorplanStatus.warning { color: #92400e; }
.floorplanMaterial { display: flex; gap: 8px; align-items: flex-start; }
.floorplanMaterial details { flex: 1; min-width: 0; }
.floorplanSwatch { flex: none; width: 22px; height: 22px; border-radius: 4px; border: 1px solid #94a3b8; margin-top: 2px; }
.floorplanSwatch[data-pattern="tiles"] { background-image: linear-gradient(#0002 2px, transparent 2px), linear-gradient(90deg, #0002 2px, transparent 2px); background-size: 11px 11px; }
.floorplanSwatch[data-pattern="wood"] { background-image: repeating-linear-gradient(0deg, #0000 0 4px, #0002 4px 5px); }
.floorplanRole { border-top: 1px solid #e2e8f0; padding-top: 6px; margin-top: 6px; }
.floorplan3dOptions { grid-column: 1 / -1; }
@media (max-width: 1200px) {
  .floorplanWorkspace { grid-template-columns: 170px minmax(240px, 1fr); }
  .floorplanWorkspace > .floorplanInspector { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
  .floorplanWorkspace { display: block; }
  .floorplanViewport { height: 60vh; min-height: 320px; }
  .floorplanPalette { max-height: 160px; margin-bottom: 12px; }
}

/* Graphic element "Grundriss" in editors and the visualization runtime. */
.floorplanElement .floorplanOperable { cursor: pointer; }
.floorplanElement .floorplanOperable:hover { fill-opacity: 0.6; }
/* 3D view of the element in the visualization: arrangement only; the picture scales with the element like other graphics. */
.floorplan3dStage canvas.floorplan3dCanvas { display: block; width: 100%; height: 100%; background: transparent; touch-action: auto; cursor: default; }
.floorplan3dLabel { display: grid; gap: 1px; justify-items: center; padding: 2px 6px; background: #ffffffd9; border: 2px solid transparent; border-radius: 6px; font-size: 12px; line-height: 1.25; color: #1e293b; white-space: nowrap; }
.floorplan3dValue.strong { font-size: 14px; font-weight: 700; }
.floorplan3dValue.warn { color: #b45309; }
.floorplan3dDot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; }
.floorplanControls { position: fixed; right: 16px; bottom: 16px; z-index: 1000; width: min(340px, calc(100vw - 32px)); padding: 12px; background: #ffffff;
  border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: 0 6px 18px #0f172a2e; display: grid; gap: 8px; }
.floorplanControlRow { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.floorplanControlRow input { width: 6em; }
.floorplanControlsFeedback { margin: 0; font-size: 12px; color: #475569; }

/* Building/floor overview (docs/building-floorplan-editor.md): floor tabs, plan and room list use the shared controls. */
.buildingHead { display:flex; flex-wrap:wrap; align-items:center; gap:var(--mhome-space-sm,8px); padding:4px; }
.buildingFloors { display:flex; flex-wrap:wrap; gap:var(--mhome-space-xs,6px); }
.buildingFloor[aria-pressed="true"] { border-color:#287db5; background:#e0eef8; color:#205578; }
/* Configurable floor selector: position/form/size/alignment come from the element (data attributes), colours from the shared controls. */
.buildingSelector { display:flex; flex-wrap:wrap; gap:var(--mhome-space-xs,6px); min-width:0; }
.buildingHead[data-position="left"], .buildingHead[data-position="right"] { max-width:220px; overflow:auto; }
.buildingSelector[data-position="left"], .buildingSelector[data-position="right"], .buildingSelector[data-form="list"] { flex-direction:column; flex-wrap:nowrap; }
.buildingSelector[data-align="start"] { justify-content:flex-start; }
.buildingSelector[data-align="center"] { justify-content:center; }
.buildingSelector[data-align="end"] { justify-content:flex-end; }
.buildingSelector[data-align="stretch"] > * { flex:1 1 0; }
.buildingSelector[data-size="small"] .buildingFloor, .buildingSelector[data-size="small"] select { min-height:28px; padding:2px 8px; font-size:12px; }
.buildingSelector[data-size="large"] .buildingFloor, .buildingSelector[data-size="large"] select { min-height:52px; padding:10px 18px; font-size:18px; }
.buildingSelector[data-form="tabs"] .buildingFloor { border-radius:6px 6px 0 0; border-width:0 0 3px; background:transparent; }
.buildingSelector[data-form="tabs"] .buildingFloor[aria-pressed="true"] { border-bottom-color:#287db5; background:#e0eef8; }
.buildingSelector[data-form="list"] .buildingFloor { text-align:left; width:100%; }
.buildingSelector select { min-width:0; max-width:100%; }
.buildingFocus { position:absolute; left:8px; top:8px; display:flex; align-items:center; gap:8px; padding:4px 8px; border:1px solid #d6dce5; border-radius:6px; background:#ffffffe6; font-size:13px; }
.buildingRoom[aria-current="true"] { border-color:#287db5; background:#e0eef8; }
.floorplanRoom.floorplanRoomFocus { stroke:#287db5; stroke-width:3px; vector-effect:non-scaling-stroke; fill-opacity:0.7; }
.floorplanRoom.floorplanRoomDim { fill-opacity:0.15; }
.buildingRoom { text-align:left; display:flex; flex-direction:column; gap:2px; padding:8px; border:1px solid #d6dce5; border-radius:6px; background:#fff; }
button.buildingRoom { cursor:pointer; }
button.buildingRoom:hover { border-color:#287db5; background:#f3f8fc; }

.floorplanToolbar > .floorplan3dField[hidden] { display: none; }
