/* 圣强门店地图 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body, #map {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1e293b;
}

/* ---------- 标题卡片 ---------- */
.title-card {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .12);
}
.title-card h1 {
  font-size: 17px;
  font-weight: 600;
}
.title-card p {
  font-size: 13px;
  color: #64748b;
  margin-top: 2px;
}
.title-card b { color: #10b981; }

/* ---------- 控制面板 ---------- */
#panel {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 200;
  width: 230px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .12);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#panel-toggle {
  display: none;
  position: absolute;
  top: -12px;
  left: -12px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(16, 185, 129, .4);
}

.switch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.panel-row.switch-row .chip:last-child { grid-column: 1 / -1; }
.brand-filter .chip:first-child { grid-column: 1 / -1; }
/* 胶囊式开关 */
.chip { position: relative; }
.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.chip span {
  display: block;
  text-align: center;
  padding: 6px 0;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  color: #64748b;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: all .15s;
}
.chip span:hover { border-color: #10b981; color: #10b981; }
.chip input:checked + span {
  background: #10b981;
  border-color: #10b981;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(16, 185, 129, .35);
}

.row-label {
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}
.store-count {
  font-size: 13px;
  color: #10b981;
  font-weight: 600;
}

.btn-row { display: flex; gap: 8px; }
.btn {
  flex: 1;
  padding: 9px 0;
  border: none;
  border-radius: 10px;
  background: #10b981;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost {
  background: #f1f5f9;
  color: #475569;
}
.btn.active {
  background: #ef4444;
}

/* 图例 */
.legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
}
.legend i {
  flex: 1;
  height: 10px;
  border-radius: 3px;
}
.tip {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

/* ---------- 信息窗体 ---------- */
.iw { font-size: 15px; line-height: 1.6; }
.iw-name { font-weight: 600; font-size: 16px; }
.iw-aor { color: #64748b; font-size: 13px; }
.iw .tag-ours { color: #059669; }
.iw .tag-other { color: #64748b; }
.iw-del {
  margin-top: 8px;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* ---------- 门店标记（大头针 + 名称） ---------- */
.pinwrap {
  position: relative;
}
.pin {
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .4);
}
.pin::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}
.pin-ours { background: #ef4444; }
.pin-other { background: #22c55e; }
.pin-pending { background: #f59e0b; }

/* 名称标签：默认隐藏；放大后全显 / 悬停显示 / 勾选常显 */
.mk-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
  display: none;
  z-index: 999;
}
#map.zoomed .mk-label,
#map.force-labels .mk-label,
.pinwrap:hover .mk-label { display: block; }
.mk-label-ours {
  background: #ef4444;
  color: #fff;
  font-weight: 600;
}
.mk-label-other {
  background: rgba(255, 255, 255, .95);
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* ---------- 管理模式面板 ---------- */
.admin-panel {
  display: none;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}
.admin-title {
  font-size: 15px;
  font-weight: 700;
  color: #10b981;
}
.admin-chk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
}
.admin-chk input { width: 17px; height: 17px; accent-color: #10b981; }
.admin-link {
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  text-align: center;
}
.admin-panel select,
.admin-panel input[type="text"],
.admin-panel input:not([type]) {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.admin-panel select:focus,
.admin-panel input:focus { border-color: #10b981; }
.coord {
  font-size: 12px;
  color: #64748b;
  word-break: break-all;
}

/* ---------- Toast（微信风格，居中） ---------- */
#toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.9);
  z-index: 500;
  background: rgba(17, 24, 39, .85);
  color: #fff;
  font-size: 15px;
  padding: 18px 22px;
  border-radius: 12px;
  max-width: 70vw;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---------- 管理登录遮罩（?admin=1 未登录时） ---------- */
#admin-login {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 550;
  background: rgba(241, 245, 249, .96);
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#admin-login.show { display: flex; }
#admin-login .login-card {
  width: 320px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, .15);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
#admin-login .login-card h2 { font-size: 19px; }
#admin-login .login-card input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  text-align: center;
}
#admin-login .login-card input:focus { border-color: #10b981; }
.login-err { color: #dc2626; font-size: 13px; min-height: 18px; }
#admin-login .btn { width: 100%; padding: 11px 0; }
#admin-login .login-links {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-top: 4px;
}
#admin-login .login-links a { color: #2563eb; text-decoration: none; }

/* ---------- 错误提示 ---------- */
#fatal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 600;
  background: #f8fafc;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #334155;
  padding: 30px;
  text-align: center;
}

/* ---------- 编辑模式光标 ---------- */
body.editing #map { cursor: crosshair; }

/* ---------- 手机端适配 ---------- */
@media (max-width: 640px) {
  .title-card h1 { font-size: 15px; }
  .title-card p { font-size: 12px; }
  #panel-toggle { display: block; }
  #panel {
    width: calc(100vw - 28px);
    top: auto;
    bottom: 14px;
  }
  #panel.collapsed .panel-row,
  #panel.collapsed .legend,
  #panel.collapsed .tip { display: none; }
  #panel.collapsed { padding: 10px 14px; }
  #panel.collapsed::after {
    content: "展开控制面板";
    font-size: 15px;
    font-weight: 600;
    color: #10b981;
  }
  .title-card { max-width: calc(100vw - 90px); }
}
