/**
 * tianqi.tv 天气网站样式
 * 现代简约风格，响应式设计
 */

/* 基础变量 */
:root {
    --primary-color: #4a90d9;
    --secondary-color: #67b8de;
    --accent-color: #ff9f43;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --bg-light: rgba(255, 255, 255, 0.95);
    --bg-card: rgba(255, 255, 255, 0.85);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --radius: 20px;
    --transition: all 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 动态背景 */
.weather-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: background 1s ease;
}

.weather-bg.sunny {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd89b 100%);
}

.weather-bg.cloudy {
    background: linear-gradient(135deg, #89c4f4 0%, #8e9eab 100%);
}

.weather-bg.rainy {
    background: linear-gradient(135deg, #4b6cb7 0%, #182848 100%);
}

.weather-bg.snowy {
    background: linear-gradient(135deg, #e6e9f0 0%, #eef1f5 100%);
}

.weather-bg.night {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
}

/* 容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 2rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    width: 250px;
    box-shadow: var(--shadow);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    transform: scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-box button {
    padding: 12px 25px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: #e68a2e;
    transform: translateY(-2px);
}

.current-time {
    color: white;
    font-size: 1.1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 主内容 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

/* 卡片基础样式 */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.card h2 {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

/* 当前天气 */
.current-weather {
    grid-column: span 2;
}

.location {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.location h1 {
    font-size: 2rem;
    font-weight: 500;
}

.update-time {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 25px;
}

.temp-display {
    display: flex;
    align-items: flex-start;
}

.temp {
    font-size: 5rem;
    font-weight: 300;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.temp-unit {
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.weather-icon img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.weather-desc .condition {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.weather-desc .feels-like {
    color: var(--text-secondary);
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
}

.detail-item .label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.detail-item .value {
    font-size: 1.2rem;
    font-weight: 500;
}

.sun-times {
    display: flex;
    justify-content: center;
    gap: 50px;
    margin-bottom: 15px;
}

.sun-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.sun-icon {
    font-size: 1.5rem;
}

.sun-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sun-time {
    font-size: 1.1rem;
    font-weight: 500;
}

.weather-tips {
    text-align: center;
    padding: 15px;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.1), rgba(255, 159, 67, 0.1));
    border-radius: 10px;
    color: var(--text-secondary);
    font-style: italic;
}

/* 空气质量 */
.air-quality {
    text-align: center;
}

.aqi-display {
    margin-bottom: 20px;
}

.aqi-circle {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #52c41a, #73d13d);
    color: white;
    box-shadow: 0 8px 25px rgba(82, 196, 26, 0.3);
}

.aqi-circle.level-1 { background: linear-gradient(135deg, #52c41a, #73d13d); }
.aqi-circle.level-2 { background: linear-gradient(135deg, #95de64, #b7eb8f); }
.aqi-circle.level-3 { background: linear-gradient(135deg, #faad14, #ffc53d); }
.aqi-circle.level-4 { background: linear-gradient(135deg, #fa8c16, #ffa940); }
.aqi-circle.level-5 { background: linear-gradient(135deg, #f5222d, #ff4d4f); }
.aqi-circle.level-6 { background: linear-gradient(135deg, #780650, #a61d42); }

.aqi-value {
    font-size: 2.5rem;
    font-weight: 700;
}

.aqi-level {
    font-size: 1rem;
}

.aqi-rank {
    color: var(--text-secondary);
}

.aqi-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.aqi-item {
    padding: 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
}

.aqi-item .name {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.aqi-item .val {
    font-size: 1.1rem;
    font-weight: 500;
}

/* 24小时预报 */
.hourly-forecast {
    grid-column: span 2;
}

.hourly-scroll {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 0;
    scrollbar-width: thin;
}

.hourly-scroll::-webkit-scrollbar {
    height: 6px;
}

.hourly-scroll::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 3px;
}

.hourly-item {
    flex: 0 0 80px;
    text-align: center;
    padding: 15px 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 15px;
    transition: var(--transition);
}

.hourly-item:hover {
    background: rgba(74, 144, 217, 0.1);
}

.hourly-item .time {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.hourly-item .icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}

.hourly-item .temp {
    font-size: 1.1rem;
    font-weight: 500;
}

/* 15天预报 */
.daily-forecast {
    grid-column: span 2;
}

.forecast-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forecast-item {
    display: grid;
    grid-template-columns: 100px 1fr 1fr 80px 80px;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    transition: var(--transition);
}

.forecast-item:hover {
    background: rgba(74, 144, 217, 0.08);
}

.forecast-item .date {
    font-weight: 500;
}

.forecast-item .date small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.forecast-item .day-condition,
.forecast-item .night-condition {
    display: flex;
    align-items: center;
    gap: 8px;
}

.forecast-item .condition-icon {
    font-size: 1.5rem;
}

.forecast-item .temp-range {
    text-align: center;
}

.forecast-item .temp-high {
    font-weight: 500;
    color: #e74c3c;
}

.forecast-item .temp-low {
    color: var(--text-secondary);
}

.forecast-item .wind {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* 生活指数 */
.life-index {
    grid-column: span 2;
}

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

.index-item {
    padding: 20px;
    background: linear-gradient(135deg, rgba(74, 144, 217, 0.05), rgba(103, 184, 222, 0.05));
    border-radius: 15px;
    text-align: center;
    transition: var(--transition);
}

.index-item:hover {
    transform: scale(1.02);
}

.index-item .index-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.index-item .index-status {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.index-item .index-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* 天气预警 */
.weather-alert {
    grid-column: span 2;
    border-left: 4px solid #f5222d;
}

.alert-item {
    padding: 15px;
    background: rgba(245, 34, 45, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-title {
    font-weight: 500;
    color: #f5222d;
    margin-bottom: 8px;
}

.alert-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px 0;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.footer a {
    color: white;
    text-decoration: none;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .current-weather,
    .hourly-forecast,
    .daily-forecast,
    .life-index,
    .weather-alert {
        grid-column: span 1;
    }
    
    .weather-main {
        flex-direction: column;
        text-align: center;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-item {
        grid-template-columns: 80px 1fr 80px;
    }
    
    .forecast-item .night-condition,
    .forecast-item .wind {
        display: none;
    }
}

@media (max-width: 600px) {
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .temp {
        font-size: 4rem;
    }
    
    .weather-icon img {
        width: 80px;
        height: 80px;
    }
    
    .sun-times {
        gap: 30px;
    }
    
    .aqi-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 加载动画 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 淡入动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: fadeIn 0.5s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
