/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

/* --- 1. CORES E VARIÁVEIS PRINCIPAIS --- */
:root {
    /* Cores Principais */
    --primary-color: #5995bd;
    --primary-color-hover: #34699A;
    --secondary-color: #31387c;
    
    /* Cores de Texto */
    --text-color-dark: #333333;
    --text-color-light: #666666;
    --text-color-white: #ffffff;
    --text-color-grayish: rgb(73, 73, 73);

    /* Cores de Fundo */
    --background-gradient: linear-gradient(to right top, #ffd1a4, #ffb7b7, #e6a6d0, #b9a1e0, #9bb8e5);
    --card-background-light: rgba(255, 255, 255, 0.2);
    --card-border-light: rgba(255, 255, 255, 0.3);

    /* Cores de Status */
    --status-good: #63d167;
    --status-standard: #FFDE63;
    --status-hazardous: #f56258;
    
    /* Outras Cores */
    --uv-index-color: #9C27B0;
    --shadow-color: rgba(31, 38, 135, 0.1);
}

/* --- 2. ESTILOS GERAIS E LAYOUT BASE --- */
body {
    font-family: 'Poppins', sans-serif;
    background: var(--background-gradient);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    background-color: transparent;
    padding: 20px;
    border-radius: 20px;
    box-shadow: none;
    max-width: 1200px;
    width: 100%;
}

.main-content {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
}

/* --- 3. ESTILOS DA TELA DE LOGIN --- */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--background-gradient);
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
}

.login-input-group {
    display: flex;
    width: 100%;
}


.login-card {
    background: var(--card-background-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--card-border-light);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.login-card h2 { color: var(--primary-color); margin-bottom: 20px; }
.login-card p { color: var(--text-color-dark); margin-bottom: 25px; }

#userNameInput {
    flex-grow: 1; /* Faz o input ocupar o espaço disponível */
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px 0 0 10px; /* Arredonda apenas os cantos esquerdos */
    font-size: 1rem;
    border-right: none; /* Remove a borda direita para se juntar ao botão */
}

#enterDashboardBtn {
    padding: 12px 25px;
    background-color: var(--primary-color);
    color: var(--text-color-white);
    border: none;
    border-radius: 0 10px 10px 0; /* Arredonda apenas os cantos direitos */
    cursor: pointer;
    font-size: 1rem; /* Ajustado para corresponder ao input */
    font-weight: 500;
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* Impede que o botão encolha */
}

#enterDashboardBtn:hover { background-color: var(--primary-color-hover); }

.hidden { display: none !important; }

/* --- 4. ESTILOS DOS CARDS E CABEÇALHO --- */
.card, .dashboard-header {
    background: var(--card-background-light);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--card-border-light);
    box-shadow: 0 8px 32px 0 var(--shadow-color);
    padding: 20px;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
}

.card h3 {
    color: var(--text-color-dark);
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 15px;
}

/* Layout dos Cards na Grelha */
.dashboard-header { grid-column: 1 / -1; }
.weather-summary { grid-column: span 7; }
.recommendation-card { grid-column: span 5; }
.temperature-today { grid-column: span 12; }
.air-quality, .sun-info, .uv-index, .weather-prediction { grid-column: span 3; }

/* --- 5. COMPONENTES INTERNOS DOS CARDS --- */
/* Cabeçalho */
.dashboard-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
}
.dashboard-header .user-info { grid-column: 1; display: flex; align-items: center; gap: 15px; }
.dashboard-header .user-info .avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.dashboard-header .user-info h2 { margin: 0; font-size: 1.5rem; color: var(--text-color-dark); }
.dashboard-header .user-info p { margin: 0; color: var(--text-color-light); }
.dashboard-header .search-bar { grid-column: 3; display: flex; gap: 10px; }
.dashboard-header .search-bar input { padding: 10px 15px; border: 1px solid var(--border-color); border-radius: 10px; font-size: 1rem; width: 250px; }
.dashboard-header .search-bar button { padding: 10px 15px; background-color: var(--primary-color); color: var(--text-color-white); border: none; border-radius: 10px; cursor: pointer; font-size: 1rem; transition: background-color 0.3s ease; }
.dashboard-header .search-bar button:hover { background-color: var(--primary-color-hover); }

