@charset "utf-8";

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    max-width: 100%;
    min-width: 480px;
    overflow-x: hidden;
    font-family: Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}
/* 全局重置，清除默认边距 */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden; /* 禁止横向滚动溢出 */
}


/* 悬浮触发按钮 */
.history-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 110px;
  background: #2b6cb0;
  color: #fff;
  border-radius: 6px 0 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
}
.history-trigger span {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 13px;
}

/* 侧边抽屉容器 */
.history-drawer {
  position: fixed;
  right: -340px; /* 默认完全隐藏在右侧外面 */
  top: 80px;
  width: 320px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-right: none;
  border-radius: 8px 0 0 8px;
  box-shadow: -3px 0 12px rgba(0,0,0,0.1);
  z-index: 100;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}
/* 打开状态 */
.history-drawer.open {
  right: 0;
}

/* 抽屉头部 */
.drawer-header {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}
.drawer-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #666;
}

/* 内容区：可滚动 */
.drawer-body {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}
.empty-tip {
  text-align: center;
  color: #999;
  padding: 40px 0;
}

/* 历史列表 */
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history-list li {
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7fafc;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-list li:hover {
  background: #edf2f7;
}
.grid-id-text {
  cursor: pointer;
  color: #2b6cb0;
}
.grid-time {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.del-one {
  color: #dc2626;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

/* 底部清空按钮 */
.drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid #eee;
}
.clear-all {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.clear-all:hover {
  background: #f3f4f6;
}

/* 移动端适配：抽屉铺满底部 */
@media (max-width: 768px) {
  .history-trigger {
    bottom: 20px;
    top: auto;
    transform: none;
    height: 40px;
    width: 100px;
    right: 10px;
    border-radius: 6px;
  }
  .history-trigger span {
    writing-mode: horizontal-tb;
  }
  .history-drawer {
    width: 100%;
    right: 0;
    top: auto;
    bottom: -100%;
    max-height: 70vh;
    border-radius: 12px 12px 0 0;
  }
  .history-drawer.open {
    bottom: 0;
  }
}


/* 地图基础容器：桌面百分比，手机动态高度 */
#map_div {
    width: 90%;
    height: 800px;
    position: relative;
    background: black;
}


.hover {
    background: #007ab8;
    color: #fff;
}


form {
    border: 0;
    padding: 0;
}

table th {
    font-size: 13px;
    padding: 6px 4px;
    font-weight: bold;
}

table td {
    font-size: 13px;
    padding: 4px;
}

.display {
    text-align: center;
    width: 96%;
    margin: 0 auto;
}

.display tbody td:nth-child(2) {
    width: 18%;
    max-width: 22%;
    white-space: normal;
    word-wrap: break-word;
}

.display tbody td:nth-child(7) {
    max-width: 28%;
    white-space: normal;
    word-wrap: break-word;
}

table td a {
    color: #4c9ac9;
    cursor: pointer;
    text-decoration: none;
}

table td a:hover {
    color: #4c9889;
    text-decoration: underline;
}

.warning {
    background-color: #c7ddef;
    cursor: pointer;
}

.module {
    background: #fff;
    border-radius: 6px;
    padding: 0;
    line-height: 1.4;
    width: 100%;
    margin-top: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.mod_title {
    display: block;
    cursor: pointer;
    border: 1px solid #97b0c8;
    font-weight: bold;
    font-size: 16px;
    padding: 10px 14px;
    background: #f5f7fa;
}

.mod_title a {
    color: #14376c;
    text-decoration: none;
}

.crop-selector-container {
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
    width: 100%;
    margin: 8px 0;
}

.crop-selector-container select {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.crop-info {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.legend {
    background: #fff;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
    font-size: 12px;
    margin: 8px 0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
}

.legend-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
    border: 1px solid #c00;
}

.legend-color {
    width: 20px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
}

.legend-algin {
    width: 50px;
}

.charts-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    gap: 10px;
    padding: 0 5px;
}

.chart {
    flex: 0 0 100%;
    min-width: 280px;
    min-height: 320px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    padding: 8px;
}

/* =============================
   搜索模块
============================= */
.search-wrapper {
    background-color: #fff;
    padding-bottom: 2px;
    text-align: center;
}

.search-container {
    text-align: center;
    padding-top: 30px;
    width: 80%;
    max-width: 1000px;
    margin: 0 auto;
}

.search-label {
    padding-right: 15px;
    font-size: 20px;
    color: #333;
    font-weight: 500;
}

.search-input {
    width: 36vw;
    height: 38px;
    max-width: 600px;
    padding: 0 14px;
    border: 2px solid #2c5aa0;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    background-color: #fafbfc;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #1a4b8c;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(44, 90, 160, 0.15);
}

.search-button {
    font-size: 18px;
    max-width: 200px;
    margin-left: 8px;
    background-color: #47a;
    font-weight: bold;
    color: #fff;
    border: 0 none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 5px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.example-box {
    padding: 8px 5px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px;
}

.example-title {
    font-size: 15px;
    color: #666;
}

.example-item {
    padding-left: 8px;
    font-size: 14px;
    color: #e65555;
    cursor: pointer;
    transition: color 0.2s;
}

.example-item:hover {
    color: #c0392b;
    text-decoration: underline;
}

/* 地图加载动画 */
.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none; /* 默认隐藏 */
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}



/* =============================
   Footer
============================= */
.footer {
    width: 100%;
    background-color: #f5f7fa;
    border-top: 1px solid #dce2e8;
    padding: 20px 15px;
    margin-top: 30px;
    box-sizing: border-box;
    font-family: "Microsoft Yahei", Arial, sans-serif;
    color: #333;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.footer h4 {
    font-size: 15px;
    font-weight: bold;
    color: #14376c;
    margin: 0 0 6px;
}

.footer-contact-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 700px;
}

.footer-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-item i {
    font-size: 15px;
    color: #007bff;
}

.footer-item a {
    color: #007bff;
    text-decoration: none;
}

.footer-copyright {
    max-width: 1200px;
    margin: 12px auto 0;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    text-align: center;
    font-size: 13px;
    color: #666;
}

/* =============================
   Map
============================= */
.map-section {
    position: relative;
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    padding: 20px 0;
    box-sizing: border-box !important;
    overflow: hidden !important;
    display: block;
}

.map-section img,
.map-section svg,
.map-section canvas,
.map-section #map,
.map-section {
    display: block;
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    object-fit: contain !important;
    border: none !important;
    outline: none !important;
}

.map-container {
    height: 680px;
}

/* =============================================
   响应式合并整理（仅 600 / 768 / 992 / 1024+）
============================================= */

/* ≥600px 大屏手机 / 小平板 */
@media (min-width: 600px) {
  .chart {
    flex: 0 0 48%;
    min-height: 350px;
  }
}

/* ≥1024px PC 大屏 */
@media (min-width: 1024px) {
  .chart {
    flex: 0 0 32%;
    min-height: 380px;
  }
  .module {
    min-width: auto;
  }
  .display {
    width: 100% !important;
  }
}


/* ≤992px 平板 / 小屏电脑 */
@media (max-width: 992px) {
  .map-section {
    min-height: 500px;
    padding: 15px 0;
  }
  .map-container {
    height: 480px;
  }

  .charts-container {
    justify-content: center;
  }
  .chart {
    flex: 0 0 48%;
    min-height: 350px;
  }

  .footer-container {
    flex-direction: column;
    gap: 15px;
  }
}


/* ≤768px 手机通用 */
@media (max-width: 768px) {
  .map-section {
    min-height: 480px;
    padding: 10px;
  }
  .map-container {
      height: 460px;
      width: 100%;
  }

  table th,
  table td {
    font-size: 12px;
    padding: 3px;
  }
  .display {
    width: 100% !important;
  }
  .charts-container {
    flex-direction: column;
    align-items: center;
  }
  .chart {
    flex: 0 0 100%;
    width: 100%;
    min-height: 320px;
    margin-bottom: 10px;
  }

  .mod_title {
    font-size: 13px;
    padding: 8px 10px;
  }
  .footer {
    padding: 20px 10px;
  }
  .footer-contact-row {
    flex-direction: column;
    gap: 8px;
  }

  .header-logo {
    height: 36px;
  }
  .header-logo2 {
    height: 40px;
  }
  .header-title .en {
    font-size: 14px;
  }
  .header-title .cn {
    font-size: 13px;
  }

  .search-container {
    width: 95%;
    padding-top: 20px;
  }
  .search-label {
    display: block;
    padding-right: 0;
    margin-bottom: 10px;
    font-size: 16px;
  }
  .search-input {
    height: 34px;
    width: 90%;
    margin-bottom: 10px;
  }
  .example-title {
    font-size: 13px;
  }
  .example-item {
    padding-left: 6px;
    font-size: 12px;
  }
  .search-button {
    font-size: 16px;
  }
}

/* ≤480px 小屏手机（补充保留） */
@media (max-width: 480px) {
    #map_div{
        width: 100%;
    }
  .map-section {
    min-height: 460px;
    padding: 8px 5px;
  }
  .map-container {
    height: 440px;
  }
}

/* ========== 移动端响应式适配 新增 ========== */
/* 手机屏幕 <768px */
@media screen and (max-width:768px) {
    #map_div{
        width: 100%;
    }
    /* 1. 地图容器全屏 */
    #viewDiv {
        width:100vw !important;
        height:70vh !important;
    }
    /* 2. 侧边筛选面板折叠/宽度自适应 */
    .filter-panel {
        width:100% !important;
        position:relative !important;
        margin-bottom:10px;
    }
    /* 3. 图表容器自适应宽度 */
    #chart_month_temp,#chart_month_prec,#chart_srad_vapr {
        width:100% !important;
        height:320px !important;
    }
    /* 4. 搜索框适配手机 */
    #tdtSearchWrap {
        width:calc(100% - 40px) !important;
        top:10px !important;
        right:10px !important;
    }
    /* 5. 定位按钮样式（地图右下角悬浮） */
    #locateBtn {
        width:44px;
        height:44px;
        font-size:18px;
        right:10px;
        bottom:20px;
    }
    /* 筛选按钮缩小适配触摸 */
    .filter-btn {
        padding:6px 8px !important;
        font-size:12px;
    }
}

