/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 450px;
    padding: 30px;
    transition: all 0.3s ease;
}

.app-title {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-weight: 600;
    font-size: 28px;
}

/* Search Box */
.search-box {
    display: flex;
    margin-bottom: 20px;
}

#city-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 10px 0 0 10px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
}

#city-input:focus {
    border-color: #2193b0;
}

#search-btn {
    background-color: #2193b0;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

#search-btn:hover {
    background-color: #1a7f99;
}

/* Search Tip */
.search-tip {
    text-align: center;
    color: #666;
    margin-bottom: 15px;
    font-size: 12px;
}

/* Error Message */
.error-message {
    color: #e74c3c;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    height: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.error-message.visible {
    opacity: 1;
}

/* Loading */
.loading-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(33, 147, 176, 0.3);
    border-radius: 50%;
    border-top: 4px solid #2193b0;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

/* Weather Display */
.weather-container {
    display: none;
    padding: 20px 10px;
    text-align: center;
}

.city-name {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.country {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.temperature {
    font-size: 60px;
    font-weight: 700;
    color: #2193b0;
    margin-bottom: 10px;
}

.weather-icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 10px;
}

.weather-description {
    font-size: 22px;
    color: #444;
    margin-bottom: 25px;
}

.weather-details {
    display: flex;
    justify-content: space-around;
    margin-top: 30px;
    background-color: rgba(33, 147, 176, 0.1);
    padding: 15px 10px;
    border-radius: 15px;
}

.detail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.detail i {
    font-size: 20px;
    color: #2193b0;
    margin-bottom: 8px;
}

.detail-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

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

/* Responsive Design */
@media (max-width: 500px) {
    .container {
        padding: 20px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    #city-input {
        border-radius: 10px;
        margin-bottom: 10px;
        width: 100%;
    }
    
    #search-btn {
        border-radius: 10px;
        width: 100%;
    }
    
    .temperature {
        font-size: 50px;
    }
    
    .weather-details {
        flex-wrap: wrap;
    }
    
    .detail {
        width: 50%;
        margin-bottom: 15px;
    }
}

