body {
    position: relative;
    height: 100%;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 1rem;
}

/* 🌞 Modo Claro (Padrão) */
body {
    background: url('../../assets/background/bg-day.avif') no-repeat center center;
    background-size: cover;
    color: #002969;
    transition: background 0.5s ease-in-out, color 0.5s ease-in-out;
}

/* 🌑 Modo Noturno */
body.night-mode {
    background: url('../../assets/background/bg-night.avif') no-repeat center center;
    background-size: cover;
    color: white;
}

/* Ajustando o card no modo noturno */
.night-mode .weather-card {
    background-color: rgba(30, 30, 30, 0.85);
}

/* Ajustando detalhes para melhor contraste no modo noturno */
.night-mode .detail-item {
    background: rgba(255, 255, 255, 0.1);
}

.night-mode .detail-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Ajustando previsão do tempo */
.night-mode .forecast-item {
    background: rgba(255, 255, 255, 0.1);
}

/* Estilo do alerta meteorológico */
#weather-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    display: flex;
    align-items: center;
    transform: translateX(-50%);
    width: auto;
    max-width: 400px;
    background: rgba(255, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    text-align: center;
    padding: 15px 20px;
    font-size: .875rem;
    font-weight: bold;
    border-radius: 12px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

#alert-icon {
    width: 40px;
    height: 40px;
}

/* Botão para fechar o alerta */
#close-alert {
    position: absolute;
    top: 6px;
    right: 6px;
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-left: auto;
    transition: color 0.3s ease-in-out;
}

#close-alert:hover {
    color: rgb(255, 200, 200);
}

/* Estilo para o container da barra de pesquisa */
.search-container {
    position: absolute;
    z-index: 1;
    top: .25rem;
    left: 50%;
    transform: translateX(-50%);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 250px;
}

.input-flag {
    width: 24px;
    height: 24px;
    position: absolute;
    left: 10px;
    display: none; /* Esconde até que seja atualizado */
}

/* Estilo para o botão de limpar input */
#clear-btn {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: white;
    display: none;
}

#clear-btn:hover {
    color: red;
}

/* Estilo para o campo de entrada */
#city-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    font-size: 16px;
    border: transparent;
    background: rgb(255, 255, 255, .2);
    color: white;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
}

#city-input:focus {
    border-color: #0056b3;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

#city-input::placeholder {
    color: rgb(199, 199, 199);
}

/* Estilização da bandeira nas sugestões */
.city-flag {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.suggestions {
    position: absolute;
    top: 50px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid #ccc;
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    border-radius: 5px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
    display: none; /* Oculta por padrão */
}

.suggestions.active {
    display: block; /* Só exibe quando houver sugestões */
}

.city-option {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

.city-option:hover {
    background: #f0f0f0;
}

/* Estilo para a bandeira */
.flag-icon {
    width: 25px;
    height: 17px;
    margin-right: 10px;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

/* Estilização do card do tempo */
.weather-card {
    display: none;
    width: 90%;
    max-width: 800px;
    background-color: rgba(69, 160, 255, 0.85);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 8px 8px 30px -14px rgba(66, 68, 90, 1);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s ease-out forwards;
    transition: background 0.5s ease-in-out;
}

/* Cabeçalho do card */
.weather-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
}

.weather-header > div {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .25rem;
}

.weather-header #city-name {
    font-size: 1.5rem;
}

/* Informações principais do clima */
.weather-main {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

.weather-main > img {
    align-self: flex-start;
    width: 53px;
    height: 53px;
}

.temperature {
    font-size: 48px;
    font-weight: bold;
    margin-left: 10px;
}

.condition {
    font-size: 18px;
    font-weight: bold;
}

/* Grid de detalhes adicionais */
.details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
    font-size: 14px;
    margin-top: 15px;
}

/* Estilização dos itens do detalhe */
.detail-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInDetails 0.5s ease-out forwards;
}

/* Aplica um delay progressivo para cada detalhe */
.detail-item:nth-child(1) { animation-delay: 0.1s; }
.detail-item:nth-child(2) { animation-delay: 0.2s; }
.detail-item:nth-child(3) { animation-delay: 0.3s; }
.detail-item:nth-child(4) { animation-delay: 0.4s; }
.detail-item:nth-child(5) { animation-delay: 0.5s; }
.detail-item:nth-child(6) { animation-delay: 0.6s; }
.detail-item:nth-child(7) { animation-delay: 0.7s; }
.detail-item:nth-child(8) { animation-delay: 0.8s; }
.detail-item:nth-child(9) { animation-delay: 0.9s; }
.detail-item:nth-child(10) { animation-delay: 1s; }
.detail-item:nth-child(11) { animation-delay: 1.1s; }
.detail-item:nth-child(12) { animation-delay: 1.2s; }

/* Efeito de hover nos detalhes */
.detail-item:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.3);
}

.detail-item > div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}

.detail-item-img {
    width: 28px;
    height: 28px;
}

/* Estilização da seção de previsão */
.forecast-container {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    text-align: center;
}

.forecast-container h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.forecast-list {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.forecast-item {
    background: rgba(255, 255, 255, 0.3);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    width: 100px;
    font-size: 14px;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInForecast 0.5s ease-out forwards;
}

/* Aplica um delay progressivo para cada item da previsão */
.forecast-item:nth-child(1) { animation-delay: 1.3s; }
.forecast-item:nth-child(2) { animation-delay: 1.4s; }
.forecast-item:nth-child(3) { animation-delay: 1.5s; }
.forecast-item:nth-child(4) { animation-delay: 1.6s; }
.forecast-item:nth-child(5) { animation-delay: 1.7s; }

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

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

/* Estilização das bolinhas do loader */
.dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin: 0 5px;
    animation: bounce 0.6s infinite alternate;
}

/* Degradês suaves para as bolinhas */
.dot1 {
    background: linear-gradient(45deg, #ff9a8b, #ff6a88);
}

.dot2 {
    background: linear-gradient(45deg, #f0c27b, #4b1248);
}

.dot3 {
    background: linear-gradient(45deg, #a1c4fd, #c2e9fb);
}

/* Animação de fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animação de fade-in */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Animação de entrada */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação de entrada para os detalhes */
@keyframes fadeInDetails {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação de entrada para os itens da previsão */
@keyframes fadeInForecast {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animação das bolinhas */
@keyframes bounce {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-15px);
    }
    100% {
        transform: translateY(0);
    }
}

/* Animação com delays diferentes */
.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.3s;
}

.dot:nth-child(3) {
    animation-delay: 0.6s;
}

/* 🔹 Ajustes para responsividade */
@media (max-width: 850px) {
    body {
        height: inherit;
        padding: 20px 0;
    }
    
    .weather-card {
        padding: 15px;
    }

    .details {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .search-container {
        top: 1rem;
    }

    .details {
        grid-template-columns: repeat(1, 1fr);
    }

    .temperature {
        font-size: 36px;
    }

    .weather-header {
        font-size: 12px;
    }
}