/* ══════════════════════════════════════════
   Reset & Base
══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: clamp(14px, 1.5vw + 0.5rem, 16px);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(160deg, #7dd3ea 0%, #a8dff0 40%, #c8edf7 100%);
  padding: 16px;
  transition: background 0.6s ease; 

  /* ADICIONE AS DUAS LINHAS ABAIXO */
  position: relative; 
  padding-bottom: 80px;
}

/* ══════════════════════════════════════════
   Card  (base → mobile-first)
══════════════════════════════════════════ */
.card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(60, 130, 180, 0.18);
  padding: 28px 20px 24px;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fadeIn 0.35s ease;
}

.hidden {
  display: none !important;
}

/* ══════════════════════════════════════════
   Search Card & Titulos Principais
══════════════════════════════════════════ */
h1 {
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  font-weight: 700;
  color: #2c4a6e;
  letter-spacing: -0.5px;
  text-align: center;
  line-height: 1.2;
}

/* MUDANÇA: Estilo específico para o título no Result Card */
.result-title {
  margin-bottom: -5px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

input[type="text"] {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: #f0f4f8;
  color: #2c4a6e;
  outline: none;
  transition: box-shadow 0.2s;
  font-size: max(16px, 1rem);
}

input[type="text"]::placeholder {
  color: #a0b4c8;
}

input[type="text"]:focus {
  box-shadow: 0 0 0 2.5px #4a90d9;
}

button#searchBtn {
  width: 100%;
  padding: 13px 26px;
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: clamp(0.9rem, 3vw, 1rem);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  min-height: 48px;
  touch-action: manipulation;
}

button#searchBtn:hover  { background: #3578c0; }
button#searchBtn:active { transform: scale(0.97); }

/* ══════════════════════════════════════════
   Error Box
══════════════════════════════════════════ */
.error-box {
  width: 100%;
  background: #fde8e8;
  border-left: 4px solid #e87070;
  border-radius: 8px;
  padding: 12px 16px;
  color: #c0392b;
  font-size: clamp(0.8rem, 2.8vw, 0.92rem);
  text-align: center;
  word-break: break-word;
}

/* ══════════════════════════════════════════
   Result Card - Topo (Clima Atual)
══════════════════════════════════════════ */
.temp-box {
  background: linear-gradient(135deg, #d6e8f5 0%, #c2dced 100%);
  border-radius: 14px;
  width: 100%;
  padding: clamp(20px, 6vw, 32px) 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px; /* MUDANÇA: Gap ajustado para afastar o ícone dos textos */
}

/* MUDANÇA: Container wrapper para a temperatura e o max/min */
.temp-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

#tempValue {
  font-size: clamp(3rem, 12vw, 4rem); /* MUDANÇA: Leve redução para caber o max/min */
  font-weight: 800;
  color: #2c4a6e;
  line-height: 1;
}

.degree {
  font-size: clamp(1.8rem, 8vw, 2.5rem);
  font-weight: 700;
  color: #2c4a6e;
  align-self: flex-start;
  margin-top: 6px;
}

/* MUDANÇA: Estilo para a Max/Min no painel principal (ex: / 18°) */
.current-minmax {
  font-size: clamp(1.2rem, 5vw, 1.8rem);
  font-weight: 500;
  color: #5b799a;
}

/* MUDANÇA: Agrupador de info central */
.info-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.city-name {
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 700;
  color: #2c4a6e;
  text-align: center;
  word-break: break-word;
}

#weatherDesc {
  text-align: center;
  color: #2c4a6e;
  font-weight: 600;
  font-size: clamp(0.9rem, 3.5vw, 1rem);
}

#dateTime {
  text-align: center;
  color: #7b93ab;
  font-size: clamp(0.8rem, 2.5vw, 0.85rem);
}

#weatherIcon {
  font-size: clamp(3rem, 10vw, 4rem);
  color: #4a90d9;
}

/* ══════════════════════════════════════════
   Nova Seção: Próximos Dias (Forecast)
══════════════════════════════════════════ */
.forecast-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.forecast-title {
  font-size: 1rem;
  font-weight: 700;
  color: #2c4a6e;
  text-align: center;
  margin-bottom: 4px;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* MUDANÇA: Card individual de cada dia */
.forecast-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  border: 1px solid #f0f4f8; /* Borda suave para dar efeito de elevação em fundo branco */
  box-shadow: 0 2px 10px rgba(44, 74, 110, 0.05); /* Sombra suave conforme o mockup */
  border-radius: 12px;
  padding: 12px 16px;
}

.forecast-day-info {
  display: flex;
  flex-direction: column;
  flex: 1; /* Ocupa 1 parte do espaço */
}

.forecast-weekday {
  font-size: 0.85rem;
  font-weight: 700;
  color: #2c4a6e;
}

.forecast-date {
  font-size: 0.75rem;
  color: #7b93ab;
}

.forecast-weather-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1.5; /* Dá mais espaço para a descrição central não quebrar feio */
  text-align: center;
}

.forecast-weather-info i {
  font-size: 1.5rem;
  color: #4a90d9;
  margin-bottom: 4px;
}

.forecast-desc {
  font-size: 0.7rem;
  color: #5b799a;
  line-height: 1.2;
}

.forecast-temps {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: 1;
}

.temp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #2c4a6e;
}

.arrow-up {
  color: #e74c3c;
  font-size: 0.7rem;
}

.arrow-down {
  color: #3498db;
  font-size: 0.7rem;
}

/* ══════════════════════════════════════════
   Botão Home (Atualizado)
══════════════════════════════════════════ */
.home-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #4a90d9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  touch-action: manipulation;
  margin-top: 10px;
}

.home-btn svg {
  width: 22px;
  height: 22px;
}

.home-btn:hover  { background: #3578c0; }
.home-btn:active { transform: scale(0.95); }

/* ══════════════════════════════════════════
   Footer (Avisos Legais)
══════════════════════════════════════════ */
.app-footer {
  position: absolute;
  bottom: 16px;
  left: 0;
  width: 100%;
  text-align: center;
  /* Cor que se mistura bem com fundos claros e escuros */
  color: rgba(44, 74, 110, 0.75); 
  font-size: clamp(0.65rem, 2vw, 0.75rem);
  line-height: 1.4;
  padding: 0 16px;
}

.app-footer p {
  margin-bottom: 4px;
}

.app-footer a {
  color: #4a90d9;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.2s;
}

.app-footer a:hover {
  text-decoration: underline;
  color: #2c4a6e;
}

/* Transição do texto do footer para o modo noturno */
body[style*="#131d2e"] .app-footer {
  color: rgba(255, 255, 255, 0.5);
}

/* ══════════════════════════════════════════
   Animation
══════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════
   BREAKPOINTS
══════════════════════════════════════════ */
@media (min-width: 480px) {
  .card { padding: 32px 28px 28px; gap: 24px; }
  .form-row { flex-direction: row; }
  button#searchBtn { width: auto; }
}

@media (min-width: 600px) {
  .card { padding: 36px 36px 32px; gap: 26px; border-radius: 22px; }
}

@media (min-width: 768px) {
  body { padding: 24px; }
  .card { padding: 40px 44px 36px; gap: 28px; border-radius: 24px; max-width: 500px; }
}

@media (min-width: 1024px) {
  .card { max-width: 480px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  button#searchBtn, .home-btn { transition: none; }
}