/* ==========================================================================
   TRANG CHI TIẾT THÀNH PHỐ (chỉ nạp trên template-city.php)
   .forecast-tabs, .weather-hourly, .weather-daily, .weather-detail, .sun-times
   ========================================================================== */

/* --------------------------------------------------------------------------
   Forecast tabs — Tổng quan / Theo giờ / 7 ngày ...
   -------------------------------------------------------------------------- */

.forecast-tabs {
  position: relative; /* mốc offsetLeft cho JS cuộn tab đang chọn */
  padding: 8px;
  overflow-x: auto;
  background: linear-gradient(135deg, #1E4C8A 0%, #2A5FA8 100%);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(16, 36, 58, 0.12);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.forecast-tabs::-webkit-scrollbar {
  display: none;
}

.forecast-tabs__item {
  flex: 1 0 auto;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none !important;
  transition: background 0.2s, color 0.2s;
}

.forecast-tabs__item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.forecast-tabs__item--active,
.forecast-tabs__item--active:hover {
  background: #3B8CF0;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* --------------------------------------------------------------------------
   Weather hourly — thanh trượt 24 giờ
   -------------------------------------------------------------------------- */

.weather-hourly {
  gap: 6px;
  overflow-x: auto;
  padding: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.weather-hourly__item {
  gap: 6px;
  width: 80px;
  padding: 16px 4px 14px;
  border-radius: 14px;
  scroll-snap-align: start;
  transition: background 0.2s;
}

.weather-hourly__item:hover,
.weather-hourly__item--now {
  background: var(--color-hover-strong);
}

.weather-hourly__time {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-subtext);
}

.weather-hourly__icon {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
}

.weather-hourly__temp {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.weather-hourly__pop {
  min-height: 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   Weather daily — danh sách 14 ngày
   -------------------------------------------------------------------------- */

.weather-daily {
  overflow: hidden;
  margin-top: 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.weather-daily__row {
  grid-template-columns: 140px 48px 1fr 60px 45px 120px 45px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--color-border-soft);
  font-size: 14.5px;
}

.weather-daily__row:last-child {
  border-bottom: none;
}

.weather-daily__name {
  font-weight: 600;
}

.weather-daily__date {
  font-size: 12.5px;
  color: var(--color-subtext);
}

.weather-daily__icon {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
}

.weather-daily__condition {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--color-text-muted);
}

.weather-daily__pop {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary);
}

.weather-daily__min {
  font-variant-numeric: tabular-nums;
  color: var(--color-subtext);
}

.weather-daily__max {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Thanh dải nhiệt độ: vị trí/độ dài nhận từ biến CSS --bar-start / --bar-size (tính bằng PHP) */
.weather-daily__bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--color-border-soft);
}

.weather-daily__bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--bar-start, 0%);
  width: var(--bar-size, 100%);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-accent), #FFB020);
}

@media (max-width: 768px) {
  .weather-daily__row {
    grid-template-columns: 110px 40px 1fr 40px 40px;
    gap: 8px !important;
    padding: 12px 14px;
  }

  .weather-daily__bar,
  .weather-daily__condition {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Weather detail — lưới 6 chỉ số (độ ẩm, gió, UV, AQI, áp suất, tầm nhìn)
   -------------------------------------------------------------------------- */

.weather-detail {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.weather-detail__card {
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.weather-detail__head {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-subtext);
}

.weather-detail__icon {
  width: 20px;
  height: 20px;
  opacity: 0.75;
}

.weather-detail__value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-dark);
}

.weather-detail__unit {
  font-size: 14px;
  font-weight: 400;
}

.weather-detail__sub {
  font-size: 12.5px;
  color: var(--color-subtext);
}

/* Màu theo cấp độ (key từ ttw_get_uv_info / ttw_get_aqi_info) */
.weather-detail__value--low,
.weather-detail__value--good      { color: var(--color-level-1); }
.weather-detail__value--moderate  { color: var(--color-level-2); }
.weather-detail__value--high,
.weather-detail__value--poor      { color: var(--color-level-3); }
.weather-detail__value--very-high,
.weather-detail__value--unhealthy { color: var(--color-level-4); }
.weather-detail__value--extreme   { color: var(--color-level-5); }
.weather-detail__value--hazardous { color: var(--color-level-hazard); }

/* --------------------------------------------------------------------------
   Sun times — mặt trời mọc / lặn / độ dài ngày
   -------------------------------------------------------------------------- */

.sun-times {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.sun-times__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #FFF7ED;
  padding: 4px;
}

.sun-times__label {
  font-size: 13px;
  color: var(--color-subtext);
}

.sun-times__time {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-dark);
}

