/* ==============================
   VARIÁVEIS DO PROJETO
================================= */

:root {
  --text-primary: #ffffff;
  --text-secondary: #b8d0e8;
  --glass-background: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.15);
  --border-radius: 24px;
}

/* ==============================
   CONFIGURAÇÕES GERAIS
================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  color: var(--text-primary);

  background:
    radial-gradient(
      ellipse at 80% 0%,
      rgba(91, 163, 224, 0.35),
      transparent 55%
    ),
    linear-gradient(160deg, #315d8a 0%, #193b60 45%, #0b192e 100%);

  background-attachment: fixed;

  -webkit-font-smoothing: antialiased;
}

.app-container,
.app-header,
.app-footer {
  max-width: 900px;
}

/* ==============================
   CABEÇALHO
================================= */

.brand {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -1.5px;
}

.brand i {
  font-size: 1.5rem;
  margin-right: 6px;
}

.brand span {
  color: #8acbff;
}

.location {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.location i {
  margin-right: 4px;
}

/* ==============================
   CLIMA ATUAL
================================= */

.current-weather {
  padding: 35px 0 45px;
}

.location-label {
  font-size: 0.7rem;
  letter-spacing: 2.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.current-weather h1 {
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -1.5px;
  margin-bottom: 12px;
}

.weather-icon {
  font-size: 4.8rem;
  color: #ffe19c;

  filter: drop-shadow(0 0 24px rgba(255, 215, 128, 0.25));
}

.temperature {
  font-size: clamp(5rem, 12vw, 7.5rem);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: -6px;
}

.description {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 10px 0 6px;
}

.temperature-range {
  color: var(--text-secondary);
  font-size: 1rem;
}

.last-update {
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

#error-message {
  color: #ffd1d1;
}

/* ==============================
   GLASSMORPHISM
================================= */

.glass-card {
  background: var(--glass-background);

  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);

  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);

  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  padding: 22px;

  transition:
    background 0.25s ease,
    transform 0.25s ease;
}

.card-label {
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 18px;
}

.card-label i {
  margin-right: 5px;
}

/* ==============================
   INDICADORES
================================= */

.metric-card {
  height: 100%;
  min-height: 155px;
}

.metric-value {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 400;
  letter-spacing: -1.5px;
}

.metric-description {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 8px 0 0;
}

@media (hover: hover) {
  .metric-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.14);
  }
}

/* ==============================
   PREVISÃO SEMANAL
================================= */

.forecast-card {
  width: 100%;
  min-width: 0;
}

.forecast-placeholder {
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0;
}

/* Estrutura de cada dia */

