/* ==============================================================================
   BPV-XR Dashboard, Hotspot Editor, White-label & Device Pairing Styles
   ============================================================================== */

.dash-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 71px);
}

.dash-sidebar {
  background: rgba(9, 14, 26, 0.88);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.dash-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
  margin-bottom: 4px;
}

.dash-nav-item:hover {
  background: rgba(30, 41, 59, 0.65);
  color: var(--text-primary);
}

.dash-nav-item.active {
  background: rgba(var(--bpv-brand-rgb), 0.14);
  border-color: var(--border-brand);
  color: #67e8f9;
  font-weight: 600;
}

.dash-main {
  padding: 26px 28px 48px;
  max-width: 1220px;
  width: 100%;
}

.dash-panel {
  display: none;
}

.dash-panel.active {
  display: block;
}

.dash-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 6px 0 4px;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Model cards grid */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}

.model-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.model-card:hover {
  border-color: var(--border-brand);
  transform: translateY(-2px);
}

.model-thumb {
  height: 165px;
  background: radial-gradient(circle at 50% 45%, #16243d, #080d18);
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

.model-thumb model-viewer {
  width: 100%;
  height: 100%;
  --poster-color: transparent;
}

.model-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.model-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  background: rgba(6, 10, 19, 0.55);
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--bpv-brand);
  background: rgba(var(--bpv-brand-rgb), 0.08);
}

.dropzone-file {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--bpv-emerald);
  font-weight: 600;
}

/* 3D Hotspot Editor inside Modal */
.hotspot-editor-wrap {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
}

.hotspot-stage {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-brand);
  background: #070d19;
  position: relative;
}

.hotspot-stage model-viewer {
  width: 100%;
  height: 360px;
  cursor: crosshair;
}

.hotspot-pin {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  background: var(--bpv-brand);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 14px rgba(var(--bpv-brand-rgb), 0.8);
  cursor: pointer;
}

.hotspot-list {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hotspot-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

/* API Key Box */
.code-box {
  background: #04070f;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.83rem;
  color: #67e8f9;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Device PIN input */
.pin-input {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  max-width: 280px;
}

@media (max-width: 960px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 14px;
  }
  .dash-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hotspot-editor-wrap { grid-template-columns: 1fr; }
}

/* Light Mode overrides cho Dashboard */
html[data-theme="light"] .dash-sidebar {
  background: #ffffff;
  border-right-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .dash-nav-item:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html[data-theme="light"] .dash-nav-item.active {
  background: rgba(var(--bpv-brand-rgb), 0.12);
  color: #0369a1;
}

html[data-theme="light"] .dropzone,
html[data-theme="light"] .hotspot-item {
  background: #f8fafc;
}
