/* ═══════════════════════════════════════════════════════════════
   SCENE TEXT LABEL — scene_text_label.css

   Covers TWO things:
   1. .stl-*        — the drag/position tool (scene_text_label.js)
   2. .text-label-* — the permanent rendered label (hotspots.js)
   ═══════════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════════
   PERMANENT TEXT LABEL  (.text-label-*)
   Rendered by createTextLabelElement() in hotspots.js
   from the textLabels array in data.js
══════════════════════════════════════════════════════════════ */

.text-label-hotspot {
  /* Centre on the hotspot origin */
  transform: translate(-50%, -50%);
  pointer-events: none; /* display-only, no clicks */
  user-select: none;
  -webkit-user-select: none;
}

.text-label-inner {
  display: inline-block;
  transform-origin: center center;
  /* rotation is applied inline by index.js via extraTransforms */
}

.text-label-text {
  display: block;
  font-family:
    "Arial Black", "Archivo Black", Impact, "Helvetica Neue", Arial, sans-serif;
  font-size: 42px;
  font-weight: 900;
  font-style: italic;
  color: #ffffff;
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;

  /* Thick dark outline via layered text-shadow */
  text-shadow:
    -3px -3px 0 #111,
    3px -3px 0 #111,
    -3px 3px 0 #111,
    3px 3px 0 #111,
    -3px 0 0 #111,
    3px 0 0 #111,
    0 -3px 0 #111,
    0 3px 0 #111,
    0 0 14px rgba(0, 0, 0, 0.75),
    0 0 28px rgba(0, 0, 0, 0.45);
}

/* ══════════════════════════════════════════════════════════════
   DRAG TOOL LABEL  (.stl-*)
   Rendered by scene_text_label.js for positioning only
══════════════════════════════════════════════════════════════ */

.stl-label {
  display: inline-block;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
}

.stl-inner {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  transform-origin: center center;
}

/* Handles — invisible until hover */
.stl-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 100%;
  font-size: 14px;
  opacity: 0;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  flex-shrink: 0;
  transition:
    opacity 0.2s,
    color 0.18s,
    transform 0.2s;
}
.stl-label:hover .stl-handle {
  opacity: 1;
}
.stl-move-handle {
  cursor: grab;
  padding-right: 4px;
}
.stl-move-handle:hover {
  color: #ffcc44;
}
.stl-label.stl-moving .stl-move-handle {
  cursor: grabbing;
  opacity: 1;
}
.stl-rot-handle {
  cursor: crosshair;
  padding-left: 4px;
  font-size: 16px;
}
.stl-rot-handle:hover {
  color: #88ffcc;
  transform: rotate(40deg);
}
.stl-rot-handle.stl-rotating {
  opacity: 1;
  color: #55ffaa;
  cursor: grabbing;
  animation: stl-spin-h 0.7s linear infinite;
}

@keyframes stl-spin-h {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Road-sign text — same style as permanent label */
.stl-label-text {
  font-family:
    "Arial Black", "Archivo Black", Impact, "Helvetica Neue", Arial, sans-serif;
  font-size: 42px;
  font-weight: 900;
  font-style: italic;
  color: #ffffff;
  letter-spacing: 1px;
  line-height: 1;
  padding: 0 4px;
  pointer-events: none;
  white-space: nowrap;
  text-shadow:
    -3px -3px 0 #111,
    3px -3px 0 #111,
    -3px 3px 0 #111,
    3px 3px 0 #111,
    -3px 0 0 #111,
    3px 0 0 #111,
    0 -3px 0 #111,
    0 3px 0 #111,
    0 0 12px rgba(0, 0, 0, 0.8),
    0 0 24px rgba(0, 0, 0, 0.5);
}

/* Blue glow while moving */
.stl-label.stl-moving .stl-label-text {
  text-shadow:
    -3px -3px 0 #0044aa,
    3px -3px 0 #0044aa,
    -3px 3px 0 #0044aa,
    3px 3px 0 #0044aa,
    -3px 0 0 #0044aa,
    3px 0 0 #0044aa,
    0 -3px 0 #0044aa,
    0 3px 0 #0044aa,
    0 0 18px rgba(80, 160, 255, 0.8);
}

/* ══════════════════════════════════════════════════════════════
   HUD PANEL
══════════════════════════════════════════════════════════════ */
#stl-hud {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 9500;
  width: 252px;
  background: rgba(8, 13, 28, 0.93);
  border: 1px solid rgba(80, 170, 255, 0.42);
  border-radius: 14px;
  padding: 14px 16px 16px;
  color: #cce8ff;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(28px);
  transition:
    opacity 0.28s,
    transform 0.28s;
}
#stl-hud.stl-hud-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.stl-hud-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.3px;
  color: #55aaff;
  text-transform: uppercase;
  padding-bottom: 9px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(80, 170, 255, 0.22);
}
.stl-hud-section {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: rgba(120, 180, 255, 0.42);
  text-transform: uppercase;
  margin-bottom: 5px;
}
.stl-hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.stl-hud-row span:first-child {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(160, 210, 255, 0.48);
}
#stl-yaw-val,
#stl-pitch-val {
  font-size: 12px;
  font-weight: 700;
  color: #aaddff;
  font-variant-numeric: tabular-nums;
}
.stl-hud-divider {
  height: 1px;
  background: rgba(80, 170, 255, 0.16);
  margin: 11px 0;
}

