*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #3e3e42;
  font-family: system-ui, -apple-system, sans-serif;
}

.cad-viewer-panel {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 360px;
  overflow: hidden;
  background: #3e3e42;
}

.cad-viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.cad-viewer-canvas-host {
  width: 100%;
  height: 100%;
  position: relative;
}

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

.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); }
}

.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: #3a3a3e;
  color: #e8e8e8;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  cursor: pointer;
}

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

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