/* TranESS C&I — 3D Product Viewer Styles */

.tdv-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.tdv-modal.tdv-open {
  display: flex;
}

.tdv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: none;
}

.tdv-panel {
  position: relative;
  width: min(1200px, 95vw);
  height: min(820px, calc(100vh - 32px));
  height: min(820px, calc(100dvh - 32px));
  background: #0d0d1f;
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(99, 102, 241, 0.1);
  display: flex;
  flex-direction: column;
}

/* Header */
.tdv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(13, 13, 31, 0.95);
}

.tdv-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tdv-product-name {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

.tdv-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a5b4fc;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
}

.tdv-actions {
  display: flex;
  gap: 8px;
}

.tdv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tdv-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

.tdv-btn:active {
  transform: scale(0.97);
}

.tdv-icon-btn {
  padding: 8px;
  width: 36px;
  height: 36px;
}

/* Body */
.tdv-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

.tdv-canvas-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  position: relative;
  background: #0a0a1a;
}

.tdv-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Loading */
.tdv-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 10, 26, 0.9);
  z-index: 5;
}

.tdv-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: tdv-spin 0.8s linear infinite;
}

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

.tdv-loading-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
}

.tdv-progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.tdv-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #818cf8);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Hint */
.tdv-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.4);
  padding: 5px 12px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

/* Sidebar */
.tdv-sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.tdv-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
}

/* Specs */
.tdv-specs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tdv-spec-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tdv-spec-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

.tdv-spec-value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

/* Angle grid */
.tdv-angle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tdv-angle-btn {
  padding: 10px 8px;
  font-size: 12px;
}

/* Stack configuration */
.tdv-stack-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tdv-stack-btn {
  padding: 10px 12px;
  font-size: 12px;
  text-align: left;
  transition: all 0.2s ease;
}

.tdv-stack-btn.active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.6);
  color: #fff;
}

/* Toggle */
.tdv-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 0;
}

.tdv-toggle input {
  display: none;
}

.tdv-toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.tdv-toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.tdv-toggle input:checked + .tdv-toggle-slider {
  background: #6366f1;
}

.tdv-toggle input:checked + .tdv-toggle-slider::after {
  transform: translateX(16px);
}

.tdv-toggle-label {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

/* Disclaimer */
.tdv-disclaimer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tdv-disclaimer-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  line-height: 1.5;
}

/* Fullscreen */
.tdv-panel:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  max-width: none;
  max-height: none;
}

/* Responsive */
@media (max-width: 768px) {
  .tdv-panel {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    max-width: none;
    max-height: none;
  }

  .tdv-body {
    flex-direction: column;
    min-height: 0;
  }

  .tdv-canvas-wrap {
    flex: 1 1 0;
    min-height: 0;
  }

  .tdv-sidebar {
    width: 100%;
    flex: 0 0 auto;
    max-height: 45dvh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 16px;
    gap: 16px;
  }

  .tdv-hint {
    font-size: 10px;
  }

  .tdv-product-name {
    font-size: 14px;
  }
}

/* Product page trigger button */
.btn-3d-viewer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

.btn-3d-viewer:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px rgba(99, 102, 241, 0.45);
}

.btn-3d-viewer:active {
  transform: translateY(0);
}

.btn-3d-viewer svg {
  flex-shrink: 0;
}