.forecast-row {
  display: grid;

  grid-template-columns: 50px 44px 36px minmax(0, 1fr) 36px;

  align-items: center;
  gap: 14px;

  min-height: 62px;
  padding: 12px 0;

  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.forecast-day {
  font-size: 1rem;
  font-weight: 500;
}

/* Condições meteorológicas */

.forecast-condition {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.forecast-icon {
  font-size: 1.7rem;
  line-height: 1.2;
}

.forecast-icon.sunny {
  color: #ffe19c;
}

.forecast-icon.rainy {
  color: #a5d8ff;
}

.forecast-icon.cloudy {
  color: #dce6ef;
}

.forecast-rain {
  font-size: 0.7rem;
  font-weight: 600;
  color: #7dd3fc;
  margin-top: 3px;
}

/* Temperaturas */

.forecast-min,
.forecast-max {
  font-size: 1.05rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.forecast-min {
  color: var(--text-secondary);
  text-align: right;
}

.forecast-max {
  text-align: right;
}

/* Barra de amplitude térmica */

.range-track {
  position: relative;

  height: 6px;
  width: 100%;

  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
}

.range-fill {
  position: absolute;

  top: 0;
  height: 100%;

  border-radius: inherit;

  background: linear-gradient(90deg, #63c9f0, #e4de8b, #ffb768);
}

/* Temperatura atual */

.current-temp-dot {
  position: absolute;

  top: 50%;
  transform: translate(-50%, -50%);

  width: 10px;
  height: 10px;

  border-radius: 50%;
  background: #ffffff;

  border: 2px solid #294c70;

  z-index: 1;
}

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

.app-footer {
  padding-top: 35px;
  padding-bottom: 25px;
  color: var(--text-secondary);
  font-size: 0.75rem;
}

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

.app-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

@media (max-width: 576px) {
  .app-container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .current-weather {
    padding: 20px 0 35px;
  }

  .glass-card {
    padding: 16px;
    border-radius: 20px;
  }

  .card-label {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
  }

  .forecast-row {
    gap: 8px;
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glass-card {
    transition: none;
  }

  .metric-card:hover {
    transform: none;
  }
}

/* ==============================
   REFINAMENTO DA INTERFACE
================================= */

.app-container,
.app-header,
.app-footer {
  max-width: 1100px;
}

.current-weather {
  padding: 20px 0 30px;
}

.current-weather h1 {
  font-weight: 400;
  margin-bottom: 8px;
}

.weather-icon {
  font-size: 3.8rem;
  line-height: 1;
  margin: 12px 0;
}

.temperature {
  font-size: clamp(4.5rem, 10vw, 6.5rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: -5px;
}

.description {
  font-weight: 400;
  margin-top: 12px;
}

.last-update:empty,
#error-message:empty {
  display: none;
}

.glass-card {
  background: rgba(255, 255, 255, 0.07);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  border: 1px solid rgba(255, 255, 255, 0.12);

  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.metric-card {
  min-height: 130px;
}

.card-label {
  margin-bottom: 12px;
}

.metric-value {
  font-weight: 300;
}

@media (max-width: 576px) {
  .current-weather {
    padding: 15px 0 25px;
  }

  .weather-icon {
    font-size: 3.5rem;
  }

  .metric-card {
    min-height: 120px;
  }

  .metric-description {
    font-size: 0.75rem;
  }

  .description {
    font-size: 0.95rem;
  }

  .forecast-row {
    grid-template-columns: 42px 32px 28px minmax(0, 1fr) 28px;

    gap: 8px;
    min-height: 56px;
  }

  .forecast-day {
    font-size: 0.9rem;
  }

  .forecast-icon {
    font-size: 1.4rem;
  }

  .forecast-min,
  .forecast-max {
    font-size: 0.9rem;
  }

  .forecast-rain {
    font-size: 0.65rem;
  }
}

/* ==============================
   PREVISÃO POR HORA
================================= */

/* ==============================
   PREVISÃO POR HORA
================================= */

.hourly-card {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.hourly-summary {
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;

  padding-bottom: 16px;
  margin-bottom: 16px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Container horizontal */

.hourly-list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;

  width: 100%;
  min-width: 0;
  gap: 12px;

  overflow-x: auto;
  overflow-y: hidden;

  scroll-snap-type: x proximity;

  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;

  padding: 4px 0 12px;
}

.hourly-list:focus-visible {
  outline: 2px solid #8acbff;
  outline-offset: -2px;
  border-radius: 8px;
}

/* Cada horário */

.hourly-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;

  flex: 1 0 64px;
  min-width: 64px;

  gap: 10px;

  scroll-snap-align: start;
}

.hourly-time {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

.hourly-icon {
  font-size: 1.9rem;
  line-height: 1.4;
  color: #ffe19c;

  filter: drop-shadow(0 0 8px rgba(255, 225, 156, 0.15));
}

.hourly-rain {
  font-size: 0.75rem;
  font-weight: 600;
  color: #7dd3fc;
  min-height: 18px;
}

.hourly-temp {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.5px;
}

/* Cores meteorológicas */

.hourly-icon.rainy {
  color: #a5d8ff;
}

.hourly-icon.cloudy {
  color: #dce6ef;
}

.hourly-icon.night {
  color: #e1e8ff;
}

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

@media (max-width: 576px) {
  .hourly-summary {
    font-size: 0.85rem;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .hourly-list {
    gap: 8px;
  }

  .hourly-item {
    flex: 0 0 58px;
    min-width: 58px;
    gap: 8px;
  }

  .hourly-time {
    font-size: 0.8rem;
  }

  .hourly-icon {
    font-size: 1.65rem;
  }

  .hourly-temp {
    font-size: 1.25rem;
  }
}

/* ==============================
   DASHBOARD METEOROLÓGICO
================================= */

.weather-dashboard {
  align-items: stretch;
}

/* Evita que os componentes ultrapassem
   a largura disponível das colunas */

.weather-dashboard > div {
  min-width: 0;
}

/* Grid dos indicadores */

.metrics-grid {
  display: grid;

  grid-template-columns: repeat(2, minmax(0, 1fr));

  gap: 16px;
  height: 100%;
}

.metrics-grid .metric-card {
  display: flex;
  flex-direction: column;

  justify-content: space-between;

  min-height: 130px;
  height: auto;
}

.metric-wide {
  grid-column: 1 / -1;
}

/* ==============================
   DASHBOARD DESKTOP
================================= */

@media (min-width: 992px) {
  .metrics-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }

  .metrics-grid .metric-card {
    padding: 24px;
  }

  .metrics-grid .metric-value {
    font-size: 2.5rem;
    font-weight: 300;
  }

  .metrics-grid .metric-description {
    font-size: 0.85rem;
  }
}

/* ==============================
   DASHBOARD MOBILE
================================= */

@media (max-width: 576px) {
  .metrics-grid {
    gap: 12px;
  }

  .metrics-grid .metric-card {
    min-height: 135px;
    padding: 16px;
  }

  .metrics-grid .metric-value {
    font-size: 1.8rem;
  }
}

/* ==============================
   INDICADORES AVANÇADOS
================================= */

.metric-demo {
  display: block;
  margin-top: 8px;
  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* ==============================
   INDICADOR DE UMIDADE
================================= */

.humidity-indicator {
  margin-top: 20px;
}

.humidity-track {
  position: relative;

  width: 100%;
  height: 32px;

  background: rgba(255, 255, 255, 0.12);

  overflow: hidden;

  -webkit-mask-image: repeating-linear-gradient(
    to right,
    #000 0,
    #000 3px,
    transparent 3px,
    transparent 6px
  );

  mask-image: repeating-linear-gradient(
    to right,
    #000 0,
    #000 3px,
    transparent 3px,
    transparent 6px
  );
}

.humidity-fill {
  height: 100%;

  background: linear-gradient(90deg, #4299e1, #7dd3fc, #a5e5ff);

  transition: width 0.8s ease;
}

.humidity-scale {
  display: flex;
  justify-content: space-between;

  margin-top: 8px;

  font-size: 0.65rem;
  color: var(--text-secondary);
}

/* ==============================
   BÚSSOLA DE VENTO
================================= */

.wind-compass {
  position: relative;

  width: 100%;
  max-width: 180px;

  aspect-ratio: 1 / 1;

  margin: 10px auto;
}

.compass-svg {
  display: block;

  width: 100%;
  height: 100%;

  overflow: visible;
}

.compass-border {
  fill: none;

  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
}

.compass-ticks {
  fill: none;

  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 5;

  stroke-dasharray: 1 5;
}

.compass-labels {
  fill: var(--text-secondary);

  font-size: 11px;
  font-weight: 500;

  text-anchor: middle;
}

.wind-arrow {
  fill: #ffffff;
}

.wind-arrow line {
  stroke: #ffffff;
  stroke-width: 2.5;
  stroke-linecap: round;
}

.compass-center {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;
}

.wind-value {
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1;

  letter-spacing: -2px;
}

.wind-unit {
  font-size: 0.8rem;
  color: var(--text-secondary);

  margin-top: 6px;
}

.wind-info {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: 8px;

  font-size: 0.9rem;
  font-weight: 500;
}

#wind-degrees {
  color: var(--text-secondary);
}

#wind-degrees::before {
  content: "·";
  margin-right: 8px;
}

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

@media (max-width: 576px) {
  .humidity-track {
    height: 24px;
  }

  .humidity-indicator {
    margin-top: 14px;
  }

  .wind-compass {
    max-width: 160px;
  }

  .wind-value {
    font-size: 2.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .humidity-fill {
    transition: none;
  }
}

/* ==============================
   ÍNDICE UV
================================= */

.uv-card {
  min-width: 0;
}

.uv-level {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 4px 0 16px;
}

.uv-indicator {
  margin: 12px 0;
}

.uv-track {
  position: relative;

  width: 100%;
  height: 6px;

  border-radius: 20px;

  background: linear-gradient(
    90deg,
    #43cb85 0%,
    #e4dc4f 27%,
    #f5a34e 45%,
    #f06161 73%,
    #ac6bdf 100%
  );
}

.uv-marker {
  position: absolute;

  top: 50%;

  width: 12px;
  height: 12px;

  transform: translate(-50%, -50%);

  background: #ffffff;
  border: 2px solid #294c70;
  border-radius: 50%;

  box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);

  transition: left 0.6s ease;
}

.uv-scale {
  display: flex;
  justify-content: space-between;

  margin-top: 8px;

  color: var(--text-secondary);
  font-size: 0.7rem;
}

/* ==============================
   TRAJETÓRIA SOLAR
================================= */

.solar-card {
  min-width: 0;
}

.solar-chart {
  margin-top: 16px;
}

.solar-svg {
  display: block;

  width: 100%;
  height: auto;

  overflow: visible;
}

.solar-horizon {
  stroke: rgba(255, 255, 255, 0.3);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.solar-path {
  fill: none;

  stroke: #ffe19c;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.solar-glow {
  fill: #ffe19c;
  opacity: 0.15;
}

.solar-dot {
  fill: #ffe19c;

  filter: drop-shadow(0 0 6px rgba(255, 225, 156, 0.6));
}

.solar-times {
  display: flex;
  justify-content: space-between;

  color: var(--text-secondary);
  font-size: 0.75rem;

  margin-top: -8px;
}

/* ==============================
   REORGANIZAÇÃO DOS INDICADORES
================================= */

@media (min-width: 992px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    grid-auto-rows: auto;
    align-content: start;
  }

  .metrics-grid .metric-card {
    padding: 20px;
  }

  .metrics-grid .metric-value {
    font-size: 2.2rem;
  }

  .wind-card {
    grid-column: 1 / -1;
  }
}

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

@media (max-width: 576px) {
  .uv-level {
    font-size: 0.9rem;
  }

  .solar-times {
    font-size: 0.65rem;
  }

  .solar-chart {
    margin-top: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .uv-marker {
    transition: none;
  }
}
