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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #2d5a3d;
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 10px;
}

/* 搜索区域 */
.search-section {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

#cityInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #a8d5ba;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#cityInput:focus {
    border-color: #6bb77b;
    box-shadow: 0 0 10px rgba(107, 183, 123, 0.3);
}

#searchBtn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #6bb77b, #5a9f6a);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#searchBtn:hover {
    background: linear-gradient(135deg, #5a9f6a, #4a8759);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 183, 123, 0.4);
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e8f5e8;
    border-top: 4px solid #6bb77b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 天气容器 */
.weather-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 213, 186, 0.3);
}

/* 位置信息 */
.location-info {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e8f5e8;
}

.location-info h2 {
    color: #2d5a3d;
    font-size: 2rem;
    margin-bottom: 5px;
}

.location-info p {
    color: #666;
    font-size: 14px;
}

/* 当前天气 */
.current-weather {
    margin-bottom: 30px;
}

.weather-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.temperature {
    font-size: 4rem;
    font-weight: 300;
    color: #2d5a3d;
}

.unit {
    font-size: 2rem;
    color: #6bb77b;
}

.weather-desc p:first-child {
    font-size: 1.5rem;
    color: #2d5a3d;
    margin-bottom: 5px;
}

.weather-desc p:last-child {
    color: #666;
    font-size: 14px;
}

/* 天气详情 */
.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.detail-item {
    background: rgba(168, 213, 186, 0.1);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(168, 213, 186, 0.2);
}

.detail-item .label {
    display: block;
    color: #666;
    font-size: 12px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-item span:last-child {
    color: #2d5a3d;
    font-weight: 600;
    font-size: 16px;
}

/* 生活指数 */
.life-index {
    margin-top: 30px;
}

.life-index h3 {
    color: #2d5a3d;
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

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

.index-item {
    display: flex;
    align-items: center;
    background: rgba(168, 213, 186, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(168, 213, 186, 0.2);
    transition: all 0.3s ease;
}

.index-item:hover {
    background: rgba(168, 213, 186, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 213, 186, 0.2);
}

.index-icon {
    font-size: 2rem;
    margin-right: 15px;
    width: 50px;
    text-align: center;
}

.index-content h4 {
    color: #2d5a3d;
    font-size: 16px;
    margin-bottom: 5px;
}

.index-content p {
    color: #6bb77b;
    font-weight: 600;
    margin-bottom: 3px;
}

.index-content span {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

/* 更新时间 */
.update-time {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e8f5e8;
    color: #666;
    font-size: 14px;
}

/* 错误信息 */
.error-message {
    text-align: center;
    padding: 40px;
    background: rgba(255, 107, 107, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(255, 107, 107, 0.2);
    color: #d63031;
}

/* 平板端适配 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 25px;
    }
    
    .header h1 {
        font-size: 2.2rem;
    }
    
    .temperature {
        font-size: 3.5rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .index-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 电脑端适配 (1024px+) */
@media (min-width: 1024px) {
    .container {
        padding: 40px;
    }
    
    .weather-container {
        padding: 40px;
    }
    
    .weather-main {
        justify-content: space-around;
    }
    
    .weather-details {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .index-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .search-box {
        max-width: 600px;
    }
}

/* 手机端适配 (768px以下) */
@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
        gap: 15px;
    }
    
    #searchBtn {
        padding: 14px 24px;
    }
    
    .weather-container {
        padding: 20px;
        margin: 0 -5px;
    }
    
    .weather-main {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .detail-item {
        padding: 12px;
    }
    
    .index-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .index-item {
        padding: 15px;
    }
    
    .index-icon {
        font-size: 1.5rem;
        width: 40px;
        margin-right: 12px;
    }
}

/* 超小屏幕适配 (480px以下) */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .weather-container {
        padding: 15px;
        border-radius: 15px;
    }
    
    .temperature {
        font-size: 2.5rem;
    }
    
    .weather-details {
        grid-template-columns: 1fr;
    }
    
    .detail-item {
        padding: 10px;
    }
}