/* 定位按钮通用样式（地图右下角悬浮） */
#locateBtn {
    position:absolute;
    z-index:1000;
    right:20px;
    bottom:30px;
    width:48px;
    height:48px;
    border-radius:50%;
    background:#fff;
    border:1px solid #ccc;
    box-shadow:0 2px 6px rgba(0,0,0,0.2);
    cursor:pointer;
    font-size:20px;
    display:flex;
    align-items:center;
    justify-content:center;
}
#locateBtn:active {
    background:#eee;
}
#locateBtn.loading {
    color:#1890ff;
}
/* ========== 手机端媒体查询 <768px ========== */
@media screen and (max-width: 1280px) {
    #map_div{
        width: 100%;
    }
}

/* ========== 手机端媒体查询 <768px ========== */
@media screen and (max-width: 768px) {
    #map_div{
        width: 100%;
    }
    /* 地图占手机可视高度75%，不挤压下方图表 */
    #viewDiv {
        height: 75dvh !important; /* dvh适配手机地址栏动态高度 */
        min-height: 400px;
    }
    /* 搜索框适配窄屏 */
    #tdtSearchWrap {
        width: calc(100% - 20px) !important;
        right: 10px;
        top: 10px;
    }
    /* 下拉面板全屏宽度 */
    #tdtSuggestPanel {
        width: 100%;
    }
    /* 气候/土壤表格横向滚动，不挤压地图 */
    .grid-info-table {
        overflow-x: auto;
        display: block;
    }
    /* 图表容器自适应宽度 */
    #chart_month_temp,#chart_month_prec,#chart_srad_vapr {
        width: 100% !important;
        height: 300px !important;
    }
    /* 地图控件放大触摸尺寸 */
    .esri-widget--button {
        width: 44px;
        height: 44px;
    }
}

