/* ============================================
   圆圈地图 - 样式表
   设计方向：深色 · 沉浸 · 玻璃质感 · 移动优先
   ============================================ */

/* ---------- CSS 变量 ---------- */
:root {
  --bg-primary: #0B1120;
  --bg-panel: rgba(18, 28, 50, 0.92);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-focus: rgba(255, 255, 255, 0.10);
  --bg-hover: rgba(255, 255, 255, 0.08);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 212, 170, 0.5);
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-tertiary: rgba(255, 255, 255, 0.30);
  --accent-1: #00D4AA;
  --accent-2: #00A3FF;
  --accent-gradient: linear-gradient(135deg, #00D4AA, #00A3FF);
  --danger: #FF4757;
  --shadow-panel: 0 -8px 40px rgba(0, 0, 0, 0.5);
  --shadow-fab: 0 4px 16px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 999px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

input, button {
  font-family: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ---------- 地图 ---------- */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Canvas 同心圆叠加层 */
#circle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* 地图控件调整（适配深色背景） */
.qq-map .map-controls {
  filter: invert(0.85) hue-rotate(180deg);
}

/* ---------- 浮动定位按钮 ---------- */
.floating-buttons {
  position: fixed;
  top: 16px;
  right: 16px;
  bottom: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(18, 28, 50, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.fab-btn:active {
  transform: scale(0.92);
}

.fab-btn.loading {
  pointer-events: none;
  opacity: 0.6;
}

.fab-btn.loading svg {
  animation: spin 1s linear infinite;
}

.fab-btn.located svg {
  color: var(--accent-1);
}

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

.pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--accent-1);
  opacity: 0;
}

.fab-btn.located .pulse-ring {
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.6; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- 底部面板 ---------- */
.bottom-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-panel);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-panel);
  max-height: 45vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 面板把手 */
.panel-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
}

.handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
}

.panel-handle:active .handle-bar {
  background: rgba(255, 255, 255, 0.25);
}

/* 面板头部 */
.panel-header {
  padding: 0 20px 12px;
  text-align: center;
}

.panel-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-subtitle {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  font-weight: 400;
}

/* 面板主体 */
.panel-body {
  padding: 0 20px calc(16px + var(--safe-bottom));
}

/* ---------- 模式切换 ---------- */
.mode-tabs {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 14px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-tab.active {
  background: rgba(0, 212, 170, 0.15);
  color: var(--accent-1);
}

.mode-tab:active {
  transform: scale(0.96);
}

/* ---------- 坐标输入 ---------- */
.input-group {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin 0.35s ease;
  opacity: 0;
  margin-bottom: 0;
}

.input-group.visible {
  max-height: 100px;
  opacity: 1;
  margin-bottom: 14px;
}

.coord-row {
  display: flex;
  gap: 10px;
}

.coord-field {
  flex: 1;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

.input-wrap {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.input-wrap:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-active);
}

.coord-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: transparent;
}

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

/* ---------- 点击提示 ---------- */
.click-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(0, 163, 255, 0.08);
  border: 1px solid rgba(0, 163, 255, 0.15);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--accent-2);
  margin-bottom: 14px;
  line-height: 1.4;
}

.click-hint.hidden {
  display: none;
}

/* ---------- 智能坐标解析 ---------- */
.parse-section {
  margin-bottom: 14px;
}

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

.parse-input-wrap {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.parse-input-wrap:focus-within {
  background: var(--bg-input-focus);
  border-color: var(--border-active);
}

.parse-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text-primary);
  background: transparent;
  outline: none;
  border: none;
  font-family: var(--font-mono);
}

.parse-input::placeholder {
  color: var(--text-tertiary);
  font-family: var(--font-sans);
}

/* ---------- 半径设置 ---------- */
.radius-section {
  margin-bottom: 14px;
}

.radius-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.radius-value-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.radius-input {
  width: 80px;
  padding: 6px 8px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-align: right;
  transition: all 0.2s ease;
}

.radius-input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-active);
}

