/* === 全局重置：清掉浏览器默认间距 === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === 整个页面的底色和字体 === */
body {
  font-family: -apple-system, "Microsoft YaHei", sans-serif;
  background: #f5f7fa;   /* 浅灰背景 */
  color: #333;
  padding: 20px;
}

/* === 中间内容区，最大宽度 900px，居中 === */
.container {
  max-width: 900px;
  margin: 0 auto;        /* 左右 auto = 居中 */
}

/* === 大标题 === */
h1 {
  text-align: center;
  margin: 20px 0 30px;
  font-size: 32px;
}

h2 {
  font-size: 20px;
  margin: 30px 0 15px;
  color: #555;
}

/* === 搜索栏：横向排列（输入框和按钮并排） === */
.search-bar {
  display: flex;         /* flex = 横向排列 */
  gap: 10px;             /* 元素之间留 10px 间隙 */
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;               /* 输入框占满剩余空间 */
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 8px;    /* 圆角 */
  outline: none;
}

.search-bar input:focus {        /* 输入框被选中时的样子 */
  border-color: #4a90d9;
}

.search-bar button {
  padding: 12px 24px;
  font-size: 16px;
  background: #9b59b6;   /* 紫色按钮 */
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;       /* 鼠标移上去变手指 */
}

.search-bar button:hover {       /* 鼠标悬停时 */
  background: #7d3c98;   /* 变深一点（深紫） */
}

.search-bar button:disabled {    /* 按钮被禁用时（查询中） */
  background: #aaa;
  cursor: not-allowed;
}

/* === 城市卡片网格：自动排成几列 === */
#city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 15px;
}

/* === 单张卡片的样子 === */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);  /* 淡淡的阴影 */
}

.card .emoji {           /* 卡片里的天气图标 */
  font-size: 40px;
  margin: 8px 0;
}

.card .temp {            /* 温度数字 */
  font-size: 32px;
  font-weight: bold;
  color: #222;
}

.card .name {            /* 城市名 */
  font-size: 16px;
  color: #666;
  margin-bottom: 4px;
}

.card .text {            /* 天气描述 */
  font-size: 14px;
  color: #888;
}

/* === 详细信息行（体感/湿度/风力）=== */
.detail {
  font-size: 12px;
  color: #999;
  margin-top: 10px;
}

/* === 未来5天预报 === */
.forecast {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #eee;
}

.forecast-day {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #666;
  padding: 5px 0;
}

.fd-date { width: 50px; text-align: left; }
.fd-icon { font-size: 18px; }
.fd-temp { color: #888; }

/* 卡片底部小提示 */
.hint {
  font-size: 11px;
  color: #bbb;
  margin-top: 10px;
}

/* 卡片可点击：鼠标变手指 + 悬停上浮 */
.card {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

/* === 逐小时天气弹窗 === */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}
.modal.show {
  display: flex;
}
.modal-content {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 80%;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.modal-header h3 {
  font-size: 18px;
  color: #333;
}
#modal-close {
  background: none;
  border: none;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: #999;
}
#modal-close:hover {
  color: #333;
}

/* 逐小时列表（横向滚动）*/
.hourly-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.hourly-item {
  flex: 0 0 auto;
  text-align: center;
  padding: 12px 10px;
  background: #f5f7fa;
  border-radius: 10px;
  min-width: 64px;
}
.hourly-time { font-size: 12px; color: #888; white-space: nowrap; }
.hourly-icon { font-size: 24px; margin: 6px 0; }
.hourly-temp { font-weight: bold; color: #333; }
.hourly-feels { font-size: 11px; color: #9b59b6; margin-top: 2px; }
.hourly-pop { font-size: 11px; color: #4a90d9; margin-top: 4px; }

/* 逐小时分组（今天/明天）*/
.hourly-group { margin-bottom: 22px; }
.hourly-group-title {
  font-size: 14px;
  font-weight: bold;
  color: #555;
  margin-bottom: 10px;
  padding-left: 10px;
  border-left: 3px solid #9b59b6;
}

/* 弹窗内小字说明 */
.message-small {
  font-size: 12px;
  color: #999;
  text-align: center;
  margin-bottom: 12px;
}

/* === 底部数据来源备注 === */
.footer {
  text-align: center;
  font-size: 12px;
  color: #aaa;
  margin-top: 40px;
  padding: 24px 0 10px;
  border-top: 1px solid #eee;
}
.footer a {
  color: #888;
  text-decoration: none;
}
.footer a:hover {
  color: #9b59b6;
  text-decoration: underline;
}
.footer-sub {
  color: #bbb;
  font-size: 11px;
}

/* === 顶部导航 tab === */
.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
}
.tab {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
  background: #fff;
  color: #666;
  border: 1px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab.active {
  background: #9b59b6;
  color: #fff;
  border-color: #9b59b6;
}

/* === 地图页 === */
.map-hint {
  text-align: center;
  color: #888;
  margin-bottom: 12px;
  font-size: 14px;
}
#map {
  height: 500px;
  width: 100%;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* === 搜索结果的大卡片，内边距更大 === */
#search-result .card {
  padding: 30px;
}

/* === 提示文字（加载中/找不到等） === */
.message {
  text-align: center;
  color: #888;
  padding: 20px;
}

/* === 搜索同名候选项（可点击的列表） === */
.city-option {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 8px 0;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.city-option:hover {
  background: #f5eeff;
  border-color: #9b59b6;
}
