/* ====== Basic Reset ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    transition: background 1.5s ease;
    overflow-x: hidden;
    position: relative;
}

/* ====== Container ====== */
.container {
    position: relative;
    background: rgba(255, 255, 255, 0.8);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

h1 {
    margin-bottom: 20px;
    color: #333;
}

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

.search-box input {
    flex: 1;
    padding: 10px;
    border-radius: 8px 0 0 8px;
    border: 1px solid #ccc;
    outline: none;
}

.search-box button {
    padding: 10px;
    border: none;
    background-color: #007BFF;
    color: white;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
}

.search-box button:hover {
    background-color: #0056b3;
}

/* ====== Temperature Toggle ====== */
.unit-toggle {
    margin-bottom: 15px;
}

.unit-toggle button {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background-color: #28a745;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.unit-toggle button:hover {
    background-color: #1e7e34;
}

/* ====== Error ====== */
.error {
    color: red;
    margin-bottom: 10px;
}

/* ====== Current Weather ====== */
.weather-info {
    display: none;
}

.weather-info img {
    width: 100px;
    height: 100px;
}

.weather-info p {
    margin: 8px 0;
    font-size: 16px;
}

/* ====== Forecast Cards ====== */
.forecast-container {
    margin-top: 20px;
    display: none;
}

.forecast-cards {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.forecast-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    padding: 10px;
    flex: 1 1 60px;
    text-align: center;
    transition: transform 0.3s ease, background 0.3s ease;
}

.forecast-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.3);
}

.forecast-card img {
    width: 50px;
    height: 50px;
}

.forecast-card p {
    margin: 4px 0;
    font-size: 14px;
}

/* ====== Weather Animation Layer ====== */
.weather-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Clouds */
.cloud {
    position: absolute;
    background: url('cloud.png') no-repeat;
    background-size: contain;
    width: 150px;
    height: 80px;
    animation: moveClouds linear infinite;
    will-change: transform;
}

@keyframes moveClouds {
    0% { left: -200px; }
    100% { left: 100%; }
}

/* Rain */
.rain-drop {
    position: absolute;
    width: 2px;
    height: 15px;
    background: #00f;
    opacity: 0.6;
    animation: fall linear infinite;
    will-change: transform;
}

@keyframes fall {
    0% { top: -20px; }
    100% { top: 100%; }
}

/* Snow */
.snowflake {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    opacity: 0.8;
    animation: snowFall linear infinite;
    will-change: transform;
}

@keyframes snowFall {
    0% { top: -10px; transform: translateX(0); }
    100% { top: 100%; transform: translateX(50px); }
}

/* ====== Day/Night Backgrounds ====== */
body.clear.day { background: linear-gradient(to right, #fceabb, #f8b500); }
body.clear.night { background: linear-gradient(to right, #2c3e50, #4ca1af); }
body.clouds.day { background: linear-gradient(to right, #d7dde8, #aebccf); }
body.clouds.night { background: linear-gradient(to right, #1c1c1c, #2c3e50); }
body.rain.day { background: linear-gradient(to right, #4b79a1, #283e51); }
body.rain.night { background: linear-gradient(to right, #0f2027, #203a43); }
body.snow.day { background: linear-gradient(to right, #e0eafc, #cfdef3); }
body.snow.night { background: linear-gradient(to right, #2c3e50, #4b79a1); }
body.thunderstorm { background: linear-gradient(to right, #373b44, #4286f4); }
body.mist { background: linear-gradient(to right, #3e5151, #decba4); }

/* ====== Responsive ====== */
@media (max-width: 400px) {
    .container { padding: 20px; }
    .weather-info img { width: 80px; height: 80px; }
    .forecast-cards { flex-direction: column; gap: 10px; }
    .forecast-card { flex: 1 1 100%; }
}
@media (max-width: 300px) {
    .search-box input, .search-box button {
        font-size: 12px;
        padding: 8px;
    }
    .unit-toggle button {
        font-size: 12px;
        padding: 6px 10px;
    }
}