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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

/* ==========================================
   CAIXA DE BUSCA E INPUTS (CORRIGIDO)
   ========================================== */

.search-box {
    margin-bottom: 30px;
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95em;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s;
    background-color: #fff;
    appearance: none; /* Remove estilo padrão do select em alguns browsers */
    -webkit-appearance: none;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.15);
}

/* ==========================================
   BOTÃO VERIFICAR CHUVA (CORRIGIDO)
   ========================================== */

.btn-buscar {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: 0.5px;
}

.btn-buscar:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 58, 95, 0.4);
}

.btn-buscar:active {
    transform: translateY(0);
    opacity: 0.9;
}

.btn-buscar:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================
   RESULTADO DO CLIMA
   ========================================== */

.resultado {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none; }

.clima-chuvendo { border-left: 5px solid #1e3a5f; }
.clima-seco { border-left: 5px solid #4a90e2; }
.clima-nublado { border-left: 5px solid #7fb3d5; }

.icon-clima {
    font-size: 4em;
    text-align: center;
    margin-bottom: 15px;
}

.status-texto {
    text-align: center;
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
}

.detalhes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.detalhe-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detalhe-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.detalhe-valor {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
}

/* ==========================================
   HISTÓRICO
   ========================================== */

.historico {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.historico h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
}

#listaHistorico { list-style: none; }

#listaHistorico li {
    padding: 10px 15px;
    background: #f8f9fa;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

#listaHistorico li:hover { background: #e9ecef; }

.loading {
    text-align: center;
    padding: 20px;
    color: #1e3a5f;
    font-size: 1.2em;
}

.error {
    background: #fee;
    border-left: 5px solid #ff4444;
    padding: 15px;
    border-radius: 10px;
    color: #c33;
}

/* ==========================================
   PREVISÃO EM LISTA VERTICAL
   ========================================== */

.previsao-lista {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.linha-prev {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #f0f0f0;
}

.linha-prev:last-child { border-bottom: none; }

.nome-dia {
    width: 40px;
    font-size: 0.9em;
    font-weight: 700;
    color: #1e3a5f;
    text-transform: uppercase;
}

.icon-prev {
    width: 40px;
    height: 40px;
}

.desc-prev {
    flex: 1;
    font-size: 0.85em;
    color: #666;
    padding: 0 10px;
    text-align: left;
}

.temps-prev {
    display: flex;
    gap: 10px;
    min-width: 60px;
    justify-content: flex-end;
}

.max { font-weight: 700; color: #333; font-size: 1em; }
.min { color: #888; font-size: 0.9em; }

/* ==========================================
   RODAPÉ
   ========================================== */

footer {
    text-align: center;
    padding: 25px 20px;
    color: #555;
    font-size: 0.9em;
    background: #f0f4f8;
    border-top: 2px solid #e0e0e0;
}

footer p { margin-bottom: 8px; }

.footer-links {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
}

.footer-links a {
    color: #1e3a5f;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: #2c5282;
    text-decoration: underline;
}

/* ==========================================
   RESPONSIVIDADE MOBILE
   ========================================== */

@media (max-width: 480px) {
    header h1 { font-size: 1.5em; }
    main { padding: 20px; }
    .icon-clima { font-size: 3em; }
    .status-texto { font-size: 1.2em; }
    footer { font-size: 0.8em; padding: 20px 15px; }
    .footer-links a { display: inline-block; margin: 3px 0; }
    
    .nome-dia { width: 35px; font-size: 0.8em; }
    .icon-prev { width: 35px; height: 35px; }
    .desc-prev { font-size: 0.75em; padding: 0 5px; }
    .max { font-size: 0.9em; }
    .min { font-size: 0.8em; }
}