/**
 * 地图图层设置样式
 */

/* 地图源选项 */
.map-source-option {
  position: relative;
  overflow: visible;
}

/* 默认选项容器 */
.map-source-default-options {
  position: absolute;
  bottom: -40px;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 0 0 8px 8px;
  padding: 5px;
  z-index: 1000;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

/* 深色模式下的样式 */
.dark-mode .map-source-default-options {
  background-color: rgba(33, 37, 41, 0.9);
  border-color: var(--divider-color);
}

/* 默认选项按钮 */
.map-source-default-options button {
  font-size: 0.75rem;
  padding: 2px 5px;
}

/* 地图源选项悬停效果 */
.map-source-option:hover {
  z-index: 1001;
}

/* 地图图层设置区域 */
.map-layer-settings {
  position: relative;
  z-index: 10;
}

.map-layer-settings select {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 深色模式下的地图图层设置样式 */
.dark-mode .map-layer-settings .form-label {
  color: var(--primary-text);
}

.dark-mode .map-layer-settings .form-select {
  background-color: rgba(33, 33, 33, 0.7);
  border-color: var(--divider-color);
  color: var(--primary-text);
}

.dark-mode .map-layer-settings .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb), 0.25);
}

.dark-mode .map-layer-settings .form-text {
  color: var(--secondary-text);
}

.dark-mode .map-layer-settings .form-check-label {
  color: var(--primary-text);
}

/* 移动设备适配 */
@media (max-width: 768px) {
  .map-source-default-options {
    position: static;
    margin-top: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
  }

  .map-source-option {
    margin-bottom: 15px;
  }

  /* 确保移动设备上的地图图层设置可以滚动 */
  .map-layer-settings {
    overflow-y: visible;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  /* 确保选择框在移动设备上可见 */
  .map-layer-settings select {
    max-width: 100%;
    width: 100%;
  }

  /* 移动端地图图层设置按钮 */
  .mobile-map-layer-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background-color: var(--primary-color);
    color: #333;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
  }

  .dark-mode .mobile-map-layer-btn {
    background-color: var(--primary-color);
    color: #fff;
  }

  .mobile-map-layer-btn:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  }
}

/* 移动端地图图层设置面板样式 */
.mobile-map-layer-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
}

.mobile-panel-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  display: flex;
  flex-direction: column;
}

/* 面板头部 */
.mobile-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-bottom: 1px solid #eee;
  background-color: #fff;
  position: relative;
  z-index: 10;
}

.mobile-panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.mobile-panel-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  padding: 5px;
  cursor: pointer;
  color: #666;
}

/* 面板内容区域 */
.mobile-panel-body {
  flex: 1;
  overflow-y: scroll !important;
  -webkit-overflow-scrolling: touch;
  padding: 15px;
  position: relative;
  z-index: 5;
}

/* 面板底部 */
.mobile-panel-footer {
  padding: 15px;
  border-top: 1px solid #eee;
  background-color: #fff;
  position: relative;
  z-index: 10;
}

/* 移动端地图图层设置内容样式 */
.mobile-map-layer-content {
  padding-bottom: 20px;
}

.mobile-map-layer-content .form-label {
  font-weight: 500;
  margin-bottom: 8px;
}

.mobile-map-layer-content .form-select {
  margin-bottom: 15px;
  width: 100%;
}

.mobile-map-layer-content .form-check {
  margin-top: 20px;
}

.mobile-map-layer-content .form-text {
  margin-top: 5px;
  font-size: 12px;
  color: #666;
}

/* 深色模式下的面板样式 */
.dark-mode .mobile-panel-inner {
  background-color: var(--background-color);
  color: var(--primary-text);
}

.dark-mode .mobile-panel-header {
  background-color: var(--background-color);
  border-bottom-color: var(--divider-color);
}

.dark-mode .mobile-panel-footer {
  background-color: var(--background-color);
  border-top-color: var(--divider-color);
}

.dark-mode .mobile-panel-close-btn {
  color: var(--primary-text);
}

.dark-mode .mobile-map-layer-content .form-label {
  color: var(--primary-text);
}

.dark-mode .mobile-map-layer-content .form-select {
  background-color: rgba(33, 33, 33, 0.7);
  border-color: var(--divider-color);
  color: var(--primary-text);
}

.dark-mode .mobile-map-layer-content .form-text {
  color: var(--secondary-text);
}

.dark-mode .mobile-map-layer-content .form-check-label {
  color: var(--primary-text);
}

.dark-mode .mobile-map-layer-content .form-check-input {
  background-color: rgba(33, 33, 33, 0.7);
  border-color: var(--divider-color);
}

.dark-mode .mobile-map-layer-content .form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

/* 叠加图层样式 */
.map-source-divider {
  margin: 20px 0;
  text-align: center;
}

.map-source-divider hr {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
  margin: 10px 0;
}

.map-source-divider h4 {
  color: #666;
  font-size: 16px;
  font-weight: 500;
  margin: 0;
}

.dark-mode .map-source-divider hr {
  background: linear-gradient(to right, transparent, #555, transparent);
}

.dark-mode .map-source-divider h4 {
  color: var(--primary-text);
}

/* 叠加图层分类标题 */
.overlay-source-category {
  font-weight: 600;
  font-size: 14px;
  color: #666;
  margin: 15px 0 10px 0;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dark-mode .overlay-source-category {
  color: var(--primary-text);
  border-bottom-color: var(--divider-color);
}

/* 叠加图层网格 */
.overlay-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .overlay-source-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* 叠加图层选项 */
.overlay-source-option {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #fff;
  position: relative;
  gap: 12px;
}

.overlay-source-option:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.overlay-source-option.active {
  border-color: var(--primary-color);
  background-color: rgba(var(--primary-color-rgb), 0.1);
}

.dark-mode .overlay-source-option {
  background-color: rgba(33, 33, 33, 0.7);
  border-color: var(--divider-color);
  color: var(--primary-text);
}

.dark-mode .overlay-source-option:hover {
  border-color: var(--primary-color);
  background-color: rgba(var(--primary-color-rgb), 0.2);
}

.dark-mode .overlay-source-option.active {
  border-color: var(--primary-color);
  background-color: rgba(var(--primary-color-rgb), 0.3);
}

/* 叠加图层图标 */
.overlay-source-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(var(--primary-color-rgb), 0.1);
  border-radius: 6px;
  flex-shrink: 0;
}

.overlay-source-icon i {
  font-size: 16px;
  color: var(--primary-color);
}

.dark-mode .overlay-source-icon {
  background-color: rgba(var(--primary-color-rgb), 0.2);
}

/* 叠加图层名称 */
.overlay-source-name {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
  color: #333;
}

.dark-mode .overlay-source-name {
  color: var(--primary-text);
}

/* 叠加图层切换开关 */
.overlay-source-toggle {
  flex-shrink: 0;
}

.overlay-source-toggle .form-check-input {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.overlay-source-toggle .form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.dark-mode .overlay-source-toggle .form-check-input {
  background-color: rgba(33, 33, 33, 0.7);
  border-color: var(--divider-color);
}

.dark-mode .overlay-source-toggle .form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}
