/* ========== 全局重置 ========== */
* {
    box-sizing: border-box;
    user-select: none;
}

/* ========== 页面背景（浅色天空渐变） ========== */
/* 修改此处可改变整体色调：四个色值从上到下 → 左上蓝 → 中间淡蓝 → 右下暖白 → 底部米白 */
body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(170deg, #e0f0ff 0%, #f0f7ff 30%, #fff5f0 70%, #fef9f0 100%);
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* ★ 页面整体上下留白：改 padding 的上下值可控制顶部/底部间距 */
    padding: 80px 30px 50px;
    color: #3a3a4a;
    animation: pageIn 1.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
@keyframes pageIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ========== 左上角返回按钮 ========== */
/* ★ 位置：fixed 固定在左上角，修改 top/left 可移动按钮位置 */
.back-home {
    position: fixed;
    top: 20px;          /* ★ 距顶部距离 */
    left: 20px;         /* ★ 距左边距离 */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    color: #5a6a7a;
    padding: 8px 20px;  /* ★ 按钮内边距：上下8px 左右20px */
    border-radius: 30px; /* ★ 按钮圆角 */
    font-size: 14px;     /* ★ 按钮文字大小 */
    cursor: pointer;
    z-index: 1000;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.back-home:hover {
    background: #fff;
    color: #f59e0b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* ========== 页面主容器（控制整体最大宽度） ========== */
/* ★ max-width: 页面最宽不超过此值；大屏下内容不会无限拉伸 */
.weather-app {
    max-width: 1500px;   /* ★ 整体最大宽度，改大=更宽，改小=更窄 */
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;           /* ★ 各区块之间的垂直间距 */
}

/* ========== 顶部搜索栏 ========== */
/* ★ 搜索栏整体位置：margin-bottom 控制搜索栏与下方内容的间距 */
.search-container {
    position: relative;
    margin-bottom: 8px;
}
/* 搜索输入框 + 按钮的白色容器 */
.search-box {
    display: flex;
    gap: 10px;
    background: #fff;
    border-radius: 50px;  /* ★ 搜索栏圆角：50px=胶囊形，改小=变方 */
    padding: 5px 5px 5px 22px; /* ★ 搜索栏内边距 */
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s;
}
.search-box:focus-within {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
}
/* ★ 搜索输入框文字 */
.search-box input {
    flex: 1;
    background: none;
    border: none;
    color: #3a3a4a;
    font-size: 15px;     /* ★ 输入文字大小 */
    outline: none;
    padding: 10px 0;
}
.search-box input::placeholder {
    color: #b0b8c0;
}
/* ★ 搜索按钮（橙色圆形） */
.search-box button {
    width: 42px;          /* ★ 按钮宽度 */
    height: 42px;         /* ★ 按钮高度 */
    border-radius: 50%;
    border: none;
    background: #f59e0b;  /* ★ 按钮颜色 */
    color: #fff;
    font-size: 18px;      /* ★ 按钮图标大小 */
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
}
.search-box button:hover {
    background: #e08f0b;
    transform: scale(1.05);
}

/* ★ 搜索建议下拉框 */
.search-dropdown {
    position: absolute;
    top: 58px;           /* ★ 下拉框距搜索栏的距离 */
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 16px; /* ★ 下拉框圆角 */
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: none;
    z-index: 100;
}
.search-dropdown.active { display: block; }
/* ★ 每条搜索结果 */
.search-dropdown-item {
    padding: 13px 20px;   /* ★ 建议项内边距 */
    cursor: pointer;
    transition: 0.15s;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    color: #3a3a4a;
}
.search-dropdown-item:hover { background: #fff8f0; }
.search-dropdown-item .city-name { font-weight: 600; }
.search-dropdown-item .city-region {
    font-size: 13px;
    color: #a0a8b0;
    margin-left: 8px;
}

/* ========== 加载动画 & 错误提示 ========== */
.loading {
    text-align: center;
    padding: 80px 20px;   /* ★ 加载区域高度 */
    color: #8a8a9a;
}
.spinner {
    width: 38px;          /* ★ 旋转圈大小 */
    height: 38px;
    border: 3px solid #e8ecf0;
    border-top-color: #f59e0b;  /* ★ 旋转圈颜色 */
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
.error {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-radius: 16px;
    padding: 16px 20px;
    text-align: center;
    color: #cc5555;
    font-size: 15px;
}

/* ================================================================= */
/* ★★★ 核心布局：三栏并排 ★★★ */
/* ================================================================= */
/* grid-template-columns: 三栏等宽；可改为不同比例如 1.2fr 1fr 0.8fr */
/* gap: 三栏之间的间距 */
.weather-main {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.2fr;  /* ★ 三栏等宽 */
    gap: 40px;                            /* ★ 栏间距 */
    align-items: start;
}

/* ==================== 当前天气卡片（第一栏） ==================== */
/* ★ 当前天气白卡片 */
.current-weather {
    background: #fff;
    border-radius: 24px;    /* ★ 卡片圆角 */
    padding: 28px 22px;     /* ★ 卡片内边距 */
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
/* 城市名 + 更新时间那一行 */
.current-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}
.city-name {
    font-size: 25px;        /* ★ 城市名大小 */
    font-weight: 700;
    color: #2a2a3a;
    margin: 0;
}
.update-time {
    font-size: 15px;        /* ★ 更新时间文字大小 */
    color: #a0a8b0;
}

/* 温度主体区域（图标 + 温度数字 + 描述 + 最高最低） */
.current-main {
    text-align: center;
    padding: 8px 0 24px;    /* ★ 温度区上下内边距 */
    border-bottom: 1px solid #f0f2f5;  /* 分隔线 */
    margin-bottom: 20px;    /* ★ 分隔线到下方参数的间距 */
}
/* ★ 天气图标 + 温度数字同行 */
.temp-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;              /* ★ 图标与数字的间距 */
}
/* ★ 天气图标大小 */
.weather-icon-lg {
    font-size: 60px;        /* ★ 天气图标大小 */
    line-height: 1;
}
/* ★ 温度数字（最显眼的元素） */
.temperature {
    font-size: 80px;        /* ★ 温度数字大小 */
    font-weight: 800;
    line-height: 1;
    letter-spacing: -3px;
    color: #f59e0b;         /* ★ 温度数字颜色 */
}
/* 天气描述（晴/多云/阴等） */
.weather-desc {
    font-size: 25px;        /* ★ 天气描述大小 */
    font-weight: 600;
    margin-top: 2px;
    color: #5a5a6a;
}
/* ★ 最高温 / 最低温 */
.high-low {
    display: flex;
    justify-content: center;
    gap: 24px;              /* ★ 最高与最低之间的间距 */
    margin-top: 10px;       /* ★ 距上方描述的距离 */
    font-size: 21px;        /* ★ 最高最低文字大小 */
    font-weight: 600;
}
.high { color: #e8785a; }   /* ★ 最高温颜色 */
.low  { color: #5a8cc9; }   /* ★ 最低温颜色 */

/* ★ 详细参数网格（紫外线、体感、湿度、气压、空气质量） */
.current-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* ★ 3列等宽 */
    gap: 10px;              /* ★ 参数项之间的间距 */
}
/* ★ 每个参数项小卡片 */
.detail-item {
    background: #f8f9fb;    /* ★ 参数项背景色 */
    border-radius: 14px;    /* ★ 参数项圆角 */
    padding: 14px 8px;      /* ★ 参数项内边距 */
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 5px;               /* ★ 标签与数值的间距 */
    transition: 0.2s;
}
.detail-item:hover { background: #fef5ea; }
/* 如果最后一行只有一个参数项，让它占满整行 */
.detail-item:last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
.detail-label {
    font-size: 15px;        /* ★ 参数标签大小 */
    color: #9098a0;
}
.detail-value {
    font-size: 18px;        /* ★ 参数数值大小 */
    font-weight: 700;
    color: #3a3a4a;
}

/* ==================== 预报卡片 & 建议卡片（第二、三栏） ==================== */
/* ★ 预报和建议共用白色卡片样式，各自独立撑满所在列 */
.forecast-section,
.suggestions-section {
    background: #fff;
    border-radius: 24px;    /* ★ 卡片圆角 */
    padding: 24px 22px;     /* ★ 卡片内边距 */
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}
/* ★ 卡片标题（"未来7天天气预报"/"出行建议"） */
.section-title {
    font-size: 20px;        /* ★ 标题文字大小 */
    font-weight: 700;
    color: #2a2a3a;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid #fef0d8;  /* ★ 标题下划线颜色 */
}

/* ★ 预报列表 */
.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
/* ★ 每一天的预报行 */
.forecast-item {
    display: grid;
    /* ★ 四列布局：日期 | 图标 | 天气描述 | 温度 */
    grid-template-columns: 72px 44px 1fr 90px;
    align-items: center;
    padding: 10px 6px;      /* ★ 每行内边距 */
    border-radius: 12px;
    transition: 0.15s;
    gap: 4px;
}
.forecast-item:hover { background: #fef9f2; }
.forecast-date {
    font-size: 16px;        /* ★ 日期文字大小 */
    font-weight: 600;
    color: #3a3a4a;
}
.forecast-weekday {
    font-size: 13px;        /* ★ 星期文字大小 */
    color: #a0a8b0;
}
.forecast-icon {
    font-size: 28px;        /* ★ 天气图标大小 */
    text-align: center;
}
.forecast-desc {
    font-size: 15px;        /* ★ 天气描述文字大小 */
    color: #6a6a7a;
}
.forecast-temps {
    display: flex;
    gap: 10px;              /* ★ 最高与最低温度间距 */
    justify-content: flex-end;
    font-weight: 600;
    font-size: 16px;        /* ★ 温度文字大小 */
}
.forecast-temps .fh { color: #e8785a; }
.forecast-temps .fl { color: #5a8cc9; }

/* ★ 出行建议列表 */
.suggestions-content {
    display: flex;
    flex-direction: column;
    gap: 25px;              /* ★ 建议项之间的间距 */
}
/* ★ 每条建议 */
.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;              /* ★ 图标与文字的间距 */
    background: #f8f9fb;    /* ★ 建议项背景色 */
    padding: 12px 14px;     /* ★ 建议项内边距 */
    border-radius: 12px;    /* ★ 建议项圆角 */
    font-size: 17px;        /* ★ 建议文字大小 */
    line-height: 1.5;
    color: #4a4a5a;
}
.suggestion-item:hover { background: #fef5ea; }
.suggestion-icon {
    font-size: 25px;        /* ★ 建议图标大小 */
    flex-shrink: 0;
}

/* ================================================================= */
/* ========== 响应式适配：平板/小屏设备 ========== */
/* ================================================================= */
/* ★ 屏幕宽度 ≤ 780px 时：三栏变单栏 */
@media (max-width: 780px) {
    body {
        padding: 70px 14px 30px;
    }
    .weather-main {
        grid-template-columns: 1fr;  /* ★ 单栏布局 */
    }
    .temperature {
        font-size: 64px;    /* ★ 缩小温度数字 */
    }
    .weather-icon-lg {
        font-size: 48px;    /* ★ 缩小天气图标 */
    }
    .current-details {
        grid-template-columns: repeat(2, 1fr);  /* ★ 参数改为2列 */
    }
    .forecast-item {
        grid-template-columns: 65px 36px 1fr 80px;
        font-size: 12px;
        padding: 8px 4px;
    }
}

/* ★ 屏幕宽度 ≤ 400px 时：手机小屏进一步缩小 */
@media (max-width: 400px) {
    body {
        padding: 65px 8px 20px;
    }
    .current-weather {
        padding: 20px 16px;
        border-radius: 20px;
    }
    .temperature {
        font-size: 50px;
    }
    .current-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .forecast-item {
        grid-template-columns: 55px 30px 1fr 70px;
        gap: 2px;
        padding: 8px 2px;
    }
    .forecast-temps {
        gap: 4px;
    }
}