/* Card de Clima */
.weather-summary { justify-content: space-between; }
.weather-result { background-color: transparent; box-shadow: none; padding: 0; margin-top: 0; }
.weather-main-info { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.weather-main-info .temperature { font-size: 3rem; font-weight: 700; color: var(--primary-color); margin: 0; }
.weather-main-info .description { font-size: 1.2rem; color: var(--text-color-light); margin: 0; }
.weather-details { display: flex; justify-content: space-around; margin-top: 20px; border-top: 1px solid var(--card-border-light); padding-top: 20px; }
.detail-item { text-align: center; }
.detail-item p:first-child { font-size: 0.9rem; color: var(--text-color-light); margin-bottom: 5px; }
.detail-item p:last-child { font-size: 1.1rem; font-weight: 600; color: var(--text-color-dark); margin-top: 0; }

/* Card de Recomendação */
.recommendation { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; height: 100%; gap: 15px; }
.recommendation img { max-width: 200px; max-height: 200px; }
.recommendation p { font-size: 1.1rem; font-weight: 500; color: var(--secondary-color); margin: 0; }

/* Card de Qualidade do Ar */
.air-quality .air-data { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.air-quality .aqi { font-size: 2.5rem; font-weight: 700; color: var(--secondary-color); }
.air-quality .wind { font-size: 1rem; color: var(--text-color-light); }
.air-quality .aqi-status { display: flex; justify-content: space-around; margin-top: 15px; }
.air-quality .aqi-status span { padding: 5px 10px; border-radius: 5px; font-size: 0.8rem; font-weight: 600; color: var(--text-color-grayish); }
.air-quality .aqi-status .good { background-color: var(--status-good); }
.air-quality .aqi-status .standard { background-color: var(--status-standard); }
.air-quality .aqi-status .hazardous { background-color: var(--status-hazardous); }

/* Card do Sol */
.sun-info { text-align: center; }
.sun-info .sun-chart img { max-width: 40%; height: auto; margin-bottom: 15px; }
.sun-info .sun-times { display: flex; justify-content: space-around; font-size: 0.9rem; color: var(--text-color-light); }

/* Card de Índice UV */
.uv-index { text-align: center; }
.uv-index .uv-data { margin-top: 15px; }
.uv-index .uv-value { font-size: 2.5rem; font-weight: 700; color: var(--uv-index-color); }
.uv-index .uv-risk { font-size: 1rem; color: var(--text-color-light); display: block; margin-top: 5px; }

/* Card de Previsão do Tempo */
#weatherPredictionList { padding: 0; margin-top: 15px; display: flex; justify-content: space-around; text-align: center; }
.summary-forecast-item { list-style: none; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 0.9rem; }
.summary-forecast-item img { width: 40px; height: 40px; }
.summary-forecast-item .day-name { font-weight: 600; text-transform: capitalize; }
.summary-forecast-item .temps { font-weight: 500; }
.weather-prediction .next-days-btn { background-color: var(--primary-color); color: var(--text-color-white); border: none; border-radius: 10px; padding: 10px 15px; margin-top: 20px; cursor: pointer; font-size: 1rem; transition: background-color 0.3s ease; }
.weather-prediction .next-days-btn:hover { background-color: var(--primary-color-hover); }

/* Card de Temperatura Hoje */
.temperature-today .temp-times { display: flex; justify-content: space-around; font-size: 0.9rem; color: var(--text-color-light); }

/* --- 6. MODAIS E ESTILOS DE COMPONENTES ADICIONAIS --- */
/* Modal Genérico */
.modal { display: flex; position: fixed; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.4); justify-content: center; align-items: center; }
.modal-content { background: var(--card-background-light); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border: 1px solid var(--card-border-light); box-shadow: 0 8px 32px 0 var(--shadow-color); margin: auto; padding: 30px; border-radius: 20px; width: 80%; max-width: 700px; position: relative; text-align: center; }
.modal-content h2 { color: #1a4765; margin-bottom: 20px; }
.close-button { color: var(--text-color-light); font-size: 28px; font-weight: bold; position: absolute; top: 15px; right: 25px; cursor: pointer; }

/* Modal de Previsão para 5 Dias */
#five-day-forecast-modal .modal-content { max-width: 900px; }
#five-day-forecast-content { display: flex; overflow-x: auto; gap: 15px; margin-top: 20px; padding-bottom: 15px; }
.forecast-day-card { background: var(--card-background-light); padding: 15px; border-radius: 10px; text-align: center; border: 1px solid var(--card-border-light); flex-shrink: 0; width: 140px; }

/* Barra de Rolagem do Modal */
#five-day-forecast-content { scrollbar-width: thin; scrollbar-color: var(--primary-color-hover) rgba(255, 255, 255, 0.1); } /* Firefox */
#five-day-forecast-content::-webkit-scrollbar { height: 10px; }
#five-day-forecast-content::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
#five-day-forecast-content::-webkit-scrollbar-thumb { background-color: var(--primary-color); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
#five-day-forecast-content::-webkit-scrollbar-thumb:hover { background-color: var(--primary-color-hover); }

/* --- 7. MODO ESCURO (DARK THEME) --- */
body.dark-theme {
    --text-color-dark: #f0f0f0;
    --text-color-light: #cccccc;
    --border-color: #555555;
    --background-gradient: linear-gradient(to right top, #0f2027, #203a43, #2c5364);
    --card-background-light: rgba(42, 42, 42, 0.25);
    --card-border-light: rgba(255, 255, 255, 0.18);
}

/* --- 8. RESPONSIVIDADE --- */
@media (max-width: 1024px) {
    .main-content { grid-template-columns: 1fr; }
    .weather-summary, .recommendation-card, .temperature-today, .air-quality, .sun-info, .uv-index, .weather-prediction { grid-column: span 1; }
    .dashboard-header { grid-template-columns: 1fr; gap: 15px; }
    .dashboard-header .user-info, .dashboard-header .search-bar { grid-column: 1; }
    .dashboard-header .search-bar { width: 100%; }
    .dashboard-header .search-bar input { width: 100%; }
}