/* ========== 全屏专属类：进入全屏后给body添加fullscreen-map ========== */
body.fullscreen-map {
    overflow: hidden !important;
}
/* 全屏时隐藏所有非地图元素 */
body.fullscreen-map .filter-panel,
body.fullscreen-map .grid-info,
body.fullscreen-map .chart-box,
body.fullscreen-map table,
body.fullscreen-map h3,
body.fullscreen-map .page-header {
    display: none !important;
}
/* 全屏时地图铺满整个屏幕 */
body.fullscreen-map #viewDiv {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    background: #000;
}


/* =============================
   Header
============================= */
.logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

/* 头部基础全局样式 */
.page-header {
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #e5e6e7;
    padding: 12px 15px;
    box-sizing: border-box;
    font-family: "Microsoft Yahei", Arial, sans-serif;
}
.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.header-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
}
.header-title {
    text-align: center;
    white-space: nowrap;
}
.header-title .en {
    font-size: 19px;
    font-weight: bold;
    color: #0d4587;
    margin: 0;
}

.header-title .cn {
    font-size: 15px;
    color: #2c5aa0;
    font-weight: 500;
    letter-spacing: 1.2px;
    margin: 4px 0 0;
    padding: 2px 8px;
    border-left: 3px solid #2c5aa0;
    border-right: 3px solid #2c5aa0;
    display: inline-block;
    align-self: center;
}

