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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1e5799, #207cca);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.current-date {
    font-size: 1.2rem;
    opacity: 0.8;
    margin-bottom: 15px;
}

/* Temperature Unit Toggle */
.unit-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px auto;
    gap: 10px;
}

.unit-toggle {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.unit-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: rgba(255, 255, 255, 0.4);
}

input:focus + .slider {
    box-shadow: 0 0 1px rgba(255, 255, 255, 0.7);
}

input:checked + .slider:before {
    transform: translateX(28px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.weather-container {
    position: relative;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.weather-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.weather-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    position: relative;
}

.weather-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.day-name {
    font-size: 1.5rem;
    font-weight: 600;
}

.date {
    font-size: 0.9rem;
    opacity: 0.8;
}

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

.weather-icon img {
    width: 80px;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.temperature {
    font-size: 2.5rem;
    text-align: center;
    font-weight: 600;
    margin: 10px 0;
}

.description {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-transform: capitalize;
}

.details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.detail {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail i {
    font-size: 1.2rem;
}

/* Weather background animations */
.rain-animation, .snow-animation, .clouds-animation, .clear-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    border-radius: 15px;
    overflow: hidden;
}

/* Rain animation with realistic raindrops */
.rain-animation {
    background: linear-gradient(180deg, #3a6073, #16222a);
}

.rain-animation::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 0;
    width: 100%;
    height: 100%;
    animation: rain 0.8s linear infinite;
}

.raindrop {
    position: absolute;
    width: 2px;
    height: 15px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 5px 5px;
    opacity: 0.6;
    animation: raindrop 1s linear infinite;
}

@keyframes raindrop {
    0% {
        transform: translateY(-100px);
    }
    100% {
        transform: translateY(calc(100% + 100px));
    }
}

/* Snow animation */
.snow-animation {
    background: linear-gradient(180deg, #5d6d7e, #2c3e50);
}

.snow-animation::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, white 1px, transparent 1px);
    background-size: 20px 20px;
    animation: snow 3s linear infinite;
}

@keyframes snow {
    0% { background-position: 0 0; }
    100% { background-position: 20px 20px; }
}

/* Clouds animation */
.clouds-animation {
    background: linear-gradient(180deg, #4b6cb7, #182848);
}

.clouds-animation::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 100%;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMDAiIGhlaWdodD0iMTAwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PGNpcmNsZSBmaWxsPSJyZ2JhKDI1NSwyNTUsMjU1LDAuMikiIGN4PSI1MCIgY3k9IjUwIiByPSI0MCIvPjwvc3ZnPg==');
    background-size: 100px 100px;
    opacity: 0.3;
    animation: clouds 15s linear infinite;
}

@keyframes clouds {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Clear animation */
.clear-animation {
    background: linear-gradient(180deg, #56ccf2, #2f80ed);
    overflow: hidden;
}

.clear-animation::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    animation: sunshine 4s ease-in-out infinite;
}

@keyframes sunshine {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.9; }
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    font-size: 0.9rem;
    opacity: 0.7;
}

footer a {
    color: #fff;
    text-decoration: none;
    border-bottom: 1px dashed;
}

.error-message {
    text-align: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.error-message i {
    font-size: 3rem;
    color: #ff6b6b;
    margin-bottom: 20px;
}

.error-message p {
    margin-bottom: 20px;
}

.error-message button {
    background: #fff;
    color: #207cca;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.error-message button:hover {
    background: #eef;
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .weather-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .weather-card {
        width: 100%;
        max-width: 350px;
    }
}