/* ============================================================
 * 地理信息模态框居中悬浮重构
 * ============================================================
 * 基于精确架构说明的重构实现
 * 核心目标：废弃底部吸附式布局，改为完全居中悬浮模态框
 * ============================================================ */

/* 第一层：全局暗色遮罩（Overlay/Backdrop） */
.geography-edit-modal {
  position: fixed;
  inset: 0; /* top/right/bottom/left 全为 0 */
  background-color: rgba(0, 0, 0, 0.5); /* 黑色半透明 */
  display: flex;
  align-items: center;
  justify-content: center; /* 让内部主卡片绝对居中的核心引擎 */
  z-index: var(--z-index-modal); /* 极高的 z-index，确保覆盖原有底层页面 */
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.geography-edit-modal.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* 第二层：居中悬浮主容器（Main Modal Container） */
.geography-edit-body {
  width: 90%; /* 移动端适中宽度 */
  max-width: 400px;
  max-height: 85vh; /* 防止垂直撑爆屏幕 */
  background: #ffffff;
  border-radius: 12px; /* 圆角 */
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); /* 隐形阴影增加悬浮感 */
  display: flex;
  flex-direction: column; /* 内部采用纵向 Flex 布局 */
  overflow: hidden; /* 绝杀 Bug 声明：防止内部滚动条破坏圆角 */
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.geography-edit-modal.active .geography-edit-body {
  transform: scale(1);
}

/* 第三层：顶部操作栏（Header - 挂载于主容器内部最上方） */
.geography-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px; /* 高度固定 */
  padding: 0 16px;
  background: #ffffff;
  border-bottom: 1px solid #e5e5ea;
  position: relative;
  width: 100%; /* 必须强制声明 width: 100% - 彻底修复宽度坍塌Bug */
  box-sizing: border-box;
  flex-shrink: 0; /* 严禁被挤压 */
  /* 定位：作为纵向 Flex 容器的第一个子元素，严禁使用 position: fixed 或 absolute */
}

.geography-edit-cancel,
.geography-edit-save {
  background: none;
  border: none;
  font-size: 17px;
  cursor: pointer;
  padding: 8px 12px;
  min-width: 60px;
  text-align: center;
  flex-shrink: 0; /* 防止按钮被压缩 */
  white-space: nowrap; /* 无换行 */
}

.geography-edit-cancel {
  color: #007AFF; /* 蓝色 */
}

.geography-edit-save {
  color: #007AFF; /* 蓝色 */
  font-weight: 600;
}

.geography-edit-save:disabled {
  color: #c7c7cc;
}

.geography-edit-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  font-weight: 600; /* 黑色加粗 */
  color: #000000;
  text-align: center;
  pointer-events: none;
}

/* 第四层：内容滚动区（Scrollable Content Body - 挂载于主容器内部下方） */
.geography-edit-content {
  flex: 1; /* 占据主容器剩余的所有空间 */
  overflow-y: auto; /* 必须声明 overflow-y: auto */
  -webkit-overflow-scrolling: touch;
  padding: 20px;
  box-sizing: border-box;
}

/* 地理信息表单组 */
.geography-form-group {
  margin-bottom: 20px;
  width: 100%;
  box-sizing: border-box;
}

.geography-form-group:last-child {
  margin-bottom: 0;
}

.geography-form-label {
  display: block;
  font-size: 13px;
  color: #8e8e93;
  margin-bottom: 8px;
  font-weight: 500;
}

.geography-form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  font-size: 15px;
  background: #ffffff;
  box-sizing: border-box;
}

.geography-form-input:focus {
  outline: none;
  border-color: #007AFF;
}

.geography-form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  font-size: 15px;
  background: #ffffff;
  resize: vertical;
  min-height: 80px;
  box-sizing: border-box;
  font-family: inherit;
}

.geography-form-textarea:focus {
  outline: none;
  border-color: #007AFF;
}

/* 地点类型选择器 */
.geography-type-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.geography-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 60px;
  flex: 1;
  box-sizing: border-box;
}

.geography-type-btn:hover {
  background: #f2f2f7;
}

.geography-type-btn.active {
  border-color: #007AFF;
  background: rgba(0, 122, 255, 0.1);
}

.geography-type-icon {
  font-size: 20px;
}

.geography-type-btn span:last-child {
  font-size: 12px;
  color: #000000;
}

/* 复选框样式 - 遗留元素收编：作为表单的最后一项 */
.geography-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 15px;
  color: #000000;
  width: 100%;
  box-sizing: border-box;
  margin-top: 20px; /* 适当间距 */
}

.geography-form-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border: 1px solid #e5e5ea;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
}

.geography-form-checkbox input[type="checkbox"]:checked {
  background: #007AFF;
  border-color: #007AFF;
}

.geography-checkbox-checkmark {
  display: none;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .geography-edit-body {
    width: 95%;
    max-height: 90vh;
  }
  
  .geography-edit-header {
    height: 52px;
    padding: 0 12px;
    width: 100%; /* 响应式设计中也保持宽度约束 */
  }
  
  .geography-edit-content {
    padding: 16px;
  }
  
  .geography-edit-cancel,
  .geography-edit-save {
    font-size: 16px;
    padding: 6px 10px;
    min-width: 50px;
  }
  
  .geography-edit-title {
    font-size: 16px;
  }
  
  .geography-type-btn {
    min-width: 50px;
    padding: 10px 6px;
  }
}

@media (max-width: 360px) {
  .geography-edit-body {
    width: 98%;
    max-height: 95vh;
  }
  
  .geography-edit-header {
    height: 48px;
    padding: 0 8px;
    width: 100%; /* 小屏幕响应式设计中也保持宽度约束 */
  }
  
  .geography-edit-content {
    padding: 12px;
  }
  
  .geography-edit-cancel,
  .geography-edit-save {
    font-size: 15px;
    padding: 4px 8px;
    min-width: 45px;
  }
  
  .geography-edit-title {
    font-size: 15px;
  }
  
  .geography-type-btn {
    min-width: 45px;
    padding: 8px 4px;
  }
}

/* 确保没有其他异常定位覆盖 */
.geography-edit-modal * {
  position: static !important; /* 强制移除异常定位 */
}

.geography-edit-header,
.geography-edit-body,
.geography-edit-content {
  position: relative !important; /* 仅在需要时使用相对定位 */
}