body, html {
    height: 100%;
    margin: 0;
    font-family: Arial, sans-serif;
    color: #333;
    text-align: center;
    padding: 20px;
}

.background-blur {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://images.pexels.com/photos/2642612/pexels-photo-2642612.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1");
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(5px);
    z-index: -1; /* Pastikan background berada di belakang konten */
}

.weather-app {
    max-width: 600px;
    margin: 0 auto;
    margin-top: 20px;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
    position: relative; /* Tetapkan posisi relatif untuk memastikan berada di atas background */
    transition: background-color 0.5s ease, color 0.5s ease;
}

.input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 20px;
}

input[type="text"] {
    padding: 10px;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    width: 50%;
    box-sizing: border-box;
}

button {
    padding: 10px 20px;
    font-size: 1em;
    border: none;
    border-radius: 0 4px 4px 0;
    background-color: #007BFF;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.3s ease;
    box-sizing: border-box;
}

button:hover {
    background-color: #0056b3;
}

#weatherResult {
    margin-top: 20px;
}

/* Switch Toggle Style */
.switch {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 60px;
    height: 34px;
    z-index: 2; /* Memastikan toggle berada di atas konten lain */
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: #000; /* Warna hitam untuk lingkaran */
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* Theme Styles */
.weather-app.light-mode {
    background-color: #ffffff;
    color: #000000;
}

.weather-app.dark-mode {
    background-color: #333333;
    color: #ffffff;
}

@media (max-width: 600px) {
    .weather-app {
        padding: 15px;
    }

    input[type="text"], button {
        width: 100%;
        margin-bottom: 10px;
        border-radius: 4px;
    }

    .switch {
        top: 18px;
        right: 15px;
        width: 40px;  /* Sesuaikan ukuran switch */
        height: 22px; /* Sesuaikan tinggi switch */
    }

    .switch .slider:before {
        width: 18px;  /* Sesuaikan ukuran bola */
        height: 18px; /* Sesuaikan ukuran bola */
        top: 2px;     /* Posisikan bola di tengah */
        left: 2px;    /* Sesuaikan posisi kiri */
        transform: translateX(0); /* Reset transformasi */
    }

    input:checked + .slider:before {
        transform: translateX(18px); /* Sesuaikan dengan lebar switch */
    }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 5px solid #3498db;
    animation: spin 1s linear infinite;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999; /* Pastikan spinner di atas elemen lain */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Kontainer untuk kartu ramalan cuaca */
.forecast-container {
    display: flex; /* Menggunakan flexbox untuk tata letak horizontal */
    flex-wrap: nowrap; /* Menjaga kartu tetap berada dalam satu baris */
    overflow-x: auto; /* Menambahkan scroll horizontal jika diperlukan */
    margin-top: 20px;
    padding: 10px 0; /* Menambahkan padding atas dan bawah */
}

/* Kartu ramalan cuaca */
.forecast-item {
    flex: 0 0 auto; /* Mengatur ukuran kartu agar tidak berubah */
    width: 180px; /* Menetapkan lebar tetap */
    margin: 10px; /* Jarak antara kartu */
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

/* Efek saat hover */
.forecast-item:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* Gambar cuaca */
.forecast-item img {
    width: 60px;
    height: 60px;
    margin-bottom: 10px;
}

/* Judul ramalan cuaca */
.forecast-item h3 {
    margin: 10px 0;
    font-size: 1.2em;
    color: #333;
}

/* Deskripsi ramalan cuaca */
.forecast-item p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #555;
}

/* Tema gelap */
.weather-app.dark-mode .forecast-item {
    background-color: #444;
    color: #ddd;
}

/* Judul ramalan cuaca dalam tema gelap */
.weather-app.dark-mode .forecast-item h3 {
    color: #fff; /* Ubah warna h3 menjadi putih saat dark mode */
}

/* Deskripsi ramalan cuaca dalam tema gelap */
.weather-app.dark-mode .forecast-item p {
    color: #ccc;
}

/* Pastikan h2 juga berubah warna saat dark mode */
.weather-app.dark-mode #geoWeather h2,
.weather-app.dark-mode #cityWeather h2 {
    color: #fff; /* Ubah warna h2 menjadi putih saat dark mode */
}
