/* Ibdaa measurement extension v1 (isolated add-on) */
#pano-container.ibm-active,
#pano-container.ibm-active .pnlm-dragfix,
#pano-container.ibm-active canvas { cursor: crosshair !important; }
#pano-container.ibm-active .pano-overlay-hotspot { opacity: .35; }

.ibm-overlay { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.ibm-overlay svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ibm-line { fill: none; stroke: var(--primary, #c9a84c); stroke-width: 2.5; stroke-linecap: round; filter: drop-shadow(0 0 2px rgba(0,0,0,.7)); }
.ibm-line.ibm-height { stroke-dasharray: 6 4; }
.ibm-line.ibm-calib { stroke: #4fd1a5; }
.ibm-dot { fill: #fff; stroke: var(--primary, #c9a84c); stroke-width: 3; }
.ibm-dot.ibm-calib { stroke: #4fd1a5; }
.ibm-label {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  background: rgba(10,12,28,.88); color: #fff; border: 1px solid var(--primary, #c9a84c);
  border-radius: 8px; padding: 3px 9px; font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.4; direction: rtl; unicode-bidi: isolate;
}
.ibm-label small { font-weight: 400; opacity: .75; margin-inline-start: 6px; }
.ibm-label.ibm-need { border-color: #ff9a62; color: #ffd2b8; }
.ibm-label.ibm-calib { border-color: #4fd1a5; }

/* Two compact choices, no settings card. Only the mode buttons intercept input. */
.ibm-quick {
  position: absolute; left: 50%; transform: translateX(-50%); top: 84px; z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: calc(100% - 24px); pointer-events: none;
}
.ibm-quick[hidden] { display: none; }
.ibm-modes {
  display: inline-flex; padding: 3px; gap: 3px; border-radius: 14px;
  background: rgba(255,255,255,.85); border: 1px solid rgba(42,42,44,.7);
  box-shadow: 0 4px 16px rgba(0,0,0,.16); pointer-events: auto;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.ibm-modes button {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px;
  background: transparent; color: #171923; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.ibm-modes button[aria-pressed="true"] { background: var(--primary, #c9a84c); color: var(--accent-text, #111); }
.ibm-modes button:focus-visible { outline: 2px solid #171923; outline-offset: 1px; }
.ibm-modes svg { width: 16px; height: 16px; flex: 0 0 16px; }
.ibm-modes [data-mode="height"] svg { transform: rotate(90deg); }
html[lang="ar"] .ibm-modes { direction: rtl; }
/* The hint does not block dragging or require dismissal. */
.ibm-hint {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: max-content; max-width: 100%; box-sizing: border-box;
  padding: 7px 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(10,12,28,.84); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.16);
  font-family: inherit; font-size: 12px; font-weight: 600; line-height: 1.5;
  text-align: center; pointer-events: none; user-select: none;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.ibm-hint[hidden] { display: none; }
.ibm-hint svg { width: 15px; height: 15px; flex: 0 0 15px; }
.ibm-hint-warn { border-color: #e9b982; }
.ibm-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
html[lang="ar"] .ibm-hint { direction: rtl; }
html[lang="en"] .ibm-label { direction: ltr; }

.ibm-panel {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%); z-index: 30;
  width: min(440px, calc(100% - 20px)); pointer-events: auto;
  background: rgba(10,12,28,.92); color: #fff; border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
  font-size: 13px; line-height: 1.5; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
}
.ibm-panel[hidden] { display: none; }
.ibm-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ibm-row + .ibm-row { margin-top: 8px; }
.ibm-chip, .ibm-act {
  border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; border-radius: 9px;
  padding: 6px 10px; font: inherit; cursor: pointer; min-height: 34px;
}
.ibm-chip[aria-pressed="true"] { background: var(--primary, #c9a84c); color: var(--accent-text, #111); border-color: var(--primary, #c9a84c); font-weight: 700; }
.ibm-act:hover, .ibm-chip:hover { border-color: var(--primary, #c9a84c); }
.ibm-act:disabled { opacity: .4; cursor: default; }
.ibm-grow { flex: 1; }
.ibm-status { color: rgba(255,255,255,.75); }
.ibm-status b { color: #fff; }
.ibm-warn { color: #ffb38a; }
.ibm-ok { color: #7fe3bf; }
.ibm-input {
  width: 92px; direction: ltr; text-align: left; background: rgba(255,255,255,.06); color: #fff;
  border: 1px solid rgba(255,255,255,.2); border-radius: 8px; padding: 6px 8px; font: inherit; min-height: 34px;
}
.ibm-note { margin-top: 6px; font-size: 11.5px; color: rgba(255,255,255,.55); }

@media (max-width: 760px) { .ibm-panel { top: 86px; font-size: 12.5px; } }
/* "Measure" pill: mirrors the existing "Plan" pill in #pano-top-actions */
#pano-top-actions > .ibm-top-btn {
  pointer-events: auto; display: flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 15px; border-radius: 14px; border: 1px solid rgb(42, 42, 44);
  background: rgba(255, 255, 255, .533); color: #000; font: 800 11px/normal -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .45); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  cursor: pointer;
}
html[lang="ar"] #pano-top-actions > .ibm-top-btn { direction: rtl; }
#pano-top-actions > .ibm-top-btn svg { width: 17px; height: 17px; }
#pano-top-actions > .ibm-top-btn:hover { border-color: var(--primary, #c9a84c); }
#pano-top-actions > .ibm-top-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
#pano-top-actions > .ibm-top-btn.ibm-on { background: var(--primary, #c9a84c); border-color: var(--primary, #c9a84c); color: var(--accent-text, #111); }
@media (max-width: 1024px) {
  #pano-top-actions > .ibm-top-btn { min-height: 48px; padding: 0 11px; border-radius: 16px; font-size: 10px; }
  #pano-top-actions > .ibm-top-btn svg { width: 15px; height: 15px; }
}
/* key dimensions layer */
.ibm-line.ibm-dim { stroke: #ffffff; stroke-width: 1.75; stroke-dasharray: none; stroke-linecap: butt; }
.ibm-label.ibm-dimlabel {
  background: rgba(15,23,47,.9); color: #fff; border: 1px solid rgba(255,255,255,.6);
  border-radius: 5px; padding: 4px 8px; font-size: 12px; font-weight: 700;
  font-variant-numeric: tabular-nums; box-shadow: 0 2px 7px rgba(0,0,0,.18);
}
.ibm-label.ibm-dim-empty {
  transform: translateX(-50%); max-width: calc(100% - 24px); box-sizing: border-box;
  white-space: normal; text-align: center; font-size: 12px;
}
