/* CloudVisual 360 - viewer chrome (public viewer + editor stage) */

.cv-viewer { position: relative; width: 100%; height: 100%; overflow: hidden; background: #000; }
.cv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
.cv-canvas:active { cursor: grabbing; }
.cv-viewer.cv-adding .cv-canvas { cursor: crosshair; }

/* ---- Boundary overlay ---- */
.cv-boundary-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cv-vertex-handle {
  position: absolute; transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #ff3b30;
  cursor: move; z-index: 24; box-shadow: 0 1px 6px rgba(0, 0, 0, .55);
}
.cv-vertex-handle:hover { transform: translate(-50%, -50%) scale(1.25); }

/* ---- Hotspots ---- */
.cv-hotspot-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cv-hotspot {
  position: absolute; left: 0; top: 0; pointer-events: none; text-align: center;
  /* positioned via JS transform; promote to its own layer for smooth, trail-free panning on iOS */
  will-change: transform; backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.cv-hotspot-btn {
  pointer-events: auto; cursor: pointer; border: none; padding: 0;
  background: transparent center/contain no-repeat;
  border-radius: 50%; display: block; margin: 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .6));
  transition: transform .12s;
}
.cv-hotspot-btn:hover { transform: scale(1.12); }
.cv-hotspot-btn.square { border-radius: 12%; }
.cv-hotspot-btn.flat { border-radius: 50%; transform: scaleY(var(--sy, 0.4)); }
.cv-hotspot-btn.flat:hover { transform: scaleY(var(--sy, 0.4)) scale(1.1); }
.cv-hotspot.editable .cv-hotspot-btn { cursor: move; }
.cv-hotspot.selected .cv-hotspot-btn { outline: 3px solid var(--accent, #38a8e8); outline-offset: 2px; }
.cv-hotspot-label {
  margin-top: 5px; display: inline-block;
  background: rgba(10, 14, 20, .75); color: #fff;
  font-size: 12.5px; padding: 3px 10px; border-radius: 99px;
  white-space: nowrap; opacity: 0; transition: opacity .15s;
  pointer-events: none; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
}
.cv-hotspot:hover .cv-hotspot-label,
.cv-hotspot.selected .cv-hotspot-label { opacity: 1; }
.cv-hotspot-label:empty { display: none; }

/* ---- Map pins (places of interest) ---- */
.cv-hotspot.cv-poi { text-align: center; }
.cv-poi-pin {
  margin: 0 auto; pointer-events: none;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .5));
}
.cv-hotspot.cv-poi.editable .cv-poi-pin { pointer-events: auto; cursor: move; }
.cv-poi-pin svg { width: 100%; height: 100%; display: block; }
.cv-poi-label {
  display: inline-block; margin-bottom: 2px;
  background: rgba(10, 14, 20, .78); color: #fff;
  font-size: 12.5px; font-weight: 600; padding: 3px 11px; border-radius: 99px;
  white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; box-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.cv-poi-label:empty { display: none; }

/* ---- Boundary caveat ---- */
.cv-boundary-caveat {
  position: absolute; left: 12px; bottom: 12px; z-index: 20;
  background: rgba(10, 14, 20, .6); color: #c4cfdb; font-size: 10.5px;
  padding: 3px 10px; border-radius: 99px; pointer-events: none; max-width: 65vw;
  backdrop-filter: blur(4px);
}

/* ---- Viewer page layout ---- */
.viewer-page { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
.viewer-stage { position: relative; flex: 1; min-height: 0; }

/* ---- Controls (fullscreen, gyro, zoom) ---- */
.cv-controls { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.cv-ctrl {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10, 14, 20, .65); color: #fff; border: 1px solid rgba(255, 255, 255, .18);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.cv-ctrl:hover { background: rgba(30, 40, 55, .85); }
.cv-ctrl svg { width: 20px; height: 20px; fill: currentColor; }
.cv-ctrl[aria-pressed="true"] { background: var(--accent, #38a8e8); border-color: transparent; }

/* ---- Branding ---- */
.cv-branding {
  position: absolute; right: 12px; bottom: 12px; z-index: 20;
  background: rgba(10, 14, 20, .6); color: #cfe7f7 !important;
  font-size: 11.5px; padding: 4px 11px; border-radius: 99px;
  text-decoration: none !important; border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(4px);
}
.cv-branding:hover { color: #fff !important; }
.viewer-page.has-carousel .cv-branding { bottom: 12px; }

/* ---- Instruction label ---- */
.cv-instruction {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: rgba(10, 14, 20, .65); color: #fff; font-size: 13px;
  padding: 7px 16px; border-radius: 99px; z-index: 20; pointer-events: none;
  opacity: 1; transition: opacity .8s;
}
.cv-instruction.fade { opacity: 0; }

/* ---- Loading / messages ---- */
.cv-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  z-index: 30; background: rgba(0, 0, 0, .35); pointer-events: none;
}
.cv-message {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; text-align: center;
  color: #cfd8e3; padding: 30px; z-index: 40; background: #0d1117;
}
.cv-message h2 { color: #fff; }

/* ---- Title screen ---- */
.cv-title-screen {
  position: absolute; inset: 0; z-index: 45;
  background: #000 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
.cv-title-screen::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.cv-title-screen > * { position: relative; }
.cv-title-screen h1 { color: #fff; font-size: 26px; text-shadow: 0 2px 10px rgba(0,0,0,.7); margin: 0; }
.cv-title-screen .start-btn {
  background: var(--accent, #38a8e8); color: #fff; border: none;
  font-size: 16px; font-weight: 600; padding: 12px 34px; border-radius: 99px; cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .5);
}
.cv-title-screen .start-btn:hover { filter: brightness(1.1); }

/* ---- Carousel ---- */
.cv-carousel-wrap {
  position: relative; background: rgba(10, 14, 20, .92);
  border-top: 1px solid rgba(255, 255, 255, .08);
  transition: margin-bottom .25s;
}
.cv-carousel-wrap.collapsed { margin-bottom: -86px; }
.cv-carousel-toggle {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  width: 52px; height: 24px; border: none; border-radius: 8px 8px 0 0;
  background: rgba(10, 14, 20, .92); color: #9fb2c8; cursor: pointer; font-size: 12px;
}
.cv-carousel {
  display: flex; gap: 8px; padding: 9px 12px; overflow-x: auto; height: 86px;
  scrollbar-width: thin;
}
.cv-thumb {
  position: relative; flex: 0 0 auto; width: 124px; border-radius: 8px;
  background: #1b2430 center/cover no-repeat; cursor: pointer;
  border: 2px solid transparent; overflow: hidden;
}
.cv-thumb:hover { border-color: rgba(255, 255, 255, .35); }
.cv-thumb.active { border-color: var(--accent, #38a8e8); }
.cv-thumb-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, .85));
  color: #fff; font-size: 11px; padding: 10px 6px 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.cv-thumb-preview {
  position: fixed; width: 360px; height: 180px; z-index: 1000;
  border-radius: 10px; background: #000 center/cover no-repeat;
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .65);
  pointer-events: none; overflow: hidden;
}
.cv-thumb-preview .cv-thumb-title { font-size: 13px; padding: 14px 10px 7px; }

/* ---- Overlay (video / gallery / info) ---- */
.cv-overlay {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(0, 0, 0, .75); display: flex; align-items: center; justify-content: center;
  padding: 4vmin;
}
.cv-overlay-box {
  background: #10151d; border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px;
  width: min(900px, 96%); max-height: 94%; display: flex; flex-direction: column; overflow: hidden;
}
.cv-overlay-box.small { width: min(460px, 96%); }
.cv-overlay-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: #fff; font-weight: 600; font-size: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.cv-overlay-close { background: none; border: none; color: #9fb2c8; font-size: 22px; cursor: pointer; line-height: 1; }
.cv-overlay-close:hover { color: #fff; }
.cv-overlay-body { flex: 1; min-height: 0; overflow: auto; }
.cv-overlay-body iframe, .cv-overlay-body video { display: block; width: 100%; aspect-ratio: 16/9; border: 0; background: #000; }
.cv-overlay-body .info-body { padding: 16px 18px; color: #dbe4ee; font-size: 14.5px; }
.cv-overlay-body .info-body img { max-width: 100%; border-radius: 8px; margin-top: 10px; }

/* ---- Editor: blur mask handles ---- */
.cv-mask-handle {
  position: absolute; transform: translate(-50%, -50%);
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, .9);
  background: rgba(56, 168, 232, .25);
  cursor: move; z-index: 22;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .35);
}
.cv-mask-handle.selected { border-style: solid; border-color: var(--accent, #38a8e8); }
.cv-mask-handle .n {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 14, 20, .8); color: #fff; font-size: 11px;
  padding: 1px 8px; border-radius: 99px; white-space: nowrap; pointer-events: none;
}

/* ---- Editor: start view marker ---- */
.cv-start-handle {
  position: absolute; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(13, 17, 23, .75); border: 2px solid #ffd34d;
  display: flex; align-items: center; justify-content: center;
  cursor: move; z-index: 23; box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.cv-start-handle svg { width: 18px; height: 18px; fill: #ffd34d; pointer-events: none; }
.cv-start-handle .n {
  position: absolute; top: -24px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 14, 20, .8); color: #ffd34d; font-size: 11px;
  padding: 1px 8px; border-radius: 99px; pointer-events: none; white-space: nowrap;
}

/* ---- Editor: north calibration overlay ---- */
.cv-calibrate { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
.cv-calibrate .line {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 0;
  border-left: 2px dashed rgba(255, 80, 80, .9);
}
.cv-calibrate .line::after {
  content: "N"; position: absolute; top: 14px; left: -9px;
  color: #ff7a7a; font-weight: 700; font-size: 18px; text-shadow: 0 1px 6px #000;
}
.cv-calibrate .msg {
  position: absolute; left: 50%; top: 52px; transform: translateX(-50%);
  background: rgba(10, 14, 20, .85); color: #fff; font-size: 13.5px;
  padding: 8px 18px; border-radius: 99px; white-space: nowrap;
}
.cv-calibrate .btns {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%);
  display: flex; gap: 10px; pointer-events: auto;
}
