/* Global Styles */
body {
    font-family: "Open Sans", sans-serif;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-image: url('https://source.unsplash.com/1600x900/?weather,nature');
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

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

/* Adding darker overlay to ensure text readability */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* Removing floating clouds since we have a real image now */
body::after {
    display: none;
}

/* Header Content */
.header-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 1em;
    width: 100%;
}

.weather-today {
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5em 1em;
    border-radius: 15px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Weather Card */
.card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 2em;
    border-radius: 30px;
    max-width: 420px;
    text-align: center;
    box-sizing: border-box;
    margin-left: 2em;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.card .picture {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: 20px;
    margin-bottom: 1em;
}

/* Search Bar */
input.search-bar {
    padding: 0.7em 1em;
    margin-bottom: 1em;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: white;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    outline: none;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

input.search-bar:focus {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

/* Buttons */
button {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* Weather Information */
h1.temp, .city, .description, .humidity, .wind {
    margin: 0.7em 0;
    word-wrap: break-word;
}

.city {
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.temp {
    font-size: 3rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.flex {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1em 0;
}

.description {
    margin-left: 0.5em;
    text-transform: capitalize;
    font-size: 1.2rem;
}

.humidity, .wind {
    font-size: 1.1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5em;
    border-radius: 10px;
    margin: 0.5em auto;
    width: fit-content;
    min-width: 60%;
}

.icon {
    width: 50px;
    height: 50px;
}

.weather.loading {
    visibility: hidden;
}

.weather.loading::after {
    content: "loading...";
    color: white;
    position: absolute;
    top: 20px;
    left: 20px;
}

/* Footer with Music Player */
.app-footer {
    margin-top: 20px;
    width: 95%;
    text-align: left;
    padding-left: 3%;
}

audio {
    width: 100%;
    max-width: 420px;
}

/* Search Section */
.search {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.search-bar {
    text-align: center;
    box-shadow: 5px 5px 5px rgba(223, 71, 21, 0.2);
}

.search-btn {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    color: white;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
    max-width: 200px;
    font-size: 1rem;
    box-shadow: 5px 5px 5px rgba(223, 71, 21, 0.2);
}

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

.unit-toggle {
    width: 40px;
    padding-right: 11%;
    height: 40px;
    border: none;
    border-radius: 30%;
    background-color: transparent;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 5px 5px 5px rgba(223, 71, 21, 0.2);
}

.unit-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Background Change Button */
.bg-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.bg-change-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: block;
    max-width: 200px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bg-change-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.category-select {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    max-width: 200px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.category-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.8);
}

.category-select option {
    background-color: #2a4365;
    color: white;
}

/* Responsive Styles */
@media (max-width: 600px) {
    body {
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding: 1em;
    }

    .header-content {
        align-items: center;
        text-align: center;
        padding: 0;
    }

    .weather-today {
        font-size: 1.5rem;
        padding: 0.4em 0.8em;
    }

    .card {
        margin: 1em 0;
        padding: 1.5em;
        border-radius: 20px;
        width: 100%;
        max-width: 100%;
    }

    input.search-bar {
        font-size: 14px;
    }

    button {
        font-size: 14px;
        padding: 10px 15px;
        max-width: none;
    }

    .city {
        font-size: 1.5rem;
    }

    .temp {
        font-size: 2.5rem;
    }

    .description {
        font-size: 1rem;
    }

    .humidity, .wind {
        font-size: 0.9rem;
    }

    .app-footer audio {
        width: 100%;
    }
    
    .bg-controls {
        width: 100%;
        align-items: center;
    }
    
    .bg-change-btn,
    .category-select,
    .custom-url-container {
        max-width: 100%;
        width: 90%;
    }
    
    .custom-url-input {
        font-size: 14px;
    }
    
    .custom-url-btn {
        font-size: 14px;
        padding: 8px 10px;
        min-width: 50px;
    }
}

/* Custom URL Input */
.custom-url-container {
    display: flex;
    width: 100%;
    max-width: 200px;
    gap: 5px;
    margin-top: 5px;
    flex-wrap: wrap;
    position: relative;
}

.custom-url-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.custom-url-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.custom-url-input:focus {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.custom-url-btn {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    min-width: 60px;
}

.custom-url-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* URL Error Message */
.url-error {
    width: 100%;
    background: rgba(255, 59, 48, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.8rem;
    margin-top: 5px;
    text-align: center;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Background Loading Indicator */
.bg-loading {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 2s ease-in-out;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}