/* --------------------------------------------------------------------------
   Weather table — bảng theo giờ (/theo-gio/) & cùng kỳ năm trước (/30-ngay-toi/)
   -------------------------------------------------------------------------- */

.weather-table {
  overflow-x: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.weather-table__table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14.5px;
}

.weather-table__table th,
.weather-table__table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border-soft);
  text-align: left;
  white-space: nowrap;
}

.weather-table__table thead th {
  background: var(--color-surface-alt);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-subtext);
}

.weather-table__group th {
  background: var(--color-tint);
  font-weight: 700;
  color: var(--color-dark);
}

.weather-table__row--now {
  background: var(--color-hover-strong);
}

.weather-table__time {
  font-weight: 600;
}

.weather-table__icon {
  width: 44px;
  padding-right: 0 !important;
}

.weather-table__icon img {
  display: block;
  width: 32px;
  height: 32px;
}

.weather-table__cond {
  white-space: normal !important;
  color: var(--color-text-muted);
}

.weather-table__temp {
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Day periods — 4 buổi trong ngày (/ngay-mai/, /3-ngay-toi/)
   -------------------------------------------------------------------------- */

.day-periods {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.day-periods__item {
  padding: 16px 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.day-periods__label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-primary);
}

.day-periods__icon {
  width: 52px;
  height: 52px;
}

.day-periods__temp {
  font-size: 18px;
  font-weight: 700;
}

.day-periods__cond {
  font-size: 13.5px;
  color: var(--color-text-muted);
}

.day-periods__pop {
  font-size: 12.5px;
  color: var(--color-subtext);
}

.day-block__title {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.day-block__summary {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-subtext);
}

/* --------------------------------------------------------------------------
   Day card — thẻ chi tiết 1 ngày (/ngay-mai/, /5-ngay-toi/, /7-ngay-toi/)
   -------------------------------------------------------------------------- */

.day-card {
  padding: 18px 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.day-card__icon {
  width: 56px;
  height: 56px;
}

.day-card__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.day-card__date {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-subtext);
}

.day-card__cond {
  font-size: 14px;
  color: var(--color-text-muted);
}

.day-card__max {
  font-size: 24px;
  font-weight: 700;
}

.day-card__min {
  margin-left: 6px;
  font-size: 18px;
  color: var(--color-subtext);
}

.day-card__stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--color-border-soft);
}

.day-card__stats dt {
  font-size: 12.5px;
  color: var(--color-subtext);
}

.day-card__stats dd {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
}

@media (max-width: 767px) {
  .day-periods,
  .day-card__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .day-card__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --------------------------------------------------------------------------
   Page head — tiêu đề gọn của trang con (thay cho banner lớn)
   -------------------------------------------------------------------------- */

.page-head {
  padding: 24px 0 4px;
}

.page-head__title {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-head__now {
  padding: 6px 14px 6px 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 14.5px;
  color: var(--color-text-muted);
  text-decoration: none !important;
}

.page-head__now:hover {
  border-color: var(--color-border-hover);
  color: var(--color-dark);
}

.page-head__icon {
  width: 32px;
  height: 32px;
}

.page-head__sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--color-subtext);
}

/* --------------------------------------------------------------------------
   Xã / phường — danh sách trên trang tỉnh & thông tin hành chính trên trang xã
   -------------------------------------------------------------------------- */

.commune-list {
  columns: 4 200px;
  column-gap: 24px;
  padding: 18px 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.commune-list__link {
  display: block;
  padding: 5px 0;
  font-size: 14.5px;
  break-inside: avoid;
}

.info-list {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin: 0;
  padding: 18px 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.info-list dt {
  font-size: 13px;
  color: var(--color-subtext);
}

.info-list dd {
  margin: 2px 0 0;
  font-size: 15.5px;
  font-weight: 600;
}

/* Chất lượng không khí: thẻ chỉ số (màu theo mức) */
.aqi-card {
  height: 100%;
  padding: 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 5px solid var(--aqi-color, var(--color-primary));
  border-radius: var(--radius-md);
}

.aqi-card__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-subtext);
}

.aqi-card__value {
  margin: 6px 0;
  font-size: 30px;
  font-weight: 700;
  color: var(--color-dark);
}

.aqi-card__band {
  margin-left: 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--aqi-color, var(--color-primary));
}

.aqi-card__text {
  margin: 0;
  font-size: 14px;
  color: var(--color-text-muted);
}
