/* ── Arkay 3D Viewer ── */

.arkay-3dv-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(160deg, #f4f4f4 0%, #e8eaec 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* model-viewer fills the container */
.arkay-3dv-wrap model-viewer {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  --progress-bar-height: 3px;
  --progress-bar-color: #0073aa;
  --poster-color: transparent;
}

/* ── Animation panel (top-left) ───────────────────────────────────── */

.arkay-3dv-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 192px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  transition: opacity 0.2s;
}

.arkay-3dv-panel-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: 9px;
}

/* Open / Reset button row */
.arkay-3dv-panel-btns {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.arkay-3dv-btn {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.arkay-3dv-btn:hover {
  background: #f0f4f8;
  border-color: #aaa;
}
.arkay-3dv-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.arkay-3dv-btn--primary {
  background: #1d2327;
  border-color: #1d2327;
  color: #fff;
}
.arkay-3dv-btn--primary:hover {
  background: #2d3a42;
}

/* Speed row */
.arkay-3dv-panel-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  color: #555;
}
.arkay-3dv-panel-row label {
  min-width: 54px;
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}
.arkay-3dv-panel-row input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: #1d2327;
  cursor: pointer;
}
.arkay-3dv-speed-val {
  min-width: 36px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #333;
  font-weight: 600;
}

/* Progress row with Pin toggle */
.arkay-3dv-panel-row--progress {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}
.arkay-3dv-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #555;
}
.arkay-3dv-progress-header label {
  min-width: auto;
  font-size: 12px;
}
.arkay-3dv-pin-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #666;
}
/* Toggle switch for Pin */
.arkay-3dv-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.arkay-3dv-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.arkay-3dv-toggle-track {
  width: 28px;
  height: 16px;
  background: #ccc;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.arkay-3dv-toggle input:checked + .arkay-3dv-toggle-track {
  background: #1d2327;
}
.arkay-3dv-toggle-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.arkay-3dv-toggle input:checked ~ .arkay-3dv-toggle-thumb {
  transform: translateX(12px);
}
/* Full-width progress slider */
.arkay-3dv-progress-slider {
  width: 100%;
  height: 4px;
  accent-color: #1d2327;
  cursor: pointer;
  display: block;
}

/* ── Zoom bar (bottom-centre) ──────────────────────────────────────── */

.arkay-3dv-zoom-bar {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 20px;
  padding: 5px 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
  white-space: nowrap;
}

.arkay-3dv-zoom-bar input[type="range"] {
  width: 110px;
  height: 4px;
  accent-color: #1d2327;
  cursor: pointer;
  flex-shrink: 0;
}

.arkay-3dv-zoom-icon {
  color: rgba(40, 40, 40, 0.65);
  flex-shrink: 0;
  display: block;
}

.arkay-3dv-zoom-val {
  min-width: 32px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #444;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* No-animations state */
.arkay-3dv-panel--no-anim .arkay-3dv-btn,
.arkay-3dv-panel--no-anim .arkay-3dv-panel-row {
  opacity: 0.4;
  pointer-events: none;
}
.arkay-3dv-panel--no-anim::after {
  content: 'No animations in model';
  display: block;
  font-size: 10px;
  color: #999;
  margin-top: 6px;
  text-align: center;
}

/* ── View-cube gizmo (top-right) ───────────────────────────────────── */

.arkay-3dv-gizmo-wrap {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.arkay-3dv-gizmo {
  width: 54px;
  height: 54px;
  perspective: 180px;
}

.arkay-3dv-cube {
  width: 36px;
  height: 36px;
  margin: 9px;
  position: relative;
  transform-style: preserve-3d;
  /* Default: slightly tilted so three faces visible, like standard CAD view */
  transform: rotateX(-22deg) rotateY(-38deg);
  transition: transform 0.05s linear;
}

.arkay-3dv-face {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(60, 80, 100, 0.55);
  background: rgba(210, 225, 240, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(30, 50, 70, 0.85);
  backface-visibility: visible;
}

.arkay-3dv-face-front  { transform: translateZ(18px); }
.arkay-3dv-face-back   { transform: rotateY(180deg)  translateZ(18px); background: rgba(195, 215, 232, 0.55); }
.arkay-3dv-face-right  { transform: rotateY(90deg)   translateZ(18px); background: rgba(205, 220, 235, 0.60); }
.arkay-3dv-face-left   { transform: rotateY(-90deg)  translateZ(18px); background: rgba(205, 220, 235, 0.60); }
.arkay-3dv-face-top    { transform: rotateX(90deg)   translateZ(18px); background: rgba(220, 232, 242, 0.65); }
.arkay-3dv-face-bottom { transform: rotateX(-90deg)  translateZ(18px); background: rgba(200, 215, 228, 0.50); }

.arkay-3dv-gizmo-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(40, 60, 80, 0.7);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.10);
}

/* ── Hint text (bottom-left) ───────────────────────────────────────── */

.arkay-3dv-hint {
  position: absolute;
  bottom: 10px;
  left: 14px;
  z-index: 20;
  font-size: 11px;
  color: rgba(60, 60, 60, 0.65);
  pointer-events: none;
  background: rgba(255,255,255,0.5);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.01em;
}

/* ── Configure button (bottom-right) ───────────────────────────────── */

.arkay-3dv-configure {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: #1d2327;
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.22);
  transition: background 0.15s, transform 0.12s;
  pointer-events: auto;
}
.arkay-3dv-configure:hover {
  background: #2d3e4a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
  text-decoration: none;
}
.arkay-3dv-configure svg {
  opacity: 0.85;
}

/* ── Loading overlay ───────────────────────────────────────────────── */

.arkay-3dv-loading {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(244, 244, 244, 0.80);
  font-size: 12px;
  color: #666;
  pointer-events: none;
  transition: opacity 0.3s;
}
.arkay-3dv-loading.hidden {
  opacity: 0;
}
.arkay-3dv-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e0e0e0;
  border-top-color: #1d2327;
  border-radius: 50%;
  animation: arkay3dSpin 0.8s linear infinite;
}
@keyframes arkay3dSpin {
  to { transform: rotate(360deg); }
}
