/* ================================================================
   POI 检索与可视化 — 深色毛玻璃 UI
   参考 DESIGN.md: 城市规划师的数字工作台 / 夜间指挥中心
   ================================================================ */

:root {
  --bg: #0f172a;                 /* 深蓝灰 页面底色 */
  --panel: rgba(15, 23, 42, 0.85); /* 面板毛玻璃底 */
  --panel-border: rgba(255, 255, 255, 0.1);
  --accent: #F97316;             /* 橙色 强调 */
  --accent-hover: #EA580C;
  --blue: #3B82F6;               /* 蓝色 辅助 */
  --text: #f8fafc;               /* 近白 */
  --text-2: #e2e8f0;
  --text-3: #cbd5e1;
  --text-4: #94a3b8;
  --text-5: #64748b;
  --input-bg: rgba(30, 41, 59, 0.6);
  --danger-border: rgba(239, 68, 68, 0.3);
  --danger-bg: rgba(239, 68, 68, 0.1);
  --danger-text: #f87171;
  --success-border: rgba(34, 197, 94, 0.2);
  --success-bg: rgba(34, 197, 94, 0.05);
  --success-text: #4ade80;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
  font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  background: var(--bg);
}

.app-root {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

.hidden {
  display: none !important;
}

/* ---------- Map ---------- */
.map-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

/* ---------- Welcome hint ---------- */
.welcome-mask {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.welcome-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 48px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.welcome-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 12px;
  background: #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.welcome-title {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
  text-align: center;
}

.welcome-sub {
  margin-top: 6px;
  font-size: 14px;
  color: #94a3b8;
}

/* ---------- Search Panel ---------- */
.search-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
  width: 340px;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 20px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s ease-out;
}

/* scrollbar */
.search-panel::-webkit-scrollbar,
.result-list::-webkit-scrollbar {
  width: 6px;
}
.search-panel::-webkit-scrollbar-thumb,
.result-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 3px;
}
.search-panel::-webkit-scrollbar-track,
.result-list::-webkit-scrollbar-track {
  background: transparent;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.panel-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
}

.panel-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-2);
}

/* ---------- Fields ---------- */
.field {
  margin-bottom: 12px;
}

.keyword-field {
  margin-bottom: 16px;
}

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-4);
}

.label-optional {
  color: var(--text-5);
}

.hint-amber {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.6;
  color: rgba(251, 191, 36, 0.7);
}

.hint-gray {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-5);
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.cred-note {
  font-size: 10px;
  color: var(--text-5);
}

.notice-box {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 8px;
  background: rgba(249, 115, 22, 0.08);
  color: #fdba74;
  font-size: 11px;
  line-height: 1.6;
}

.row {
  display: flex;
  gap: 8px;
}

.flex-1 {
  flex: 1;
  min-width: 0;
}

.flex-none {
  flex: none;
}

/* ---------- Inputs ---------- */
.input-wrap {
  position: relative;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input::placeholder {
  color: var(--text-5);
}

.input:focus {
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-btn {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: transparent;
  color: var(--text-5);
  cursor: pointer;
}

.input-btn:hover {
  color: var(--text-3);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.btn-primary:not(:disabled):hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-outline {
  height: 36px;
  padding: 0 12px;
  border-color: var(--panel-border);
  background: var(--input-bg);
  color: var(--text-3);
  font-size: 12px;
}

.btn-outline:not(:disabled):hover {
  background: #334155;
  color: #fff;
}

.btn-ghost {
  height: 28px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-4);
  font-size: 12px;
  gap: 6px;
}

.btn-ghost:not(:disabled):hover {
  color: #fff;
}

.btn-icon {
  width: 28px;
  padding: 0;
  justify-content: center;
}

.btn-sm {
  height: 28px;
}

.btn-block {
  width: 100%;
  margin-bottom: 12px;
}

/* ---------- Connection area ---------- */
.error-box {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--danger-border);
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger-text);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
}

.success-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border: 1px solid var(--success-border);
  border-radius: 8px;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 12px;
}

.success-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Separator ---------- */
.separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 16px 0;
}

/* ---------- Heatmap toggle ---------- */
.heatmap-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.heatmap-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0;
  cursor: pointer;
}

.switch {
  position: relative;
  width: 40px;
  height: 22px;
  border: none;
  border-radius: 9999px;
  background: #475569;
  cursor: pointer;
  transition: background 0.2s ease-out;
  flex: none;
}

.switch[aria-checked='true'] {
  background: var(--accent);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease-out;
}

.switch[aria-checked='true'] .switch-thumb {
  transform: translateX(18px);
}

/* ---------- Results info ---------- */
.results-info {
  margin-top: 4px;
}

.results-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-4);
}

.count-accent {
  font-weight: 600;
  color: #fb923c;
}

.count-normal {
  font-weight: 600;
  color: var(--text-3);
}

.pagination-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pagination-row .btn {
  flex: 1;
  height: 28px;
  font-size: 12px;
}

.btn-page {
  border-color: var(--panel-border);
  background: var(--input-bg);
  color: var(--text-3);
}

.btn-page:not(:disabled):hover {
  background: #334155;
  color: #fff;
}

/* ---------- Result Panel ---------- */
.result-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 380px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  transform: translateX(420px);
  opacity: 0;
  pointer-events: none;
}

.result-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.result-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.badge {
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(249, 115, 22, 0.15);
  color: #fb923c;
  font-size: 11px;
}

.result-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-list-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.result-list {
  height: 100%;
  overflow-y: auto;
  padding: 8px;
}

.poi-item {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  font-family: inherit;
  transition: background 0.2s ease-out, border-color 0.2s ease-out;
}

.poi-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--accent);
}

.poi-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.poi-index {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border-radius: 4px;
  background: rgba(51, 65, 85, 0.8);
  color: var(--text-4);
  font-size: 11px;
  font-weight: 500;
}

.poi-item:hover .poi-index {
  background: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.poi-body {
  flex: 1;
  min-width: 0;
}

.poi-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poi-item:hover .poi-name {
  color: #fff;
}

.poi-address {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poi-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: var(--text-5);
}

.poi-type {
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poi-tel {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-5);
}

.result-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.result-footer p {
  text-align: center;
  font-size: 11px;
  color: var(--text-5);
}

/* ---------- Loading overlay ---------- */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-text {
  font-size: 14px;
  color: var(--text-3);
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  color: var(--accent);
  flex: none;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

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