﻿/* =============================================
   PREVISAO DO TEMPO - tempo.css
   Estilos exclusivos da secao #previsao-tempo
   ============================================= */

.previsao-tempo {
  padding: 110px 64px;
  background: var(--white);
  border-top: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
}

/* Cabecalho */
.tempo-header { text-align: center; margin-bottom: 52px; }
.tempo-header h2 { font-family: 'Playfair Display', serif; font-size: clamp(1.8rem,3vw,2.4rem); color: var(--green-dark); font-weight: 700; margin: 8px 0 14px; }
.tempo-sub { font-size: 12px; color: var(--text-muted); letter-spacing: 0.4px; margin: 0; }

/* Corpo: card principal centralizado */
.tempo-body {
  max-width: 560px;
  margin: 0 auto 28px;
}

/* ================================================
   CARD PRINCIPAL - fundo escuro com destaque
   ================================================ */
.tempo-atual-card {
  background: linear-gradient(145deg, #00361c 0%, #0b5e11 100%);
  border-radius: 16px;
  padding: 28px 26px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 36px rgba(0, 54, 28, 0.28);
}
.tempo-atual-card::before {
  content: '';
  position: absolute;
  top: -55px; right: -55px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}
.tempo-atual-card::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -45px;
  width: 250px; height: 250px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
  pointer-events: none;
}

/* Header: cidade + badge dia/noite */
.tempo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  position: relative;
  z-index: 1;
}
.tempo-card-city {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  min-width: 0;
}
.tempo-card-city svg { flex-shrink: 0; }
.tempo-card-city-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tempo-card-isday {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.62);
  background: rgba(255,255,255,0.12);
  padding: 4px 11px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Bloco: icone grande + temperatura + condicao */
.tempo-card-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}
.tempo-card-icon {
  width: 80px; height: 80px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.22));
}
.tempo-card-icon svg { width: 80px; height: 80px; }
.tempo-card-temp-row {}
.tempo-card-temp-val {
  font-family: 'Playfair Display', serif;
  font-size: 4rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.tempo-card-deg { font-size: 1.9rem; font-weight: 400; opacity: 0.82; }
.tempo-card-cond { font-size: 15px; color: rgba(255,255,255,0.88); margin-top: 6px; font-weight: 500; }
.tempo-card-sens { font-size: 12px; color: rgba(255,255,255,0.56); margin-top: 3px; }

/* Grade 2x2 de detalhes */
.tempo-card-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 18px;
  position: relative;
  z-index: 1;
}
.tempo-card-det { display: flex; align-items: center; gap: 9px; }
.tempo-card-det-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.10);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tempo-card-det-icon svg { width: 15px; height: 15px; }
.tempo-card-det-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tempo-card-det-label { font-size: 9px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: rgba(255,255,255,0.48); }
.tempo-card-det-val { font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.92); white-space: nowrap; }