/* ========== 手机适配：<768px ========== */
@media screen and (max-width: 768px) {
    .page-header {
        padding: 10px 12px;
    }
    .header-container {
        flex-direction: column;
        gap: 10px;
    }
    /* 手机隐藏左侧第一个logo */
    .header-container > .logo-link:first-child {
        display: none;
    }
    /* 手机缩小右侧logo尺寸 */
    .header-logo {
        height: 40px;
    }
    /* 标题取消强制不换行，自动换行适配窄屏 */
    .header-title {
        width: 100%;
        white-space: normal;
    }
    .header-title .en {
        font-size: 14px;
        line-height: 1.4;
    }
    .header-title .cn {
        font-size: 12px;
    }
}

/* ========== 超小屏手机 <480px 进一步压缩 ========== */
@media screen and (max-width: 480px) {
    .header-logo {
        height: 34px;
    }
    .header-title .en {
        font-size: 12px;
    }
}


/* 气候、土壤信息外层模块通用 */
.grid-info-box {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    margin-top: 16px;
}
.grid-info-box h3 {
    margin: 0 0 10px;
    font-size: 16px;
}
/* 图表容器统一自适应 */
#chart_month_temp,
#chart_month_prec,
#chart_srad_vapr {
    width: 100%;
    height: 400px;
    box-sizing: border-box;
}

/* ========== 表格核心适配：外层滚动容器，手机横向滑动，不溢出页面 ========== */
.table-scroll-wrap {
    width: 100%;
    overflow-x: auto;
    /* iOS 平滑触摸滚动 */
    -webkit-overflow-scrolling: touch;
    margin: 8px 0;
}
.table-scroll-wrap table {
    /* 表格最小宽度，防止被手机强行压缩文字 */
    min-width: 720px;
    width: max-content;
    border-collapse: collapse;
}
.table-scroll-wrap th,
.table-scroll-wrap td {
    white-space: nowrap;
    padding: 8px 10px;
    font-size: 14px;
    border: 1px solid #ddd;
    text-align: center;
}
.table-scroll-wrap th {
    background: #f5f7fa;
}

/* ========== 手机媒体查询 <768px 全局压缩 ========== */
@media screen and (max-width: 768px) {
    .grid-info-box {
        padding: 8px 10px;
        margin-top: 12px;
    }
    .grid-info-box h3 {
        font-size: 14px;
    }
    /* 图表高度手机降低，节省屏幕空间 */
    #chart_month_temp,
    #chart_month_prec,
    #chart_srad_vapr {
        height: 300px !important;
        max-width: 600px;
        min-width: 0 !important;
    }
    .table-scroll-wrap table {
        min-width: 580px; /* 小屏幕降低表格最低宽度，不再强制撑720 */
    }
    /* 表格单元格缩小字号 */
    .table-scroll-wrap th,
    .table-scroll-wrap td {
        font-size: 12px;
        padding: 6px 6px;
    }
}

/* 超小屏手机 <480px 进一步压缩 */
@media screen and (max-width: 480px) {
    #chart_month_temp,
    #chart_month_prec,
    #chart_srad_vapr {
        height: 260px !important;
        max-width: 400px;
        min-width: 0 !important;
    }
    .table-scroll-wrap table {
        min-width: 480px;
    }
}