/* GPR 简易仿真独立页：布局对齐桌面 GprSimulationForm（上模型 / 下雷达图） */
:root {
  --sim-bg: #f1f5f9;
  --sim-panel: #f8fafc;
  --sim-line: #cbd5e1;
  --sim-text: #0f172a;
  --sim-text2: #64748b;
  --sim-radar-bg: #121216;
  --sim-splitter: #94a3b8;
  --sim-primary: #2563eb;
  --sim-primary-hi: #3b82f6;
  --sim-side-col-w: 196px;
  --sim-side-col-max: min(196px, 36vw);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--sim-text);
  background: var(--sim-bg);
}

body {
  display: flex;
  flex-direction: column;
}

.simPageHeader {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 16px;
  background: var(--sim-panel);
  border-bottom: 1px solid var(--sim-line);
  flex: 0 0 auto;
}
.simPageHeader h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.simBtnTogglePanels {
  flex: 0 0 auto;
  font-size: 12px;
  padding: 5px 10px;
}
.simBackLink {
  color: var(--sim-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}
.simBackLink:hover { text-decoration: underline; }
.simHeaderHint {
  margin: 0;
  font-size: 12px;
  color: var(--sim-text2);
  flex: 1 1 200px;
}

.simApp {
  display: grid;
  grid-template-rows: 52fr 8px 48fr;
  flex: 1 1 0;
  min-height: 360px;
  height: 0;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px;
}

/* 默认隐藏右侧信息栏，由页头「显示参数」切换 */
.simApp.sim-side-panels-off .simMaterialLegend,
.simApp.sim-side-panels-off .simRadarMeta {
  display: none !important;
}

.simTopPanel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sim-panel);
  border: 1px solid var(--sim-line);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}

.simToolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  background: #eef2f7;
  border-bottom: 1px solid var(--sim-line);
  font-size: 13px;
}
.simToolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--sim-text);
  margin: 0;
}
.simToolbar select {
  min-height: 28px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--sim-line);
  background: #fff;
}
.simBtn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--sim-line);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.simBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.simBtnPrimary {
  background: linear-gradient(180deg, var(--sim-primary-hi) 0%, var(--sim-primary) 100%);
  color: #fff;
  border-color: #1d4ed8;
  font-weight: 600;
}
.simBtnPrimary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.simModelRow {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
}

.simCanvasHost {
  flex: 1 1 0;
  min-width: 0;
  min-height: 120px;
  position: relative;
  background: #fff;
}

.simMaterialLegend {
  flex: 0 0 auto;
  width: var(--sim-side-col-w);
  max-width: var(--sim-side-col-max);
  padding: 8px 10px;
  border-left: 1px solid var(--sim-line);
  background: #f8fafc;
  overflow-y: auto;
  align-self: stretch;
}
.simMaterialLegendTitle {
  font-weight: 600;
  color: var(--sim-text);
  margin: 0 0 8px;
  font-size: 11px;
}
.simMaterialLegendList {
  list-style: none;
  margin: 0;
  padding: 0;
}
.simMaterialLegendItem {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  line-height: 1.3;
}
.simMaterialLegendSwatch {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(15, 23, 42, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.simMaterialLegendLabel {
  color: var(--sim-text);
  font-size: 11px;
}
.simCanvasHost canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.simSplitHandle {
  background: linear-gradient(180deg, #e2e8f0, var(--sim-splitter), #e2e8f0);
  cursor: row-resize;
  position: relative;
  z-index: 2;
}
.simSplitHandle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.7);
}

.simBottomPanel {
  min-height: 0;
  background: var(--sim-radar-bg);
  border: 1px solid var(--sim-line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.simRadarRow {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
}

.simRadarHost {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--sim-radar-bg);
}

.simRadarMeta {
  flex: 0 0 auto;
  width: var(--sim-side-col-w);
  max-width: var(--sim-side-col-max);
  padding: 8px 10px;
  border-left: 1px solid var(--sim-line);
  background: var(--sim-panel);
  overflow-y: auto;
  align-self: stretch;
}
.simRadarMetaTitle {
  font-weight: 600;
  color: var(--sim-text);
  margin: 0 0 8px;
  font-size: 11px;
}
.simRadarMetaList {
  margin: 0;
  padding: 0;
}
.simRadarMetaList dt {
  font-size: 10px;
  color: var(--sim-text2);
  margin: 8px 0 2px;
  font-weight: 600;
  line-height: 1.25;
}
.simRadarMetaList dt:first-child {
  margin-top: 0;
}
.simRadarMetaList dd {
  margin: 0 0 2px;
  font-size: 11px;
  color: var(--sim-text);
  line-height: 1.35;
  word-break: break-word;
}
.simRadarMetaPlaceholder {
  margin: 0;
  font-size: 11px;
  color: var(--sim-text2);
  line-height: 1.4;
}

.simRadarImg {
  display: block;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-height: 0;
  /* 填满下面板，避免 contain 在两侧留出黑边（示意图允许随面板轻微拉伸） */
  object-fit: fill;
  background: var(--sim-radar-bg);
}

.simStatusBar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  height: 36px;
  padding: 0 12px;
  background: #eef2f7;
  border-top: 1px solid var(--sim-line);
  font-size: 12px;
  color: var(--sim-text2);
}
.simStatusText {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.simContrastWrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: var(--sim-text);
  font-size: 12px;
}
.simContrastWrap input[type="range"] {
  width: 140px;
}

.simSiteFooter {
  flex: 0 0 auto;
  padding: 8px 16px;
  font-size: 11px;
  color: var(--sim-text2);
  text-align: center;
}
.simSiteFooter a {
  color: var(--sim-text2);
}

.simLoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.35);
}
.simLoadingOverlay.is-visible {
  display: flex;
}
.simLoadingBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 360px;
  padding: 28px 32px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  text-align: center;
}
.simLoadingSpinner {
  width: 44px;
  height: 44px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--sim-primary);
  border-radius: 50%;
  animation: sim-loading-spin 0.75s linear infinite;
}
@keyframes sim-loading-spin {
  to { transform: rotate(360deg); }
}
.simLoadingTitle {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--sim-text);
}
.simLoadingHint {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--sim-text2);
}

@media (max-width: 720px) {
  .simApp {
    grid-template-rows: 55fr 8px 45fr;
    padding: 0 8px;
  }
  .simModelRow {
    flex-direction: column;
  }
  .simMaterialLegend {
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--sim-line);
    max-height: 200px;
  }
  .simMaterialLegendList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
  }
  .simMaterialLegendItem {
    margin-bottom: 2px;
  }

  .simRadarRow {
    flex-direction: column;
  }
  .simRadarMeta {
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--sim-line);
    max-height: 220px;
  }
}
