/* 全局布局 */
html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
/* 顶部导航栏 */
/* 确保 `header` 的层级比 `sidebar` 高 */
header {
      background-color: #2c3e50;
      color: white;
      padding: 10px 20px;
      font-size: 18px;
      display: flex;
      justify-content: space-between;
      align-items: center;
    z-index: 2000; /*确保 `header` 在 `sidebar` 之上 */
}

/* 左侧菜单按钮（☰） */
#menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}
/* 主内容容器（地图 + 侧边栏） */
#main-container {
    display: flex;
    width: 100%;
    height: calc(100vh - 50px); /* 让内容填充整个屏幕，顶部留给导航栏 */
    margin-top: 50px;
}
/* 侧边栏（默认隐藏） */
#sidebar-container {
    position: fixed;
    left: -250px; /* 默认隐藏在屏幕外 */
    top: 50px;
    width: 250px;
    height: calc(100vh - 50px);
    background: white;
    box-shadow: 2px 0px 5px rgba(0, 0, 0, 0.2);
    transition: left 0.3s ease-in-out;
    z-index: 1500;
}
/* 侧边栏展开状态 */
#sidebar-container.active {
    left: 0; /* 显示侧边栏 */
}
/* 侧边栏内容 */
#sidebar {
    padding: 15px;
}
/* 关闭按钮 */
#close-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    float: right;
}
/* 数据选项列表 */
#data-layer-list {
    list-style: none;
    padding: 0;
}
#data-layer-list li {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    padding: 5px 10px;
}

/* 右侧地图（占据整个剩余空间） */
#map-container {
    flex-grow: 1;
    height: calc(100vh - 50px);
}

/* 让地图铺满 */
#map {
    width: 100%;
    height: 100%;
}

/* 让地图缩放控件（+ 和 - 按钮）固定在右下角 */
.leaflet-control-zoom {
    position: absolute !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 1000 !important;
    display: block !important; /* ✅ 确保控件可见 */
}

#search-container {
    position: absolute;
    top: 70px; /* ✅ 原来是 10px，调整到 60px 以避免被 `header` 遮挡 */
    left: 30%;
    transform: translateX(-50%);
    z-index: 3000; /* ✅ 提高 `z-index`，确保搜索框在 header 之上 */
    background: white;
    padding: 8px;
    border-radius: 5px;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);
    display: flex; /* ✅ 确保它是可见的 */
    gap: 5px;
}

#search-box {
    width: 250px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
}
#search-button {
    padding: 5px 10px;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 3px;
}
#search-button:hover {
    background-color: #0056b3;
}
#info-panel {
    position: absolute;
    right: 0;
    top: 50px; /* 留出导航栏高度 */
    width: 300px;
    height: calc(100vh - 50px); /*避开顶部 header */
    z-index: 1500; 
     background-color: rgba(255, 255, 255, 0.75); /* 半透明白色 */
    border-left: 1px solid #ccc;
    padding: 20px;
    display: none; /* 默认隐藏 */
    overflow-y: auto; /* 若内容多可滚动 */
    backdrop-filter: blur(4px); /* 添加模糊效果*/
}
#info-panel.visible {
    display: block;
}
#info-panel .close-button {
    position: absolute;
    top: 15px;         /* 往下移一点 */
    right: 15px;       /* 右边留白 */
    z-index: 2000;
    background: none;  /* 去除背景 */
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: #000;       /* 字体颜色深一点以便看清 */
    cursor: pointer;
    padding: 0;
}
.btn-history {
    margin-top: 15px;
    padding: 8px 15px;
    background: #0077cc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
  }
  
#history-modal {
  position: absolute;
  top: 50px; /* 离开导航栏 */
  right: -600px; /* 默认隐藏在视窗右侧 */
  height: calc(100vh - 50px); /* 避让导航栏高度 */
  width: 500px;
  z-index: 1300;
  background: transparent;
  overflow-y: auto;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1); /* 移动动画 */
}
 
#history-modal.active {
  right: 300px; /* 显示时移动到与侧边栏对齐 */
}
 
#history-modal .modal-content {
  height: auto;
  max-height: calc(100vh - 60px);
  width: 100%;
  background: #fff;
  border-radius: 10px 0 0 10px;
  box-shadow: -4px 0 24px rgba(0,0,0,0.18);
  padding: 24px;
  box-sizing: border-box;
}

#history-modal .charts-vertical {
    display: flex; /* 修复拼写错误：felx -> flex */
    flex-direction: column;
    align-items: center;
    gap: 50px; /* 增加图表之间的间隔 */
    height: calc(100vh - 120px);
    padding: 30px 20px; /* 增加上下内边距 */
    box-sizing: border-box;
    overflow-y: auto;
  }
  
  #history-modal canvas {
    height: 16vh !important; /* 减小高度，为间隔留出更多空间 */
    width: 95% !important; /* 增加宽度，减少左侧空白 */
    max-width: 650px;
    background: #f8f8f8;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin: 0 auto;
    padding: 10px; /* 为图表添加内边距 */
    image-rendering: -webkit-optimize-contrast; /* 提高清晰度 */
    image-rendering: crisp-edges; /* 提高清晰度 */
  }
  
    {
      box-sizing: border-box;
      font-family: 'Roboto', sans-serif;
    }
    body {
      margin: 0;
      background-color: #f0f2f5;
    }
    .dashboard {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 15px;
      padding: 20px;
    }
    .widget {
      background-color: white;
      padding: 15px;
      border-radius: 10px;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .widget h3 {
      margin-top: 0;
      margin-bottom: 10px;
      font-size: 16px;
      color: #2c3e50;
    }
    .small-text {
      font-size: 14px;
      color: #666;
    }