/* PrusaSlicer-style CAD quick-view panel */

.cad-viewer-section {
  margin-top: 0;
}

.cad-viewer-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.cad-viewer-section .cad-viewer-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.cad-viewer-panel {
  position: relative;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  background: #3e3e42;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.cad-viewer-stage {
  position: relative;
}

.cad-viewer-canvas-host {
  width: 100%;
  height: min(520px, 70vh);
  min-height: 360px;
  position: relative;
}

.cad-viewer-canvas-host canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* Loading overlay */

.cad-viewer-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(62, 62, 66, 0.92);
  color: #d4d4d4;
  font-size: 0.85rem;
  z-index: 2;
  transition: opacity 0.25s;
}

.cad-viewer-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.cad-viewer-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #fa6831;
  border-radius: 50%;
  animation: cad-spin 0.8s linear infinite;
}

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

/* Bottom toolbar — Prusa orange accent */

.cad-viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #2b2b2e;
  border-top: 1px solid #1a1a1a;
  flex-wrap: wrap;
}

.cad-viewer-hint {
  font-size: 0.75rem;
  color: #9a9a9a;
  margin: 0;
}

.cad-viewer-actions {
  display: flex;
  gap: 0.4rem;
}

.cad-viewer-btn {
  appearance: none;
  border: 1px solid #4a4a4e;
  background: #3e3e42;
  color: #e8e8e8;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.cad-viewer-btn:hover {
  background: #4a4a4e;
  border-color: #fa6831;
}

.cad-viewer-btn.active {
  background: #fa6831;
  border-color: #fa6831;
  color: #fff;
}

.cad-viewer-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cad-viewer-meta code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--bg-elevated);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.cad-viewer-download {
  color: var(--accent);
  font-weight: 500;
}

/* Embedded CAD preview (separate mini-site in iframe) */

.cad-embed {
  margin-top: 0.75rem;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
  overflow: hidden;
  background: #3e3e42;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.cad-embed iframe {
  display: block;
  width: 100%;
  height: min(520px, 70vh);
  min-height: 360px;
  border: 0;
  background: #3e3e42;
}
