/* ============================================================
   天气预报网站样式文件
   风格：清新自然风格（方案3）
   ============================================================ */

/* ============================================================
   全局样式
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, #e8f5e9 0%, #f1f8e9 100%);
    min-height: 100vh;
    color: #2e7d32;
    line-height: 1.6;
}

/* ============================================================
   顶部导航栏
   ============================================================ */
.top-bar {
    background: linear-gradient(135deg, #00897b 0%, #43a047 100%);
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 137, 123, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar .logo-icon {
    font-size: 28px;
}

.top-bar .logo-text h1 {
    margin: 0;
    color: white;
    font-size: 22px;
    font-weight: 600;
}

.top-bar .logo-text p {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
}

.top-bar .city-info {
    text-align: right;
    color: white;
}

.top-bar .city-name {
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: background 0.3s;
}

.top-bar .city-name:hover {
    background: rgba(255, 255, 255, 0.2);
}

.top-bar .update-time {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

/* ============================================================
   IP定位提示条
   ============================================================ */
.location-tip {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    border-bottom: 1px solid #a5d6a7;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   主内容区
   ============================================================ */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px;
}

/* ============================================================
   当前天气卡片
   ============================================================ */
.current-weather-card {
    background: white;
    border-radius: 28px;
    padding: 35px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 25px;
}

.current-weather-main {
    text-align: center;
}

.current-weather-icon {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, #fff9c4 0%, #fff59d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 8px 32px rgba(255, 245, 157, 0.5);
}

.current-weather-icon span {
    font-size: 72px;
}

.current-temp {
    font-size: 52px;
    font-weight: bold;
    color: #2e7d32;
    margin-top: 20px;
}

.current-desc {
    color: #66bb6a;
    font-size: 20px;
    margin-top: 8px;
}

.current-feels-like {
    font-size: 14px;
    color: #9e9e9e;
    margin-top: 5px;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.weather-detail-item {
    padding: 20px 28px;
    border-radius: 20px;
    min-width: 150px;
}

.weather-detail-item.temp-range {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
}

.weather-detail-item.humidity {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}

.weather-detail-item.wind {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
}

.weather-detail-item.aqi {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
}

.weather-detail-label {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.8;
}

.weather-detail-item.temp-range .weather-detail-label { color: #66bb6a; }
.weather-detail-item.humidity .weather-detail-label { color: #42a5f5; }
.weather-detail-item.wind .weather-detail-label { color: #ab47bc; }
.weather-detail-item.aqi .weather-detail-label { color: #ff9800; }

.weather-detail-value {
    font-size: 24px;
    font-weight: bold;
    margin-top: 8px;
}

.weather-detail-item.temp-range .weather-detail-value { color: #2e7d32; }
.weather-detail-item.humidity .weather-detail-value { color: #1976d2; }
.weather-detail-item.wind .weather-detail-value { color: #7b1fa2; }
.weather-detail-item.aqi .weather-detail-value { color: #f57c00; }

/* ============================================================
   时间周期选择器
   ============================================================ */
.period-selector {
    background: white;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    margin-bottom: 25px;
}

.period-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.period-btn {
    padding: 14px 36px;
    background: #f5f5f5;
    color: #616161;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.period-btn:hover {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

.period-btn.active {
    background: linear-gradient(135deg, #00897b 0%, #43a047 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(0, 137, 123, 0.35);
}

/* ============================================================
   天气预报区域
   ============================================================ */
.forecast-section {
    margin-bottom: 25px;
}

.section-title {
    color: #2e7d32;
    font-size: 20px;
    margin-bottom: 18px;
    padding-left: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 15px;
}

.forecast-card {
    background: white;
    border-radius: 22px;
    padding: 22px 18px;
    text-align: center;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    border: 2px solid #e8f5e9;
    transition: transform 0.3s, box-shadow 0.3s;
}

.forecast-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.forecast-card .day-name {
    color: #66bb6a;
    font-size: 14px;
    font-weight: 500;
}

.forecast-card .day-date {
    font-size: 11px;
    color: #9e9e9e;
}

.forecast-card .weather-icon-wrap {
    width: 60px;
    height: 60px;
    background: #fff9c4;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px auto;
}

.forecast-card .weather-icon-wrap span {
    font-size: 36px;
}

.forecast-card .temp-max {
    color: #2e7d32;
    font-size: 28px;
    font-weight: bold;
}

.forecast-card .temp-min {
    color: #a5d6a7;
    font-size: 15px;
}

.forecast-card .weather-desc {
    color: #66bb6a;
    font-size: 13px;
    margin-top: 8px;
    background: #f1f8e9;
    padding: 4px 12px;
    border-radius: 12px;
    display: inline-block;
}

.forecast-card .weather-wind {
    color: #90a4ae;
    font-size: 12px;
    margin-top: 6px;
}
}

/* ============================================================
   历史天气区域
   ============================================================ */
.history-section {
    margin-bottom: 30px;
}

.history-card {
    background: white;
    border-radius: 24px;
    padding: 25px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.history-item {
    background: linear-gradient(135deg, #f1f8e9 0%, #dcedc8 100%);
    padding: 22px;
    border-radius: 18px;
    border-left: 4px solid #7cb342;
    transition: transform 0.3s;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-item .history-date {
    color: #689f38;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
}

.history-item .history-content {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.history-item .history-icon {
    font-size: 32px;
}

.history-item .history-temp {
    color: #33691e;
    font-size: 22px;
    font-weight: bold;
}

.history-item .history-desc {
    color: #689f38;
    font-size: 13px;
    margin-top: 3px;
}

/* ============================================================
   城市选择弹窗
   ============================================================ */
.city-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.city-modal-overlay.active {
    display: flex;
}

.city-modal {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.city-modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e8f5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.city-modal-header h3 {
    color: #2e7d32;
    font-size: 18px;
    margin: 0;
}

.city-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 18px;
    color: #616161;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.city-modal-close:hover {
    background: #e0e0e0;
}

.city-search {
    padding: 15px 25px;
    border-bottom: 1px solid #e8f5e9;
}

.city-search-input {
    width: 100%;
    padding: 12px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.3s;
}

.city-search-input:focus {
    border-color: #66bb6a;
}

.city-modal-body {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.hot-cities {
    margin-bottom: 20px;
}

.hot-cities-title {
    color: #9e9e9e;
    font-size: 13px;
    margin-bottom: 12px;
}

.hot-cities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hot-city-btn {
    padding: 8px 18px;
    background: #f1f8e9;
    border: 1px solid #c8e6c9;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    color: #2e7d32;
    transition: all 0.3s;
}

.hot-city-btn:hover {
    background: #c8e6c9;
}

.provinces-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.province-btn {
    padding: 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #616161;
    text-align: center;
    transition: all 0.3s;
}

.province-btn:hover {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #2e7d32;
}

/* ============================================================
   加载状态
   ============================================================ */
.loading {
    text-align: center;
    padding: 40px;
    color: #9e9e9e;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8f5e9;
    border-top-color: #66bb6a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   空数据状态
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9e9e9e;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.empty-state-text {
    font-size: 16px;
}

/* ============================================================
   页脚
   ============================================================ */
.footer {
    text-align: center;
    padding: 20px;
    color: #9e9e9e;
    font-size: 13px;
}

/* ============================================================
   响应式设计
   ============================================================ */
@media (max-width: 768px) {
    .top-bar {
        padding: 12px 15px;
    }
    
    .top-bar .logo-text h1 {
        font-size: 18px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .current-weather-card {
        padding: 25px 20px;
    }
    
    .current-weather-icon {
        width: 100px;
        height: 100px;
    }
    
    .current-weather-icon span {
        font-size: 52px;
    }
    
    .current-temp {
        font-size: 40px;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .weather-detail-item {
        padding: 15px 20px;
    }
    
    .period-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .forecast-grid {
        grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
        gap: 10px;
    }
    
    .forecast-card {
        padding: 15px 12px;
    }
    
    .forecast-card .temp-max {
        font-size: 22px;
    }
    
    .history-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .forecast-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .period-buttons {
        gap: 8px;
    }
    
    .period-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}
