/* 所有元素都使用统一的尺寸计算方式 */
* {
  box-sizing: border-box;
}

/* 整个网页 */
html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;

  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    Arial,
    sans-serif;

  color: #183026;
  background: #f4f2ea;
}

/* 顶部标题栏 */
.header {
  height: 76px;
  padding: 0 26px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  background: #fbfcf8;
  border-bottom: 1px solid #dfe6dc;
}

/* 地图标题 */
.title-area h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

/* 地图副标题 */
.title-area p {
  margin: 5px 0 0;
  color: #728078;
  font-size: 12px;
}

/* 顶部作物筛选器 */
.filter-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-area label {
  font-size: 13px;
  font-weight: 600;
}

.filter-area select {
  width: 180px;
  padding: 9px 12px;

  color: #183026;
  background: white;

  border: 1px solid #ced9cd;
  border-radius: 8px;

  outline: none;
}

.filter-area select:focus {
  border-color: #3f9061;
  box-shadow: 0 0 0 3px rgba(63, 144, 97, 0.12);
}

/* 标题栏下面的内容区域 */
main {
  height: calc(100vh - 76px);
  display: flex;
}

/* 左侧信息栏 */
.sidebar {
  width: 270px;
  flex-shrink: 0;

  padding: 22px;
  overflow-y: auto;

  background: #fbfcf8;
  border-right: 1px solid #dfe6dc;
}

/* 左侧指标卡片 */
.summary-card {
  margin-bottom: 12px;
  padding: 15px;

  background: white;
  border: 1px solid #dfe6dc;
  border-radius: 10px;
}

.summary-card span {
  display: block;
  color: #728078;
  font-size: 11px;
}

.summary-card strong {
  display: inline-block;
  margin-top: 7px;

  color: #166442;
  font-size: 24px;
  font-weight: 700;
}

.summary-card small {
  margin-left: 4px;
  color: #728078;
  font-size: 11px;
}

/* 图例和说明 */
.legend-section,
.description {
  margin-top: 24px;
}

.legend-section h2,
.description h2 {
  margin: 0 0 12px;
  font-size: 13px;
}

.legend-item {
  margin-top: 8px;

  display: flex;
  align-items: center;
  gap: 8px;

  color: #637168;
  font-size: 11px;
}

.legend-item i {
  display: block;
  width: 18px;
  height: 11px;

  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 2px;
}

.no-data-color {
  background: #e8ebe5;
}

.description {
  padding-top: 18px;
  border-top: 1px solid #dfe6dc;
}

.description p {
  margin: 0;

  color: #728078;
  font-size: 11px;
  line-height: 1.7;
}

/* 地图区域 */
.map-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;

  background: #f4f2ea;
}

/* 地图必须占满整个地图区域 */
#map {
  position: absolute;
  inset: 0;
}

/* 加载提示和错误提示 */
#loading,
#error-message {
  position: absolute;
  z-index: 20;

  top: 20px;
  left: 50%;
  transform: translateX(-50%);

  padding: 10px 16px;

  background: white;
  border: 1px solid #dfe6dc;
  border-radius: 8px;

  box-shadow: 0 8px 24px rgba(24, 48, 38, 0.15);

  font-size: 12px;
}

#error-message {
  display: none;
  color: #a53b32;
}

/* 县域弹窗 */
.map-popup {
  min-width: 150px;
}

.map-popup strong,
.map-popup span,
.map-popup b {
  display: block;
}

.map-popup strong {
  font-size: 15px;
}

.map-popup span {
  margin-top: 3px;
  color: #728078;
  font-size: 10px;
}

.map-popup b {
  margin-top: 8px;
  color: #166442;
  font-size: 15px;
}

/* 调整MapLibre自带按钮 */
.maplibregl-ctrl-group {
  overflow: hidden;
  border-radius: 9px !important;
  box-shadow: 0 6px 20px rgba(24, 48, 38, 0.15) !important;
}

.maplibregl-popup-content {
  padding: 12px !important;
  border-radius: 10px !important;
}

