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

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #87CEEB, #B0E2FF, #CAE1FF);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 900px;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
}

header {
    background: rgba(135, 206, 235, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #2c3e50;
    padding: 40px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

header h1 {
    font-size: 2.8em;
    margin-bottom: 12px;
    text-shadow: 0 2px 5px rgba(255, 255, 255, 0.5);
    color: #2c3e50;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
    color: #2c3e50;
}

main {
    padding: 40px;
    display: flex;
    flex-direction: column;
}

.search-section {
    margin-bottom: 30px;
    text-align: center;
}

.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto 20px;
    gap: 12px;
}

.favorites-section {
    margin: 20px auto;
    max-width: 600px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.favorites-section h3 {
    margin-bottom: 10px;
    color: #2c3e50;
    text-align: center;
    font-size: 1.2em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.favorites-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 5px;
}

.favorite-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background: rgba(135, 206, 235, 0.5);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    font-size: 0.9em;
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-item:hover {
    background: rgba(135, 206, 235, 0.7);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.favorite-item .remove-favorite {
    margin-left: 6px;
    background: rgba(255, 255, 255, 0.5);
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
    color: #d32f2f;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.favorite-item .remove-favorite:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* 顶部悬浮通知样式 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.error {
    background: linear-gradient(135deg, #e53935, #e35d5b);
}

.notification.success {
    background: linear-gradient(135deg, #43a047, #66bb6a);
}

.search-form input {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    color: #2c3e50;
}

.search-form input:focus {
    outline: none;
    box-shadow: 0 5px 20px rgba(135, 206, 235, 0.4);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.95);
}

.search-btn {
    padding: 16px 30px;
    background: linear-gradient(135deg, #87CEEB, #63B8FF);
    color: #2c3e50;
    border: none;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(135, 206, 235, 0.3);
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(135, 206, 235, 0.4);
}

.search-btn:active {
    transform: translateY(-1px);
}

/* 定位按钮 */
.location-btn {
    display: block;
    margin: 0 auto 20px;
    padding: 12px 25px;
    background: linear-gradient(135deg, #B0E2FF, #87CEEB);
    color: #2c3e50;
    border: none;
    border-radius: 50px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(176, 226, 255, 0.3);
}

.location-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(176, 226, 255, 0.4);
}

.location-btn:active {
    transform: translateY(-1px);
}

.favorite-toggle-btn {
    padding: 6px 12px;
    background: rgba(135, 206, 235, 0.5);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.favorite-toggle-btn:hover {
    background: rgba(135, 206, 235, 0.7);
    transform: scale(1.05);
}

.results-section {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
}

.city-selection {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.city-selection h3 {
    margin-bottom: 20px;
    color: #2c3e50;
    font-size: 1.4em;
    text-align: center;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.city-item {
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.city-item:hover {
    background: rgba(135, 206, 235, 0.4);
    border-color: rgba(135, 206, 235, 0.6);
    transform: translateX(8px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.city-item strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 4px;
    color: #2c3e50;
}

.weather-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.weather-controls h3 {
    color: #2c3e50;
    font-size: 1.5em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    margin: 0;
}

.weather-btns {
    display: flex;
    gap: 10px;
}

.weather-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.weather-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(255, 255, 255, 0.5);
}

.weather-btn.active {
    background: linear-gradient(135deg, #87CEEB, #63B8FF);
    border-color: rgba(135, 206, 235, 0.6);
    color: #2c3e50;
    text-shadow: none;
    box-shadow: 0 4px 15px rgba(135, 206, 235, 0.3);
}

.weather-content {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.35);
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
    min-height: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.current-weather {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.current-weather .weather-icon-large {
    width: 100px;
    height: 100px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-weather .weather-icon-large img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.current-weather h4 {
    font-size: 2em;
    margin-bottom: 10px;
    color: #2c3e50;
    text-shadow: 0 2px 5px rgba(255, 255, 255, 0.5);
}

.weather-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    margin-top: 25px;
    width: 100%;
}

.weather-item {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.weather-item strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 8px;
    color: #2c3e50;
}

.forecast-day {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    align-items: flex-start;
    transition: background 0.3s ease;
    gap: 15px;
}

.forecast-day:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.forecast-day:last-child {
    border-bottom: none;
}

.forecast-date {
    font-weight: 500;
    color: #2c3e50;
    font-size: 1.1em;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    align-self: flex-start;
}

.forecast-temp {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    width: 100%;
}

.forecast-temp span {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 15px;
    border-radius: 20px;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.4);
    min-width: 120px;
    text-align: center;
}

/* 新增：天气预报中的日间和夜间天气布局 */
.forecast-weather {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.forecast-realfeel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.realfeel-item {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
}

.realfeel-item strong {
    min-width: 140px;
    color: #2c3e50;
}

.realfeel-item span {
    flex: 1;
    text-align: right;
    color: #2c3e50;
    min-width: 150px;
}

.forecast-daytime,
.forecast-nighttime {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.weather-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.weather-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.weather-description {
    color: #2c3e50;
    font-size: 0.9em;
}

.alert-item {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 4px solid rgba(220, 53, 69, 0.7);
    background: rgba(248, 215, 218, 0.4);
    color: #721c24;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 1.1em;
    color: #2c3e50;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.3);
}

.forecast-loading,
.current-weather-loading,
.alert-loading {
    text-align: center;
    padding: 40px;
    font-size: 1.3em;
    color: #2c3e50;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.3);
}

.error {
    background: rgba(248, 215, 218, 0.4);
    color: #721c24;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid rgba(220, 53, 69, 0.7);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.success {
    background: rgba(212, 237, 218, 0.4);
    color: #155724;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border-left: 4px solid rgba(40, 167, 69, 0.7);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

/* 页脚样式 */
.page-footer {
    background: rgba(135, 206, 235, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 15px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    color: #2c3e50;
    font-size: 0.9em;
    margin: 20px auto 0;
    max-width: 900px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.page-footer a {
    color: #2c3e50;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.page-footer a:hover {
    color: #5e92f3;
}

/* 响应式设计优化 */
@media (max-width: 768px) {
    .container {
        margin: 10px auto 20px;
        border-radius: 15px;
    }
    
    main {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    header p {
        font-size: 1em;
        color: #2c3e50;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-form input,
    .search-btn,
    .location-btn {
        width: 100%;
    }
    
    .favorites-section {
        margin: 15px auto;
        padding: 12px;
    }
    
    .favorites-section h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
    
    .favorites-list {
        max-height: 120px;
        padding: 3px;
    }
    
    .favorite-item {
        font-size: 0.8em;
        padding: 5px 10px;
        max-width: 130px;
    }
    
    .favorite-item .remove-favorite {
        width: 16px;
        height: 16px;
        font-size: 9px;
        margin-left: 5px;
    }
    
    .weather-controls {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 10px;
    }
    
    .weather-btns {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .weather-btn {
        padding: 10px 18px;
        font-size: 0.9em;
    }
    
    .weather-info {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .weather-item {
        padding: 15px;
        font-size: 0.9em;
    }
    
    .current-weather h4 {
        font-size: 1.5em;
    }
    
    .current-weather .weather-icon-large {
        width: 80px;
        height: 80px;
    }
    
    .forecast-day {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .forecast-temp {
        width: 100%;
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .forecast-temp span {
        min-width: 100px;
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .forecast-realfeel {
        padding: 12px;
    }
    
    .realfeel-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .realfeel-item strong {
        min-width: auto;
        font-size: 0.9em;
    }
    
    .realfeel-item span {
        min-width: auto;
        text-align: left;
        font-size: 0.9em;
    }
    
    .forecast-weather {
        width: 100%;
    }
    
    .forecast-daytime,
    .forecast-nighttime {
        justify-content: flex-start;
        gap: 8px;
    }
    
    .weather-icon {
        width: 35px;
        height: 35px;
    }
    
    .weather-description {
        font-size: 0.85em;
    }
    
    .page-footer {
        margin: 20px auto 0;
        padding: 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .container {
        margin: 5px auto 10px;
    }
    
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.6em;
    }
    
    header p {
        font-size: 0.95em;
    }
    
    main {
        padding: 15px;
    }
    
    .location-btn {
        padding: 10px 20px;
        font-size: 0.95em;
    }
    
    .search-form input {
        padding: 14px 16px;
        font-size: 1em;
    }
    
    .search-btn {
        padding: 14px 24px;
        font-size: 1em;
    }
    
    .favorites-section {
        margin: 12px auto;
        padding: 10px;
    }
    
    .favorites-section h3 {
        font-size: 1em;
    }
    
    .favorites-list {
        max-height: 100px;
    }
    
    .favorite-item {
        font-size: 0.75em;
        padding: 4px 8px;
        max-width: 110px;
    }
    
    .favorite-item .remove-favorite {
        width: 15px;
        height: 15px;
        font-size: 8px;
    }
    
    .weather-controls h3 {
        font-size: 1.2em;
    }
    
    .weather-btns {
        gap: 6px;
    }
    
    .weather-btn {
        padding: 8px 15px;
        font-size: 0.85em;
    }
    
    .weather-info {
        gap: 10px;
    }
    
    .weather-item {
        padding: 12px;
    }
    
    .current-weather h4 {
        font-size: 1.4em;
    }
    
    .current-weather .weather-icon-large {
        width: 70px;
        height: 70px;
    }
    
    .forecast-day {
        padding: 12px;
        gap: 10px;
    }
    
    .forecast-temp span {
        min-width: 90px;
        padding: 6px 10px;
        font-size: 0.85em;
    }
    
    .forecast-realfeel {
        padding: 10px;
    }
    
    .realfeel-item {
        font-size: 0.85em;
    }
    
    .realfeel-item strong {
        font-size: 0.85em;
    }
    
    .realfeel-item span {
        font-size: 0.85em;
    }
    
    .forecast-daytime,
    .forecast-nighttime {
        padding: 6px;
        gap: 6px;
    }
    
    .weather-icon {
        width: 30px;
        height: 30px;
    }
    
    .weather-description {
        font-size: 0.8em;
    }
    
    .alert-item {
        padding: 15px;
        font-size: 0.9em;
    }
    
    .page-footer {
        margin: 15px auto 0;
        padding: 8px;
        font-size: 0.75em;
    }
}