/* ===========================================================
   甘肃物流园区统览平台 — 一屏演示原型
   暗色大屏风格 / 纯前端 / 无外部依赖
   =========================================================== */

:root {
  --bg: #0a1220;
  --bg2: #0e1a2c;
  --panel: rgba(18, 32, 52, .82);
  --panel-solid: #132238;
  --line: rgba(80, 160, 230, .18);
  --line-strong: rgba(80, 160, 230, .42);
  --txt: #e8f2ff;
  --txt-dim: #93a9c4;
  --txt-faint: #64789a;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f43f5e;
  --purple: #a78bfa;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  height: 100vh;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- 顶部标题栏 ---------- */
.topbar {
  flex: 0 0 62px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(90deg, #0b1526, #12233d 50%, #0b1526);
  border-bottom: 1px solid var(--line-strong);
  position: relative; z-index: 20;
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: .5;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  display: grid; place-items: center;
  font-size: 17px; font-weight: 800; color: #061020;
  box-shadow: 0 0 16px rgba(34, 211, 238, .45);
}
.brand-txt h1 { font-size: 19px; font-weight: 700; letter-spacing: 1.5px; }
.brand-txt span { font-size: 11px; color: var(--txt-faint); letter-spacing: 2px; }
.top-stats { display: flex; gap: 26px; align-items: center; }
.tstat { text-align: right; }
.tstat .v { font-size: 17px; font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }
.tstat .v small { font-size: 11px; color: var(--txt-dim); font-weight: 400; margin-left: 2px; }
.tstat .k { font-size: 11px; color: var(--txt-faint); }
.clock { text-align: right; border-left: 1px solid var(--line); padding-left: 22px; }
.clock .t { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.clock .d { font-size: 11px; color: var(--txt-faint); }

/* ---------- 主体 ---------- */
.main { flex: 1; display: flex; min-height: 0; }

.side {
  width: 268px; flex: 0 0 268px;
  background: linear-gradient(180deg, #0e1a2c, #0a1220);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.side.right { border-right: none; border-left: 1px solid var(--line); width: 288px; flex-basis: 288px; }

.sec-head {
  flex: 0 0 auto; padding: 11px 16px;
  font-size: 13px; font-weight: 700; letter-spacing: 1px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  background: rgba(20, 38, 62, .5);
}
.sec-head::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
}
.sec-head .cnt { margin-left: auto; font-size: 11px; color: var(--txt-faint); font-weight: 400; }
.sec-body { flex: 1; overflow-y: auto; padding: 8px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px; position: relative; overflow: hidden;
}
.kpi::after {
  content: ''; position: absolute; right: -14px; top: -14px;
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34,211,238,.16), transparent 70%);
}
.kpi .k { font-size: 11px; color: var(--txt-faint); margin-bottom: 5px; }
.kpi .v { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.kpi .u { font-size: 11px; color: var(--txt-dim); margin-left: 3px; font-weight: 400; }
.kpi.cyan .v { color: var(--cyan); }
.kpi.green .v { color: var(--green); }
.kpi.amber .v { color: var(--amber); }
.kpi.purple .v { color: var(--purple); }
.kpi.blue .v { color: var(--blue); }

/* 进度条 */
.bar { height: 5px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; margin-top: 7px; }
.bar > i { display: block; height: 100%; border-radius: 3px; transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* 园区列表 */
.park-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; margin-bottom: 5px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 7px; cursor: pointer;
  transition: all .18s ease;
}
.park-item:hover {
  background: rgba(30, 52, 82, .95); border-color: var(--line-strong);
  transform: translateX(3px);
}
.park-item.active {
  background: rgba(34, 211, 238, .13); border-color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(34,211,238,.25), 0 4px 14px rgba(0,0,0,.3);
}
.pi-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.pi-main { flex: 1; min-width: 0; }
.pi-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-sub { font-size: 10.5px; color: var(--txt-faint); margin-top: 2px; }
.pi-rate { text-align: right; flex: 0 0 auto; }
.pi-rate .n { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pi-rate .l { font-size: 10px; color: var(--txt-faint); }

/* ---------- 地图区 ---------- */
.map-wrap { flex: 1; position: relative; min-width: 0; background: radial-gradient(ellipse at 50% 45%, #0f2036, #080f1c 72%); }
#mapSvg { width: 100%; height: 100%; display: block; }

.city-shape { fill: #172d47; stroke: #3d6ea3; stroke-width: 1; transition: fill .2s; cursor: default; }
.city-shape:hover { fill: #1e3d5e; }
.city-label {
  fill: #a8c6e4; font-size: 11px; text-anchor: middle;
  pointer-events: none; user-select: none;
  stroke: rgba(6, 14, 26, .85);
  stroke-width: 2.5px;
  paint-order: stroke fill;
  font-weight: 500;
}

/* 园区标记 */
.park-marker { cursor: pointer; }
.park-marker .halo { opacity: .16; transition: opacity .2s; }
.park-marker .core { transition: r .2s; }
.park-marker:hover .halo { opacity: .38; }
.park-marker:hover .core { r: 11; }
.park-marker text {
  font-size: 10px; fill: #dceeff; text-anchor: middle;
  pointer-events: none; user-select: none;
  /* 描边+阴影，保证在任何底色下都清晰可读 */
  stroke: rgba(6, 14, 26, .92);
  stroke-width: 3px;
  paint-order: stroke fill;
  font-weight: 600;
}

/* 地图悬浮信息 */
.map-tip {
  position: absolute; pointer-events: none; z-index: 30;
  background: rgba(9, 18, 32, .96); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 11px 13px; min-width: 178px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  opacity: 0; transition: opacity .14s;
}
.map-tip.show { opacity: 1; }
.map-tip h4 { font-size: 13.5px; margin-bottom: 3px; }
.map-tip .addr { font-size: 10.5px; color: var(--txt-faint); margin-bottom: 8px; }
.map-tip .row { display: flex; justify-content: space-between; font-size: 11.5px; padding: 2.5px 0; }
.map-tip .row span { color: var(--txt-dim); }
.map-tip .row b { font-variant-numeric: tabular-nums; }
.map-tip .hint { margin-top: 8px; font-size: 10px; color: var(--cyan); opacity: .8; }

/* 图例 */
.legend {
  position: absolute; left: 18px; bottom: 18px; z-index: 10;
  background: rgba(10, 20, 34, .88); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 14px;
}
.legend h5 { font-size: 11px; color: var(--txt-faint); margin-bottom: 8px; font-weight: 600; }
.legend-items { display: flex; gap: 15px; }
.legend-items div { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--txt-dim); }
.legend-items i { width: 9px; height: 9px; border-radius: 50%; display: block; }

/* 地图工具条 */
.map-tools { position: absolute; right: 18px; top: 18px; z-index: 10; display: flex; flex-direction: column; gap: 6px; }
.mtool {
  width: 34px; height: 34px; border-radius: 7px;
  background: rgba(10, 20, 34, .88); border: 1px solid var(--line);
  color: var(--txt-dim); cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: all .16s;
}
.mtool:hover { border-color: var(--cyan); color: var(--cyan); background: rgba(34,211,238,.12); }

/* ---------- 详情页 ---------- */
.detail { position: absolute; inset: 0; background: var(--bg); z-index: 40; display: none; flex-direction: column; }
.detail.open { display: flex; }

.back-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 15px; border-radius: 7px; cursor: pointer;
  background: rgba(34, 211, 238, .12); border: 1px solid var(--cyan);
  color: var(--cyan); font-size: 13px; transition: all .16s;
}
.back-btn:hover { background: rgba(34,211,238,.24); }

.detail-head {
  flex: 0 0 auto; padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #0b1526, #12233d 50%, #0b1526);
  display: flex; align-items: center; gap: 22px;
}
.dh-title h2 { font-size: 20px; letter-spacing: .5px; }
.dh-title p { font-size: 11.5px; color: var(--txt-faint); margin-top: 3px; }
.dh-kpis { display: flex; gap: 28px; margin-left: auto; }
.dhk { text-align: right; }
.dhk .v { font-size: 19px; font-weight: 700; color: var(--cyan); font-variant-numeric: tabular-nums; }
.dhk .v small { font-size: 11px; color: var(--txt-dim); font-weight: 400; }
.dhk .k { font-size: 11px; color: var(--txt-faint); }

.detail-body { flex: 1; display: flex; min-height: 0; }

/* 三维画布 */
.viewer-col { flex: 1; position: relative; min-width: 0; display: flex; flex-direction: column; }
#threeHost { flex: 1; position: relative; background: radial-gradient(ellipse at 50% 60%, #14243c, #080f1c 75%); overflow: hidden; }
#threeCanvas { width: 100%; height: 100%; display: block; }

.viewer-toolbar {
  position: absolute; top: 16px; left: 16px; right: 16px; z-index: 5;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.vt-group { display: flex; background: rgba(10,20,34,.86); border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.vt-btn {
  padding: 7px 13px; font-size: 12px; color: var(--txt-dim);
  cursor: pointer; border: none; background: transparent; transition: all .15s;
  border-right: 1px solid var(--line); font-family: inherit;
}
.vt-btn:last-child { border-right: none; }
.vt-btn:hover { color: var(--cyan); background: rgba(34,211,238,.1); }
.vt-btn.active { background: var(--cyan); color: #061020; font-weight: 700; }

.viewer-hint {
  position: absolute; bottom: 14px; left: 16px; z-index: 5;
  font-size: 11px; color: var(--txt-faint); background: rgba(10,20,34,.8);
  padding: 6px 11px; border-radius: 6px; border: 1px solid var(--line);
}

.viewer-legend {
  position: absolute; bottom: 14px; right: 16px; z-index: 5;
  background: rgba(10,20,34,.88); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 13px; min-width: 156px;
}
.vl-title { font-size: 11px; color: var(--txt-faint); margin-bottom: 7px; font-weight: 600; }
.vl-row { display: flex; align-items: center; gap: 7px; font-size: 11.5px; padding: 2px 0; color: var(--txt-dim); }
.vl-row i { width: 10px; height: 10px; border-radius: 2px; display: block; flex: 0 0 10px; }

/* 悬浮详情（跟随鼠标） */
.pick-tip {
  position: absolute; z-index: 6; pointer-events: none;
  background: rgba(9,18,32,.96); border: 1px solid var(--cyan);
  border-radius: 8px; padding: 9px 12px; min-width: 150px;
  box-shadow: 0 8px 26px rgba(0,0,0,.6); opacity: 0; transition: opacity .12s;
}
.pick-tip.show { opacity: 1; }
.pick-tip h5 { font-size: 12.5px; margin-bottom: 5px; color: var(--cyan); }
.pick-tip .r { display: flex; justify-content: space-between; font-size: 11px; padding: 1.5px 0; }
.pick-tip .r span { color: var(--txt-dim); }
.pick-tip .r b { font-variant-numeric: tabular-nums; }

/* 仓库列表 */
.wh-item {
  padding: 9px 11px; margin-bottom: 5px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--line);
  cursor: pointer; transition: all .16s;
}
.wh-item:hover { background: rgba(30,52,82,.95); border-color: var(--line-strong); }
.wh-item.active { border-color: var(--cyan); background: rgba(34,211,238,.12); }
.wh-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.wh-name { font-size: 12px; font-weight: 600; }
.wh-tag { font-size: 9.5px; padding: 1.5px 6px; border-radius: 3px; border: 1px solid; }
.wh-meta { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--txt-faint); margin-top: 5px; }

/* 分区列表 */
.lot-item {
  padding: 10px 12px; margin-bottom: 7px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--line);
}
.lot-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lot-code {
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #061020;
}
.lot-name { font-size: 12.5px; font-weight: 600; flex: 1; }
.lot-num { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--txt-dim); }
.lot-num b { font-size: 15px; color: var(--txt); }

/* 滚动条 */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.03); }
::-webkit-scrollbar-thumb { background: rgba(90, 150, 210, .3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(90, 150, 210, .5); }

/* 空状态 */
.empty { text-align: center; padding: 34px 16px; color: var(--txt-faint); font-size: 12px; }

@media (max-width: 1360px) {
  .side { width: 232px; flex-basis: 232px; }
  .side.right { width: 250px; flex-basis: 250px; }
}