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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, '微软雅黑';
    background: #f0f2f5;
    min-height: 100vh;
    padding: 20px;
    color: #050505;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 标题 */
header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e6eb;
}

header h1 {
    font-size: 2em;
    color: #1877f2;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.subtitle {
    color: #65676b;
    font-size: 0.95em;
    font-weight: 400;
}

/* 使用说明 */
.instructions {
    background: #f0f2f5;
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.instructions h3 {
    color: #1877f2;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 600;
}

.instructions ul {
    list-style-position: inside;
    line-height: 1.6;
    color: #65676b;
    font-size: 0.9em;
}

.api-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 12px;
    margin-top: 12px;
    border-radius: 6px;
    font-size: 0.9em;
    color: #856404;
}

.api-notice a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 600;
}

.api-notice a:hover {
    text-decoration: underline;
}

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

.search-box {
    display: flex;
    gap: 8px;
    max-width: 600px;
    margin: 0 auto;
}

#cityInput {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    outline: none;
    transition: all 0.2s;
    background: #f0f2f5;
    color: #050505;
}

#cityInput:focus {
    background: #ffffff;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.1);
}

#cityInput::placeholder {
    color: #8a8d91;
}

#searchBtn {
    padding: 10px 20px;
    background: #1877f2;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

#searchBtn:hover {
    background: #166fe5;
}

#searchBtn:active {
    background: #1564d6;
    transform: scale(0.98);
}

.btn-icon {
    font-size: 1.1em;
}

/* 热门城市一行样式 */
.hot-cities-inline {
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    color: #65676b;
    font-size: 13px;
}

.hot-label {
    color: #1877f2;
    font-weight: 600;
    margin-right: 8px;
}

.hot-cities-inline a {
    color: #1877f2;
    text-decoration: none;
    margin: 0 6px;
    transition: all 0.2s;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.hot-cities-inline a:hover {
    background: #e7f3ff;
}

/* 加载和错误提示 */
.loading {
    text-align: center;
    padding: 32px;
    color: #1877f2;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e4e6eb;
    border-top: 3px solid #1877f2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.error {
    background: #ffebe9;
    border: 1px solid #f02849;
    color: #c41c00;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 0.9em;
}

/* 当前天气 */
.current-weather {
    margin-bottom: 24px;
    background: linear-gradient(135deg, #1877f2 0%, #42a5f5 100%);
    color: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.weather-header {
    text-align: center;
    margin-bottom: 20px;
}

.weather-header h2 {
    font-size: 1.6em;
    margin-bottom: 4px;
    font-weight: 600;
}

.weather-header p {
    opacity: 0.9;
    font-size: 0.85em;
}

.weather-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.temperature-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

#weatherIcon {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.temp-info {
    text-align: center;
}

.temp-current {
    font-size: 3.5em;
    font-weight: 300;
    line-height: 1;
}

.temp-desc {
    font-size: 1.3em;
    margin-top: 8px;
    opacity: 0.95;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.detail-label {
    display: block;
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 6px;
}

.detail-value {
    display: block;
    font-size: 1.2em;
    font-weight: 600;
}

/* 7天预报 */
.forecast-section {
    margin-bottom: 24px;
}

.forecast-section h3 {
    color: #1877f2;
    margin-bottom: 16px;
    text-align: center;
    font-size: 1.4em;
    font-weight: 600;
}

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

.forecast-day {
    background: #f0f2f5;
    border: 1px solid #e4e6eb;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    transition: all 0.2s;
}

.forecast-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #1877f2;
    background: #ffffff;
}

.forecast-date {
    font-weight: 600;
    color: #1877f2;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.forecast-weekday {
    color: #65676b;
    font-size: 0.8em;
    margin-bottom: 8px;
}

.forecast-icon {
    width: 50px;
    height: 50px;
    margin: 8px auto;
}

.forecast-temp {
    font-size: 1.2em;
    font-weight: 600;
    color: #050505;
    margin: 8px 0;
}

.forecast-desc {
    color: #65676b;
    font-size: 0.85em;
    margin-bottom: 8px;
}

.forecast-details {
    display: flex;
    justify-content: space-around;
    font-size: 0.8em;
    color: #65676b;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e4e6eb;
}

/* 页脚 */
footer {
    text-align: center;
    padding-top: 16px;
    margin-top: 24px;
    border-top: 1px solid #e4e6eb;
    color: #65676b;
    font-size: 0.85em;
}

footer a {
    color: #1877f2;
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

footer p {
    margin: 4px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 16px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .search-box {
        flex-direction: column;
    }

    .hot-cities-inline {
        font-size: 12px;
    }

    .hot-cities-inline a {
        margin: 0 4px;
        padding: 3px 6px;
    }

    .temperature-section {
        flex-direction: column;
        gap: 12px;
    }

    #weatherIcon {
        width: 80px;
        height: 80px;
    }

    .temp-current {
        font-size: 2.8em;
    }

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

    .forecast-container {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    header h1 {
        font-size: 1.4em;
    }

    .subtitle {
        font-size: 0.85em;
    }

    .hot-cities-inline {
        font-size: 11px;
    }

    .hot-cities-inline a {
        display: inline-block;
        margin: 2px 3px;
    }

    .forecast-container {
        grid-template-columns: 1fr;
    }

    .current-weather {
        padding: 16px;
    }

    .temp-current {
        font-size: 2.5em;
    }
}