/* Weather Condition Styles */
.weather-sunny {
    background: linear-gradient(135deg, #FFC371, #FF5F6D);
}

.weather-cloudy {
    background: linear-gradient(135deg, #bdc3c7, #2c3e50);
}

.weather-rainy {
    background: linear-gradient(135deg, #3a7bd5, #3a6073);
}

.weather-snowy {
    background: linear-gradient(135deg, #e6dada, #274046);
}

/* Animation for weather data appearance */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.weather-container.visible {
    display: block;
    animation: fadeIn 0.5s ease forwards;
}

/* 24小时天气预报样式 */
.hourly-forecast-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 30px 0 15px;
    text-align: center;
}

.hourly-forecast-container {
    display: flex;
    overflow-x: auto;
    padding: 10px 0;
    margin: 0 -10px;
    scrollbar-width: thin;
    scrollbar-color: #2193b0 #f1f1f1;
    -webkit-overflow-scrolling: touch; /* 为iOS设备添加惯性滚动 */
    cursor: grab;
}

.hourly-forecast-container::-webkit-scrollbar {
    height: 8px;
}

.hourly-forecast-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.hourly-forecast-container::-webkit-scrollbar-thumb {
    background: #2193b0;
    border-radius: 10px;
}

.hourly-forecast-container::-webkit-scrollbar-thumb:hover {
    background: #1a7f99;
}

.hourly-forecast-container.active {
    cursor: grabbing;
}

.hourly-item {
    min-width: 100px; /* 增加宽度容纳更多信息 */
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    padding: 12px 10px;
    margin: 0 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hourly-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 当前小时高亮显示 */
.hourly-item.current-hour {
    background-color: rgba(33, 147, 176, 0.15);
    border: 2px solid #2193b0;
    transform: scale(1.05);
}

.hourly-item.current-hour:hover {
    transform: scale(1.05) translateY(-3px);
}

.hourly-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.hourly-time {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.hourly-icon {
    width: 40px;
    height: 40px;
    margin-bottom: 8px;
}

.hourly-temp {
    font-size: 16px;
    font-weight: 600;
    color: #2193b0;
    margin-bottom: 5px;
}

.hourly-text {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.no-forecast {
    text-align: center;
    color: #666;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    width: 100%;
}

/* 更新时间样式 */
.update-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

/* API 状态信息 */
.api-status {
    margin-top: 20px;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
}

.api-status p {
    margin: 5px 0;
    color: #666;
}

.api-status button {
    margin-top: 10px;
    background-color: #2193b0;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.api-status button:hover {
    background-color: #1a7f99;
}

.hourly-details {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 11px;
    color: #666;
}

.hourly-details span {
    display: flex;
    align-items: center;
    margin: 0 3px;
}

.hourly-details i {
    margin-right: 3px;
    font-size: 10px;
    color: #2193b0;
}

/* SVG天气动画相关样式 */
.weather-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.svg-weather-icon {
    position: absolute;
    width: 100px;
    height: 100px;
}

/* 晴天动画元素位置 */
.sunny-element {
    position: absolute;
    opacity: 0.6;
}

.sunny-element:nth-child(1) {
    top: 10%;
    left: 15%;
    transform: scale(0.5);
}

.sunny-element:nth-child(2) {
    top: 20%;
    right: 10%;
    transform: scale(0.7);
}

.sunny-element:nth-child(3) {
    bottom: 15%;
    left: 20%;
    transform: scale(0.6);
}

/* 多云动画元素位置 */
.cloudy-element {
    position: absolute;
    opacity: 0.5;
}

.cloudy-element:nth-child(1) {
    top: 10%;
    left: 10%;
    transform: scale(1.2);
}

.cloudy-element:nth-child(2) {
    top: 20%;
    right: 15%;
    transform: scale(0.8);
}

.cloudy-element:nth-child(3) {
    bottom: 30%;
    left: 5%;
    transform: scale(1);
}

.cloudy-element:nth-child(4) {
    bottom: 10%;
    right: 20%;
    transform: scale(0.7);
}

/* 雨天动画元素位置 */
.rainy-element {
    position: absolute;
    opacity: 0.7;
}

.rainy-element:nth-child(1) {
    top: 5%;
    left: 10%;
    transform: scale(1.1);
}

.rainy-element:nth-child(2) {
    top: 15%;
    right: 20%;
    transform: scale(0.9);
}

.rainy-element:nth-child(3) {
    bottom: 25%;
    left: 15%;
    transform: scale(0.8);
}

/* 雪天动画元素位置 */
.snowy-element {
    position: absolute;
    opacity: 0.7;
}

.snowy-element:nth-child(1) {
    top: 5%;
    left: 10%;
    transform: scale(1.1);
}

.snowy-element:nth-child(2) {
    top: 15%;
    right: 20%;
    transform: scale(0.9);
}

.snowy-element:nth-child(3) {
    bottom: 25%;
    left: 15%;
    transform: scale(0.8);
}

/* 温度计展示样式 */
.thermometer-container {
    position: relative;
    width: 60px;
    height: 120px;
    margin: 0 auto 20px;
}

/* 动态温度计样式 */
#dynamic-thermometer {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
    width: 60px;
    animation: fadeIn 0.5s ease;
}

#dynamic-thermometer svg {
    width: 60px;
    height: 120px;
}

.thermometer-temp {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-top: 5px;
}

/* 互动按钮组样式 */
.interactive-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 0 10px;
}

.interactive-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #2193b0;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.interactive-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s;
}

.interactive-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.interactive-btn:hover::before {
    left: 100%;
}

.interactive-btn:active {
    transform: scale(0.95);
}

.interactive-btn.active {
    background: #FF5F6D;
}

/* 收藏城市样式 */
.favorite-cities {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    max-height: 40px;
    overflow: hidden;
}

.favorite-cities:empty {
    max-height: 0;
    margin-bottom: 0;
}

.favorite-city-tag {
    background: rgba(33, 147, 176, 0.15);
    border: 1px solid #2193b0;
    border-radius: 20px;
    padding: 5px 15px;
    font-size: 12px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.favorite-city-tag:hover {
    background: rgba(33, 147, 176, 0.3);
    transform: translateY(-2px);
}

.favorite-city-tag i {
    font-size: 10px;
    color: #e74c3c;
}

/* 操作按钮样式 */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.weather-container.visible + .action-buttons {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: 2px solid #2193b0;
    border-radius: 25px;
    color: #2193b0;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn:hover {
    background: #2193b0;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(33, 147, 176, 0.3);
}

.action-btn:active {
    transform: scale(0.97);
}

.action-btn i {
    font-size: 14px;
}

/* 主题相关样式 - 暗色主题 */
body.dark-theme {
    background: linear-gradient(135deg, #232526, #414345);
}

body.dark-theme .container {
    background-color: rgba(40, 44, 52, 0.95);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body.dark-theme .app-title,
body.dark-theme .city-name,
body.dark-theme .weather-description,
body.dark-theme .detail-value,
body.dark-theme .hourly-time,
body.dark-theme .hourly-temp,
body.dark-theme .thermometer-temp {
    color: #f5f5f5;
}

body.dark-theme .search-tip,
body.dark-theme .update-time,
body.dark-theme .detail-label,
body.dark-theme .hourly-text,
body.dark-theme .hourly-date {
    color: #aaa;
}

body.dark-theme #city-input {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: #555;
}

body.dark-theme .interactive-btn {
    background: #414345;
}

body.dark-theme .action-btn {
    border-color: #6dd5ed;
    color: #6dd5ed;
}

body.dark-theme .action-btn:hover {
    background: #6dd5ed;
    color: #232526;
}

body.dark-theme .hourly-item,
body.dark-theme .no-forecast {
    background-color: rgba(70, 74, 82, 0.8);
}

/* 响应式设计补充 */
@media (max-width: 500px) {
    .interactive-buttons {
        gap: 10px;
    }
    
    .interactive-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .action-btn {
        padding: 6px 15px;
        font-size: 12px;
    }
} 