/* 3dEX v2 — minimal styles. Phase 3 introduces the toolbar button + LM panel. */

html, body {
  width: 100%; height: 100%; margin: 0; padding: 0;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  color: #fff;
}

#cesium-container { width: 100%; height: 100%; }

/* Hide Cesium's default credit overlay. */
.cesium-viewer-bottom { display: none; }

/* Top-centre version banner. */
#v2-banner {
  position: fixed; top: 8px; left: 50%; transform: translateX(-50%);
  background: rgba(255, 30, 120, 0.92); color: #fff;
  padding: 4px 12px; border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  z-index: 1000; pointer-events: none;
}

/* ── Toolbars: ≡ stays top-left; the dev tools (📷 📋) live bottom-left ─ */
#toolbar-tl {
  position: fixed; top: 8px; left: 8px;
  display: flex; gap: 4px;
  z-index: 1000;
}
#toolbar-bl {
  position: fixed; bottom: 8px; left: 8px;
  display: flex; gap: 4px;
  z-index: 1000;
}
/* Legacy ID `#toolbar` retained for back-compat: the LM toggle button code
   queries `#toolbar` directly. We make `#toolbar` an alias for #toolbar-tl. */
#toolbar { all: unset; }
.ui-btn {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.3px;
}
.ui-btn:hover { background: rgba(255, 30, 120, 0.5); border-color: rgba(255, 30, 120, 0.5); }
.ui-btn.active { background: rgba(255, 30, 120, 0.6); border-color: rgba(255, 30, 120, 0.8); }

/* ── Layer Manager panel ─────────────────────────────────────────────── */
#lm-panel {
  position: fixed;
  background: rgba(20, 20, 24, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  display: none;
  flex-direction: column;
  z-index: 999;
  font-size: 12px;
  user-select: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  min-width: 240px;
  min-height: 200px;
}
#lm-panel.open { display: flex; }

.lm-header {
  display: flex; align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: move;
  border-top-left-radius: 6px; border-top-right-radius: 6px;
}
.lm-title { flex: 1; font-weight: 700; letter-spacing: 0.5px; }
.lm-header-btn {
  background: none; color: rgba(255, 255, 255, 0.6); border: none; cursor: pointer;
  font-size: 14px; padding: 2px 6px; line-height: 1;
}
.lm-header-btn:hover { color: #ff1e78; }

.lm-body {
  flex: 1; overflow-y: auto; padding: 4px;
}

/* Group buckets */
.lm-group { margin-bottom: 4px; }
.lm-group-header {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
  font-weight: 600; letter-spacing: 0.4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-transform: uppercase;
}
.lm-group-header:hover { background: rgba(255, 30, 120, 0.18); color: #ff1e78; }
.lm-group-chevron { display: inline-block; transition: transform 0.15s ease; font-size: 10px; }
.lm-group.collapsed .lm-group-chevron { transform: rotate(-90deg); }
.lm-group.collapsed .lm-group-rows { display: none; }
.lm-group-name { flex: 1; }
.lm-group-rows { padding: 2px 0; }

/* Empty group placeholder */
.lm-group-empty {
  font-size: 10px; color: rgba(255, 255, 255, 0.3);
  font-style: italic; padding: 4px 12px;
}

/* Layer row */
.lm-row-wrap { margin: 1px 0; }
.lm-row-wrap.dragging { opacity: 0.4; }
.lm-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: grab;
}
.lm-row:hover { background: rgba(255, 255, 255, 0.06); }
.lm-row.dragging { opacity: 0.4; cursor: grabbing; }
.lm-row .lm-row-label { flex: 1; }
.lm-row-seethrough {
  flex: 0 0 auto; padding: 1px 6px; height: 18px; line-height: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  cursor: pointer; user-select: none;
}
.lm-row-seethrough:hover {
  background: rgba(255, 30, 120, 0.25);
  border-color: rgba(255, 30, 120, 0.6);
  color: #fff;
}
.lm-row-eye, .lm-row-eye-spacer {
  display: inline-block; width: 14px; height: 14px; flex-shrink: 0;
  margin: 0; cursor: pointer; accent-color: #ff1e78;
}
.lm-row-eye-spacer { visibility: hidden; }
.lm-group-eye {
  width: 14px; height: 14px; margin: 0; flex-shrink: 0;
  cursor: pointer; accent-color: #ff1e78;
}
.lm-row-chevron, .lm-row-chevron-spacer {
  display: inline-block; width: 14px; text-align: center;
  background: none; border: none; color: rgba(255, 255, 255, 0.5);
  cursor: pointer; font-size: 9px; padding: 0;
}
.lm-row-chevron:hover { color: #ff1e78; }
.lm-row-wrap.expanded .lm-row-chevron { transform: rotate(90deg); }

/* Property sub-panel (shown when a row is expanded) */
.lm-row-props {
  display: none;
  padding: 4px 12px 6px 22px;
  border-left: 2px solid rgba(255, 30, 120, 0.3);
  margin-left: 12px;
  background: rgba(0, 0, 0, 0.3);
}
.lm-row-wrap.expanded .lm-row-props { display: block; }

.lm-prop-grp {
  margin: 4px 0;
  padding: 4px 0;
}
.lm-prop-grp + .lm-prop-grp { border-top: 1px dashed rgba(255, 255, 255, 0.08); }
.lm-prop-grp-hdr {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
  color: rgba(255, 255, 255, 0.7); text-transform: uppercase;
  margin-bottom: 3px;
}
.lm-prop-row {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 0;
  font-size: 11px;
}
.lm-prop-pl { flex: 0 0 60px; color: rgba(255, 255, 255, 0.55); }

/* Resize grip (bottom-right) */
.lm-resize {
  position: absolute;
  bottom: 0; right: 0;
  width: 14px; height: 14px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 45%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.3) 55%, transparent 60%);
}

/* "Edit in author →" link — Path 1 Phase 2.
   Sits at the bottom of every layer's property panel. */
.lm-author-link-wrap {
  margin: 6px 0 2px;
}
.lm-author-link {
  display: block;
  width: 100%;
  padding: 5px 8px;
  background: rgba(255, 30, 120, 0.12);
  color: #ff80b5;
  border: 1px solid rgba(255, 30, 120, 0.4);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}
.lm-author-link:hover {
  background: rgba(255, 30, 120, 0.25);
  color: #fff;
  border-color: rgba(255, 30, 120, 0.7);
}

/* Photo thumb popup — phase4d.1 */
.photo-popup {
  position: fixed;
  bottom: 16px; right: 16px;
  width: 280px;
  background: rgba(28, 28, 32, 0.92);
  color: #eee;
  border: 1px solid rgba(255, 30, 120, 0.6);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 8px;
  z-index: 200;
  font: 13px/1.3 system-ui, sans-serif;
}
.photo-popup.hidden { display: none; }
.photo-popup-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 3px;
  background: #111;
}
.photo-popup-caption {
  margin-top: 6px;
  font-size: 11px;
  color: #aaa;
  word-break: break-all;
}
.photo-popup-close {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  font: 600 14px/1 system-ui, sans-serif;
}
.photo-popup-close:hover { background: rgba(255, 30, 120, 0.6); }