.stl-rotation-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.stl-rot-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: rgba(30, 80, 160, 0.55);
  border: 1px solid rgba(80, 170, 255, 0.38);
  border-radius: 7px;
  color: #aaddff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition:
    background 0.15s,
    transform 0.1s;
}
.stl-rot-btn:hover {
  background: rgba(50, 120, 220, 0.65);
}
.stl-rot-btn:active {
  transform: scale(0.9);
}

#stl-rot-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #1a6fcc, #55aaff);
  outline: none;
  cursor: pointer;
}
#stl-rot-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #55aaff;
  border: 2px solid #fff;
  box-shadow: 0 0 6px rgba(80, 170, 255, 0.6);
  cursor: grab;
}
#stl-rot-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.stl-rot-row {
  margin-bottom: 4px;
}
.stl-num-wrap {
  display: flex;
  align-items: center;
  gap: 3px;
}
#stl-rot-num {
  width: 52px;
  background: rgba(20, 50, 110, 0.6);
  border: 1px solid rgba(80, 170, 255, 0.38);
  border-radius: 6px;
  color: #aaddff;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  padding: 3px 5px;
  outline: none;
  -moz-appearance: textfield;
}
#stl-rot-num::-webkit-inner-spin-button,
#stl-rot-num::-webkit-outer-spin-button {
  -webkit-appearance: none;
}
#stl-rot-num:focus {
  border-color: #55aaff;
}
.stl-num-wrap span {
  font-size: 12px;
  color: rgba(160, 210, 255, 0.5);
}

.stl-small-btn {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 6px 0;
  background: rgba(20, 50, 110, 0.5);
  border: 1px solid rgba(80, 170, 255, 0.26);
  border-radius: 8px;
  color: rgba(160, 210, 255, 0.62);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.stl-small-btn:hover {
  background: rgba(30, 70, 150, 0.65);
  color: #aaddff;
}

#stl-fix-btn {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 0;
  background: linear-gradient(135deg, #1a9955, #0f7040);
  border: 1px solid #44cc77;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.18s,
    transform 0.1s;
}
#stl-fix-btn:hover {
  background: linear-gradient(135deg, #22bb66, #13904e);
  transform: scale(1.02);
}
#stl-fix-btn:active {
  transform: scale(0.97);
}

.stl-hud-hint {
  margin-top: 10px;
  font-size: 10px;
  line-height: 1.65;
  color: rgba(140, 195, 255, 0.36);
  text-align: center;
}

/* ══════════════════════════════════════════════════════════════
   SNIPPET POPUP
══════════════════════════════════════════════════════════════ */
#stl-snippet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 9600;
  width: min(660px, 95vw);
  background: rgba(6, 12, 26, 0.97);
  border: 1px solid rgba(80, 170, 255, 0.5);
  border-bottom: none;
  border-radius: 16px 16px 0 0;
  padding: 0 0 20px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Courier New", Courier, monospace;
  color: #cce8ff;
}
#stl-snippet.stl-snippet-visible {
  transform: translateX(-50%) translateY(0);
}

.stl-snip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(80, 170, 255, 0.2);
  font-size: 13px;
  font-weight: 700;
  color: #88ccff;
}
.stl-snip-header b {
  color: #ffcc44;
}
#stl-snip-close {
  background: none;
  border: none;
  color: rgba(160, 210, 255, 0.55);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}
#stl-snip-close:hover {
  color: #fff;
}

#stl-snip-code {
  margin: 0;
  padding: 16px 18px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #aaffcc;
  background: rgba(0, 20, 8, 0.6);
  overflow-x: auto;
  white-space: pre;
  max-height: 38vh;
  overflow-y: auto;
}

.stl-snip-actions {
  display: flex;
  gap: 10px;
  padding: 12px 18px 0;
}
#stl-snip-copy {
  flex: 1;
  padding: 10px 0;
  background: linear-gradient(135deg, #1560cc, #0d45a0);
  border: 1px solid #55aaff;
  border-radius: 9px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.18s,
    transform 0.1s;
}
#stl-snip-copy:hover {
  background: linear-gradient(135deg, #1e72e0, #1255bc);
}
#stl-snip-copy:active {
  transform: scale(0.97);
}

#stl-snip-close2 {
  padding: 10px 20px;
  background: rgba(20, 50, 110, 0.5);
  border: 1px solid rgba(80, 170, 255, 0.28);
  border-radius: 9px;
  color: rgba(160, 210, 255, 0.7);
  font-size: 13px;
  cursor: pointer;
}
#stl-snip-close2:hover {
  background: rgba(30, 70, 150, 0.65);
  color: #aaddff;
}

.stl-snip-note {
  margin: 12px 18px 0;
  padding: 10px 14px;
  background: rgba(255, 200, 50, 0.07);
  border: 1px solid rgba(255, 200, 50, 0.22);
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.7;
  color: rgba(255, 220, 120, 0.72);
}
.stl-snip-note code {
  background: rgba(255, 200, 50, 0.12);
  padding: 1px 4px;
  border-radius: 3px;
  color: #ffdd88;
}
.stl-snip-note b {
  color: #ffcc44;
}

/* ── Toast ───────────────────────────────────────────────────── */
.stl-toast {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 99999;
  background: rgba(14, 80, 24, 0.95);
  border: 1px solid #55cc66;
  border-radius: 12px;
  color: #ccffcc;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  font-weight: 600;
  padding: 12px 26px;
  white-space: pre-line;
  text-align: center;
  box-shadow: 0 4px 22px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity 0.32s,
    transform 0.32s;
}
.stl-toast.stl-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
