/**
 * Pointcloud Styles
 * Consolidated CSS for all pointcloud-related UI components
 * Used by: chat messages, viewer overlay, loading states
 */

/* ================= POINTCLOUD MESSAGE STYLES ================= */

/* Pointcloud messages need 100% width container */
.message.assistant[data-pointcloud="true"] .message-content,
.message.assistant .message-content:has(.chat-pointcloud-container) {
  max-width: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

/* Suppress any text below pointcloud preview */
.message.assistant[data-pointcloud="true"] .message-text,
.message.assistant:has(.chat-pointcloud-container) .message-text,
.message.assistant .message-content:has(.chat-pointcloud-container) .message-text {
  display: none !important;
}

/* Kill any legacy spinner overlays that might be injected under pointclouds */
.chat-pointcloud-wrapper .plasma-spinner-overlay,
.chat-pointcloud-container .plasma-spinner-overlay,
.chat-pointcloud-wrapper .plasma-spinner,
.chat-pointcloud-container .plasma-spinner,
.chat-pointcloud-wrapper .processing-overlay,
.chat-pointcloud-container .processing-overlay,
.chat-pointcloud-wrapper .pcv-spinner,
.chat-pointcloud-container .pcv-spinner { display: none !important; }

/* Ensure pointcloud message wrapper is also full width */
.message.assistant[data-pointcloud="true"] {
  max-width: 100% !important;
  width: 100% !important;
}

/* Stronger precedence over generic .chat-model-wrapper sizes */
.message.assistant .chat-pointcloud-wrapper {
  max-width: 300px !important;
}

/* ================= POINTCLOUD CONTAINER STYLES ================= */

.chat-pointcloud-container {
  position: relative;
  width: 300px !important;
  height: 300px !important;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer; /* ✅ Indicate clickability */
}

.chat-pointcloud-wrapper {
  position: relative;
  display: block;
  width: 300px !important;
  height: 300px !important;
  border-radius: 8px;
  overflow: hidden;
  background: var(--secondary-bg);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Remove hover overlay coming from generic model wrappers */
.chat-pointcloud-wrapper:hover::before,
.chat-pointcloud-container:hover::before {
  content: none !important;
}

/* Prevent internal canvas from resizing with responsive rules */
.pointcloud-inline-canvas {
  display: block;
  width: 300px !important;
  height: 300px !important;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none; /* ✅ Allow clicks to pass through to container */
}

/* ================= POINTCLOUD VIEWER OVERLAY STYLES ================= */

.pc-focus-backdrop {
  backdrop-filter: blur(16px) saturate(110%);
  -webkit-backdrop-filter: blur(16px) saturate(110%);
  background: rgba(12, 12, 12, 0.70) !important; /* very dark grey glass */
}

/* Pointcloud loading overlay */
.pc-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.0); /* transparent during load; blur comes from backdrop */
  z-index: 100;
  pointer-events: none;
  border-radius: 10px;
}

/* Smooth spinner - no bounce */
.pc-loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #00ffff;
  border-radius: 50%;
  animation: pc-spin-smooth 0.8s linear infinite;
  margin-bottom: 24px;
}

@keyframes pc-spin-smooth {
  to { transform: rotate(360deg); }
}

/* Loading message pill */
.pc-loading-pill {
  position: relative;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 12px 24px;
  min-width: 280px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* Progress fill inside pill */
.pc-loading-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, rgba(0, 255, 255, 0.15), rgba(0, 200, 255, 0.25));
  border-radius: 24px;
  transition: width 0.3s ease;
  z-index: 0;
}

/* Text inside pill */
.pc-loading-text {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.3px;
}

/* ================= POINTCLOUD PILL LABEL ================= */

.pointcloud-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  padding: 8px 20px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  white-space: nowrap; /* Force single line */
}

/* ================= POINTCLOUD VIEWER CLOSE BUTTON ================= */

.pc-focus-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9); /* white outline */
  background: transparent; /* no fill */
  box-shadow: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.pc-focus-close-x {
  display: block;
  font-weight: 600;
  color: #cfcfcf; /* light grey X */
  font-size: 16px;
  line-height: 1;
}

.pc-focus-close:hover {
  background: rgba(255,255,255,0.08); /* subtle glass hover */
}

