/* ============ 全局重置 ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
}

#app {
  width: 100vw;
  height: 100vh;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* ============ 控制面板 ============ */
.control-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 280px;
}

.control-panel h2 {
  margin-bottom: 16px;
  color: #1a365d;
  font-size: 18px;
}

/* ============ 图层切换 ============ */
.layer-toggle {
  display: flex;
  align-items: center;
  margin: 12px 0;
  padding: 10px;
  background: #f7fafc;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.layer-toggle:hover {
  background: #edf2f7;
}

.layer-toggle input {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.layer-toggle label {
  cursor: pointer;
  font-size: 14px;
  color: #2d3748;
}

/* ============ 滑块控件 ============ */
.slider-control {
  margin: 16px 0;
  padding: 12px;
  background: #f7fafc;
  border-radius: 8px;
}

.slider-control label {
  display: block;
  font-size: 13px;
  color: #4a5568;
  margin-bottom: 8px;
}

.slider-control input[type="range"] {
  width: 100%;
  cursor: pointer;
}

/* ============ 图例 ============ */
.legend {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.legend h3 {
  font-size: 14px;
  color: #4a5568;
  margin-bottom: 10px;
}

.color-bar {
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(to right,
      #30123b, #4662d7, #36aaf9, #1ae4b6,
      #72fe5e, #c8ef34, #faba39, #f66b19,
      #ca2a04, #7a0403);
}

.lic-color-bar {
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(to right,
      rgb(0, 0, 255),
      rgb(0, 255, 255),
      rgb(0, 255, 0),
      rgb(255, 255, 0),
      rgb(255, 0, 0));
}

.color-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #718096;
  margin-top: 4px;
}

/* ============ 信息面板 ============ */
.info-panel {
  position: absolute;
  top: 20px;
  left: 320px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  font-size: 13px;
  color: #4a5568;
  pointer-events: none;
}

/* ============ 加载动画 ============ */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 30px 50px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e2e8f0;
  border-top-color: #3182ce;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============ 工具按钮 ============ */
.tool-button {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #3182ce, #2c5282);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  margin: 8px 0;
}

.tool-button:hover {
  background: linear-gradient(135deg, #2c5282, #1a365d);
  transform: translateY(-1px);
}

.tool-button.active {
  background: linear-gradient(135deg, #e53e3e, #c53030);
}

/* ============ 断面图/剖面图面板 ============ */
.cross-section-panel {
  position: absolute;
  top: 20px;
  left: 320px;
  background: rgba(255, 255, 255, 0.98);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  max-width: 680px;
  max-height: calc(100vh - 40px);
  padding: 15px;
  overflow-y: auto;
}

.cross-section-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.cross-section-panel .panel-header span {
  font-size: 16px;
  font-weight: 600;
  color: #1a365d;
}

.cross-section-panel .panel-header button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #718096;
  padding: 0 5px;
}

.cross-section-panel .panel-header button:hover {
  color: #e53e3e;
}

.cross-section-panel canvas {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

.cross-section-info {
  margin-top: 10px;
  font-size: 12px;
  color: #4a5568;
  text-align: center;
}