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

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #2c3e50;
    min-height: 100vh;
}

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

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

.header h1 {
    font-size: 2.5rem;
    color: #27ae60;
    margin-bottom: 20px;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(39, 174, 96, 0.1);
}

.search-box {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

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

#cityInput:focus {
    border-color: #27ae60;
    box-shadow: 0 0 10px rgba(39, 174, 96, 0.2);
}

#searchBtn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

#searchBtn:active {
    transform: translateY(0);
}

/* 主要内容区域 */
.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.loading {
    text-align: center;
    font-size: 18px;
    color: #27ae60;
    padding: 40px;
}

.weather-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 230, 207, 0.3);
    width: 100%;
    max-width: 800px;
}

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

.location-info h2 {
    font-size: 2rem;
    color: #27ae60;
    margin-bottom: 10px;
}

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

/* 当前天气 */
.current-weather {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #a8e6cf, #dcedc8);
    border-radius: 15px;
}

.temperature-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.temperature {
    font-size: 3.5rem;
    font-weight: 300;
    color: #27ae60;
    line-height: 1;
}

.weather-desc {
    font-size: 1.2rem;
    color: #2c3e50;
    margin-top: 5px;
}

.weather-icon {
    font-size: 4rem;
    opacity: 0.8;
}

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

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(168, 230, 207, 0.1);
    border-radius: 10px;
    border-left: 4px solid #27ae60;
}

.detail-item .label {
    color: #7f8c8d;
    font-size: 14px;
}

.detail-item .value {
    color: #2c3e50;
    font-weight: 500;
    font-size: 16px;
}

/* 生活指数 */
.life-index h3 {
    color: #27ae60;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

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

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

.index-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.1);
}

.index-icon {
    font-size: 2rem;
    margin-right: 15px;
    opacity: 0.8;
}

.index-content {
    flex: 1;
}

.index-title {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 5px;
}

.index-level {
    color: #27ae60;
    font-weight: 600;
    margin-bottom: 5px;
}

.index-desc {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.4;
}

.error-message {
    text-align: center;
    padding: 40px;
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 15px;
    border: 1px solid rgba(231, 76, 60, 0.2);
}

/* 平板端适配 (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .container {
        padding: 25px;
    }
    
    .header h1 {
        font-size: 2.8rem;
    }
    
    .search-box {
        max-width: 500px;
        margin: 0 auto 20px;
    }
    
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .index-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .current-weather {
        padding: 25px;
    }
    
    .temperature {
        font-size: 4rem;
    }
}

/* 电脑端适配 (1024px+) */
@media (min-width: 1024px) {
    .container {
        padding: 40px;
    }
    
    .header h1 {
        font-size: 3.2rem;
    }
    
    .search-box {
        max-width: 600px;
        margin: 0 auto 30px;
    }
    
    .weather-card {
        padding: 40px;
    }
    
    .weather-details {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .index-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .current-weather {
        padding: 30px;
    }
    
    .temperature {
        font-size: 4.5rem;
    }
    
    .index-item {
        padding: 25px;
    }
}

/* 手机端适配 (优先优化) */
@media (max-width: 767px) {
    .container {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 2rem;
        margin-bottom: 15px;
    }
    
    .search-box {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    #cityInput {
        width: 100%;
        max-width: 300px;
        font-size: 16px;
    }
    
    #searchBtn {
        width: 100%;
        max-width: 300px;
        padding: 14px 24px;
    }
    
    .weather-card {
        padding: 20px;
        margin: 0;
    }
    
    .current-weather {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding: 20px;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .weather-icon {
        font-size: 3rem;
    }
    
    .weather-details {
        grid-template-columns: 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;
        margin-right: 10px;
    }
    
    .life-index h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    .location-info h2 {
        font-size: 1.5rem;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .weather-card {
        padding: 15px;
    }
    
    .temperature {
        font-size: 2.5rem;
    }
    
    .current-weather {
        padding: 15px;
    }
    
    .detail-item {
        padding: 10px;
        font-size: 14px;
    }
    
    .index-item {
        padding: 12px;
    }
    
    .index-desc {
        font-size: 13px;
    }
}