/* 手机和平板显示 */
@media (max-width: 700px) {
  .header {
    height: 68px;
    padding: 10px 12px;
  }

  .title-area h1 {
    font-size: 16px;
  }

  .title-area p {
    display: none;
  }

  .filter-area label {
    display: none;
  }

  .filter-area select {
    width: 125px;
  }

  main {
    height: calc(100vh - 68px);
  }

  .sidebar {
    display: none;
  }
}
/* 省、市、区县级联筛选 */
.filter-group {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
  margin: 0 12px 10px 0;
  vertical-align: top;
}

.filter-group label {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.filter-group select {
  width: 100%;
  min-height: 38px;
  padding: 7px 32px 7px 10px;
  color: #1e293b;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
}

.filter-group select:hover {
  border-color: #16a34a;
}

.filter-group select:focus {
  border-color: #16a34a;
  outline: 2px solid rgba(22, 163, 74, 0.15);
}

.filter-group select:disabled {
  color: #94a3b8;
  background-color: #f1f5f9;
  cursor: not-allowed;
}

/* 窄屏时自动换行 */
@media (max-width: 768px) {
  .filter-group {
    width: calc(50% - 12px);
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .filter-group {
    width: 100%;
    margin-right: 0;
  }
}

/* ================================================
   登录页面
================================================ */

[hidden] {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 24px;

  background:
    linear-gradient(
      135deg,
      #eef7ef 0%,
      #f8faf7 50%,
      #e5f1e7 100%
    );
}

.login-card {
  width: 100%;
  max-width: 420px;

  display: flex;
  flex-direction: column;
  gap: 10px;

  padding: 36px;

  background: #ffffff;
  border: 1px solid #dce7dc;
  border-radius: 16px;

  box-shadow:
    0 20px 50px
    rgba(15, 40, 25, 0.14);
}

.login-card h1 {
  margin: 0;

  color: #173b27;
  font-size: 25px;
  text-align: center;
}

.login-description {
  margin: 0 0 14px;

  color: #647067;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.login-card label {
  margin-top: 5px;

  color: #334a3b;
  font-size: 14px;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  min-height: 44px;

  box-sizing: border-box;
  padding: 10px 12px;

  color: #1f2933;
  background: #ffffff;

  border: 1px solid #cbd8ce;
  border-radius: 7px;

  font-size: 15px;
}

.login-card input:focus {
  border-color: #16834d;
  outline: 3px solid
    rgba(22, 131, 77, 0.12);
}

#login-button {
  min-height: 44px;
  margin-top: 14px;

  color: #ffffff;
  background: #16834d;

  border: 0;
  border-radius: 7px;

  font-size: 15px;
  font-weight: 700;

  cursor: pointer;
}

#login-button:hover {
  background: #106c3e;
}

#login-button:disabled {
  background: #8eb6a0;
  cursor: wait;
}

.login-message {
  min-height: 20px;
  margin: 3px 0 0;

  color: #b42318;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.login-message.success {
  color: #167346;
}


/* ================================================
   已登录用户区域
================================================ */

.user-panel {
  display: flex;
  align-items: center;
  gap: 10px;

  padding-left: 12px;
}

#user-email {
  max-width: 220px;

  overflow: hidden;
  color: #475569;

  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#logout-button {
  min-height: 36px;
  padding: 7px 14px;

  color: #475569;
  background: #ffffff;

  border: 1px solid #cbd5e1;
  border-radius: 6px;

  cursor: pointer;
}

#logout-button:hover {
  color: #b42318;
  border-color: #e4a09a;
  background: #fff7f6;
}


/* ================================================
   登录页移动端
================================================ */

@media (max-width: 600px) {
  .login-card {
    padding: 26px 20px;
  }

  .user-panel {
    width: 100%;
    justify-content: space-between;
    padding-left: 0;
  }
}

/* 忘记密码按钮 */
.login-card .forgot-password-button {
  display: block;
  width: auto;
  margin: 10px auto 0;
  padding: 4px 8px;

  border: none;
  background: transparent;
  box-shadow: none;

  color: #2563eb;
  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.login-card .forgot-password-button:hover {
  background: transparent;
  color: #1d4ed8;
  text-decoration: underline;
}

.login-card .forgot-password-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}