/* Card de permissao negada */
.tempo-permission-card {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 12px;
  padding: 44px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.tempo-permission-icon {
  width: 52px; height: 52px;
  background: rgba(11,94,17,0.08);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tempo-permission-icon svg { width: 22px; height: 22px; stroke: var(--green-main); }
.tempo-permission-txt { font-size: 13px; color: var(--text-muted); line-height: 1.6; max-width: 240px; }

/* ================================================
   FAIXA 7 DIAS
   ================================================ */
.tempo-week {
  max-width: 1120px;
  margin: 4px auto 0;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

/* Card individual de dia */
.tempo-week-card {
  background: var(--cream);
  border: 1px solid var(--cream-dark);
  border-radius: 10px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: default;
}
.tempo-week-card:hover {
  box-shadow: 0 4px 18px rgba(0,0,0,0.09);
  transform: translateY(-2px);
}
/* Hoje: destaque sutil */
.tempo-week-card.today {
  background: rgba(11, 94, 17, 0.055);
  border-color: var(--green-main);
  border-top-width: 3px;
}

/* Topo: nome do dia + data */
.twc-top { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-bottom: 8px; }
.twc-dia { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--green-dark); }
.twc-dia.today { color: var(--green-main); }
.twc-data { font-size: 10px; color: var(--text-muted); }

/* Icone */
.twc-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.twc-icon svg { width: 40px; height: 40px; }

/* Temperaturas max/min */
.twc-temps { display: flex; align-items: baseline; gap: 3px; margin-bottom: 9px; }
.twc-max { font-size: 15px; font-weight: 700; color: var(--green-dark); }
.twc-sep { font-size: 12px; color: var(--cream-dark); }
.twc-min { font-size: 13px; color: var(--text-muted); }

/* Grade de detalhes (chuva, vento, ET0) */
.twc-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid rgba(0,0,0,0.07);
  padding-top: 8px;
  margin-bottom: 8px;
}
.twc-det-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.twc-det-icon { width: 10px; height: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.twc-det-icon svg { width: 10px; height: 10px; }
.twc-det-val { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Nascer e por do sol */
.twc-sun {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-top: 1px solid rgba(0,0,0,0.07);
  padding-top: 7px;
}
.twc-sun-row { display: flex; align-items: center; gap: 4px; }
.twc-sun-icon { width: 10px; height: 10px; flex-shrink: 0; display: flex; align-items: center; }
.twc-sun-icon svg { width: 10px; height: 10px; }
.twc-sun-time { font-size: 10px; color: var(--text-muted); }

/* Skeleton loading */
.tempo-skel {
  height: 220px;
  background: linear-gradient(90deg, var(--cream-dark) 25%, rgba(0,0,0,0.05) 50%, var(--cream-dark) 75%);
  background-size: 200% 100%;
  animation: tempo-shimmer 1.5s infinite;
  border-radius: 12px;
}
.tempo-skel-week { height: 180px; border-radius: 10px; }
@keyframes tempo-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Erro generico */
.tempo-error { text-align: center; font-size: 12px; color: var(--text-muted); margin-top: 28px; font-style: italic; }

/* ================================================
   RESPONSIVO
   ================================================ */
/* Tablet: scroll horizontal antecipado para caber os 7 cards */
@media (max-width: 960px) {
  .previsao-tempo { padding: 80px 32px; }
  .tempo-week {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* esconde a scrollbar visual sem perder funcionalidade */
    scrollbar-width: none;
  }
  .tempo-week::-webkit-scrollbar { display: none; }
  .tempo-week-card {
    flex: 0 0 152px;
    scroll-snap-align: start;
  }
}
@media (max-width: 600px) {
  .previsao-tempo { padding: 80px 20px; }
  .tempo-body { max-width: 100%; }
  .tempo-card-temp-val { font-size: 3.4rem; }
  .tempo-week-card { flex: 0 0 145px; }
}

/* ================================================
   INDICADOR DE CARREGAMENTO (subtitulo pulsante)
   ================================================ */
#tempo-sub[data-loading] {
  animation: tempo-sub-pulse 1.4s ease-in-out infinite;
}
@keyframes tempo-sub-pulse {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 0.20; }
}

/* Mensagem de erro inline por secao */
.tempo-error-inline {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 32px 0;
}

/* Rodape: atribuicao da fonte */
.tempo-fonte {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 24px;
  letter-spacing: 0.2px;
  opacity: 0.75;
}
.tempo-fonte a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* === TEMPO â€” MOBILE (<= 768px) === */
@media (max-width: 768px) {

  /* 1. Secao: padding lateral compacto */
  .previsao-tempo { padding: 80px 24px; }

  /* 1. Card principal: 100% largura disponivel, padding interno reduzido */
  .tempo-body       { max-width: 100%; }
  .tempo-atual-card { padding: 22px 18px; }

  /* 3. Grade de detalhes: 2 colunas (ja definido no base, confirmado e compactado) */
  .tempo-card-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* 4. Fontes de temperatura: proporcional ao mobile */
  .tempo-card-temp-val { font-size: 3rem; }
  .tempo-card-deg      { font-size: 1.5rem; }
  .tempo-card-cond     { font-size: 14px; }

  /* 2. Faixa 7 dias: scroll horizontal habilitado (reforco do 960px) */
  .tempo-week {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding-bottom: 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tempo-week::-webkit-scrollbar { display: none; }

  /* 2. Card de dia: largura minima fixa de 140px para legibilidade */
  .tempo-week-card {
    flex: 0 0 140px;
    min-width: 140px;
    scroll-snap-align: start;
  }
}