/* ── STL Viewer Pro — Frontend Styles ─────────────────────────────────────── */

.stvp-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
  margin: 24px 0;
  background: #0d0d1a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.stvp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10,10,25,.9);
  backdrop-filter: blur(8px);
  padding: 8px 12px;
  gap: 8px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.stvp-model-name {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #cdd6f4;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.stvp-model-name svg { flex-shrink: 0; opacity: .7; }

.stvp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.stvp-btn-view,
.stvp-btn-tool {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #a6adc8;
  padding: 4px 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: all .15s;
  line-height: 1.4;
}
.stvp-btn-view:hover,
.stvp-btn-tool:hover  { background: rgba(255,255,255,.15); color: #cdd6f4; }
.stvp-btn-view.active { background: #2271b1; border-color: #2271b1; color: #fff; }

.stvp-separator { color: rgba(255,255,255,.2); margin: 0 3px; font-size: 14px; }

/* ── Color Panel ─────────────────────────────────────────────────────────── */
.stvp-color-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(20,20,40,.95);
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.stvp-color-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stvp-color-item label {
  color: #a6adc8;
  font-size: 12px;
  margin: 0;
}
.stvp-color-item input[type=color] {
  width: 36px;
  height: 28px;
  padding: 2px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

/* ── Canvas wrap ─────────────────────────────────────────────────────────── */
.stvp-canvas-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  touch-action: none;
}
.stvp-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* ── Loading / Error overlays ───────────────────────────────────────────── */
.stvp-loading-overlay,
.stvp-error-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10,10,25,.85);
  backdrop-filter: blur(4px);
  z-index: 5;
}
.stvp-loading-inner {
  text-align: center;
  color: #cdd6f4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.stvp-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #e94560;
  border-radius: 50%;
  animation: stvp-spin 1s linear infinite;
}
.stvp-progress-bar {
  width: 180px;
  height: 3px;
  background: rgba(255,255,255,.1);
  border-radius: 3px;
  overflow: hidden;
}
.stvp-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #e94560, #2271b1);
  border-radius: 3px;
  transition: width .2s;
}
.stvp-error-overlay { color: #f38ba8; font-size: 14px; gap: 8px; }

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

/* ── Info bar ─────────────────────────────────────────────────────────────── */
.stvp-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(10,10,25,.9);
  padding: 5px 12px;
  font-size: 11px;
  color: #7f849c;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.05);
}
.stvp-info-item { white-space: nowrap; }
.stvp-hint { margin-left: auto; opacity: .6; white-space: nowrap; }

/* ── Download area ────────────────────────────────────────────────────────── */
.stvp-download-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10,10,25,.95);
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  gap: 12px;
  flex-wrap: wrap;
}
.stvp-download-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stvp-license-badge {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #a6adc8;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.stvp-dl-count {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #7f849c;
  font-size: 12px;
}
.stvp-dl-count svg { opacity: .6; }
.stvp-count-num { font-weight: 600; color: #a6adc8; }

.stvp-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #e94560, #c73652);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  font-family: inherit;
  box-shadow: 0 2px 12px rgba(233,69,96,.35);
}
.stvp-download-btn:hover {
  background: linear-gradient(135deg, #f05070, #e94560);
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(233,69,96,.5);
  color: #fff;
  text-decoration: none;
}
.stvp-download-btn:active { transform: translateY(0); }
.stvp-download-btn.stvp-login-required {
  background: linear-gradient(135deg, #4a4a6a, #3a3a5a);
  box-shadow: none;
}

/* ── Fullscreen ──────────────────────────────────────────────────────────── */
.stvp-container:-webkit-full-screen .stvp-canvas-wrap { height: calc(100vh - 120px) !important; }
.stvp-container:-moz-full-screen    .stvp-canvas-wrap { height: calc(100vh - 120px) !important; }
.stvp-container:fullscreen          .stvp-canvas-wrap { height: calc(100vh - 120px) !important; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .stvp-toolbar { padding: 6px 8px; }
  .stvp-btn-view, .stvp-btn-tool { padding: 3px 7px; font-size: 11px; }
  .stvp-model-name { max-width: 130px; font-size: 12px; }
  .stvp-separator { display: none; }
  .stvp-hint { display: none; }
  .stvp-download-area { flex-direction: column; align-items: flex-start; }
  .stvp-download-btn { width: 100%; justify-content: center; }
  .stvp-info-bar { font-size: 10px; gap: 8px; }
}

@media (max-width: 400px) {
  .stvp-toolbar-right { gap: 2px; }
  .stvp-btn-view, .stvp-btn-tool { padding: 3px 5px; }
}