.radius-unit {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 滑块 */
.slider-wrap {
  position: relative;
}

.radius-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  outline: none;
  transition: background 0.2s;
}

.radius-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
  transition: transform 0.2s;
}

.radius-slider::-webkit-slider-thumb:active {
  transform: scale(1.15);
}

.radius-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-gradient);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.3);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  padding: 0 2px;
}

.slider-labels span {
  font-size: 10px;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ---------- 操作按钮 ---------- */
.action-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.25);
}

.btn-primary:active {
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.2);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:active {
  background: var(--bg-hover);
}

/* ---------- 信息展示 ---------- */
.info-area {
  animation: slideUp 0.3s ease;
}

.info-area.hidden {
  display: none;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.info-divider {
  height: 1px;
  background: var(--border-color);
  margin-bottom: 12px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.info-item {
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 10px 10px;
  text-align: center;
}

.info-label {
  display: block;
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-weight: 600;
}

.info-value {
  display: block;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.3;
}

.info-value.accent {
  color: var(--accent-1);
}

/* ---------- 圆列表 ---------- */
.circle-list-section {
  margin-bottom: 14px;
}

.circle-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.circle-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.circle-list .empty-state {
  text-align: center;
  padding: 16px 0;
  font-size: 12px;
  color: var(--text-tertiary);
}

.circle-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.circle-item:hover {
  background: var(--bg-hover);
}

.circle-item.active {
  background: rgba(0, 212, 170, 0.08);
}

.circle-idx {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 212, 170, 0.12);
  color: var(--accent-1);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.circle-item.active .circle-idx {
  background: var(--accent-gradient);
  color: #fff;
}

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

.circle-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.circle-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.circle-del {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
}

.circle-item:hover .circle-del {
  opacity: 1;
}

.circle-del:hover {
  background: rgba(255, 71, 87, 0.15);
  color: var(--danger);
}

/* ---------- 滚动条美化 ---------- */
.bottom-panel::-webkit-scrollbar {
  width: 3px;
}

.bottom-panel::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

/* ---------- 小屏幕专用优化 ---------- */
@media (max-width: 480px) {
  .panel-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .panel-header {
    padding-left: 14px;
    padding-right: 14px;
  }

  .panel-title {
    font-size: 16px;
  }

  .panel-subtitle {
    font-size: 11px;
  }

  .action-row .btn {
    padding: 13px 12px;
    font-size: 14px;
  }

  .mode-tab {
    padding: 10px 6px;
    font-size: 12px;
  }

  .coord-input {
    padding: 11px 10px;
    font-size: 14px;
  }

  .radius-input {
    width: 72px;
    padding: 7px 6px;
  }

  .click-hint {
    font-size: 12px;
    padding: 9px 10px;
  }

  .info-item {
    padding: 10px 6px;
  }

  .info-value {
    font-size: 11px;
  }
}

/* 超小屏进一步紧凑 */
@media (max-width: 360px) {
  .mode-tab svg {
    display: none;
  }

  .panel-body {
    padding-left: 10px;
    padding-right: 10px;
  }

  .panel-header {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* ---------- 响应式：平板 / 桌面 ---------- */
@media (min-width: 768px) {
  .bottom-panel {
    left: auto;
    right: 24px;
    bottom: 24px;
    width: 380px;
    max-height: 70vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
  }

  .panel-handle {
    display: none;
  }

  .panel-header {
    padding-top: 6px;
  }

  .info-grid {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }

  .floating-buttons {
    top: auto;
    bottom: 24px;
    right: 420px;
  }
}

@media (min-width: 1200px) {
  .bottom-panel {
    width: 400px;
  }

  .floating-buttons {
    right: 440px;
  }
}

/* ---------- Toast 提示 ---------- */
.toast-msg {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(18, 28, 50, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  z-index: 9999;
  white-space: nowrap;
  max-width: 85vw;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 768px) {
  .toast-msg {
    top: 40px;
  }
}

/* ---------- 暗色地图控件覆盖 ---------- */
/* 腾讯地图自身控件适配 */
.qq-map .map-controls {
  filter: none;
}
