/* =========================================================
   FamilyChat weather forecast popup
   ========================================================= */

body.weather-forecast-popup-open {
  overflow: hidden;
}

.weather-forecast-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: clamp(14px, 3vw, 28px);
  background: rgba(15, 23, 42, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.weather-forecast-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.weather-forecast-sheet {
  position: relative;
  width: min(620px, 100%);
  max-height: min(760px, calc(100dvh - 28px));
  overflow: hidden;
  border-radius: 30px;
  background:
    radial-gradient(circle at 12% 0%, rgba(108, 82, 248, 0.16), transparent 36%),
    rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.22);
  transform: translateY(18px) scale(0.985);
  transition: transform 180ms ease;
}

.weather-forecast-modal.is-open .weather-forecast-sheet {
  transform: translateY(0) scale(1);
}

.weather-forecast-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #344054;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(16, 24, 40, 0.12);
}

.weather-forecast-close:focus-visible,
#friendsTab .overview-weather-pill:focus-visible,
#scheduleTab .calendar-weather-chip:focus-visible {
  outline: 3px solid rgba(108, 82, 248, 0.28);
  outline-offset: 2px;
}

.weather-forecast-content {
  max-height: inherit;
  overflow-y: auto;
  padding: 24px;
  -webkit-overflow-scrolling: touch;
}

.weather-forecast-header {
  display: grid;
  gap: 10px;
  padding-right: 44px;
}

.weather-forecast-eyebrow {
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(108, 82, 248, 0.1);
  color: #5b3ff4;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.weather-forecast-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}

.weather-forecast-title-row h2 {
  margin: 0;
  color: #101828;
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 950;
  letter-spacing: -0.05em;
  line-height: 1.02;
}

.weather-forecast-title-row p {
  margin: 7px 0 0;
  color: #667085;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.weather-forecast-hero-icon {
  width: 66px;
  height: 66px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.84), 0 14px 34px rgba(16, 24, 40, 0.08);
  font-size: 34px;
}

.weather-forecast-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.weather-forecast-summary-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.78);
}

.weather-forecast-summary-card i {
  color: #6c52f8;
  font-size: 14px;
}

.weather-forecast-summary-card span {
  color: #667085;
  font-size: 11px;
  font-weight: 850;
}

.weather-forecast-summary-card strong {
  color: #101828;
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.weather-forecast-detail-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.weather-forecast-detail-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(108, 82, 248, 0.08);
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.weather-forecast-detail-strip i {
  color: #6c52f8;
}

.weather-forecast-hourly-section {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.weather-forecast-hourly-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.weather-forecast-hourly-heading h3 {
  margin: 0;
  color: #101828;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.weather-forecast-hourly-heading span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.weather-forecast-hourly-list {
  display: grid;
  gap: 7px;
}

.weather-forecast-hour-row {
  min-height: 46px;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.72);
}

.weather-forecast-hour-time {
  color: #475467;
  font-size: 12px;
  font-weight: 950;
}

.weather-forecast-hour-condition {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.weather-forecast-hour-condition span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weather-forecast-hour-temp {
  color: #101828;
  font-size: 13px;
  font-weight: 950;
}

.weather-forecast-hour-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #667085;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.weather-forecast-hour-meta i {
  color: #6c52f8;
  font-size: 11px;
}

.weather-forecast-empty,
.weather-forecast-loading-card {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  color: #667085;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.72);
}

.weather-forecast-empty-large {
  min-height: 140px;
}

.weather-forecast-spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid rgba(108, 82, 248, 0.18);
  border-top-color: #6c52f8;
  animation: weatherForecastSpin 850ms linear infinite;
}

#friendsTab .overview-weather-pill,
#scheduleTab .calendar-weather-chip {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@keyframes weatherForecastSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (min-width: 821px) {
  .weather-forecast-modal {
    align-items: center;
  }
}

@media (max-width: 640px) {
  .weather-forecast-modal {
    padding: 10px;
    align-items: flex-end;
  }

  .weather-forecast-sheet {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 28px 28px 22px 22px;
  }

  .weather-forecast-content {
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .weather-forecast-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weather-forecast-hourly-heading {
    align-items: start;
    flex-direction: column;
    gap: 3px;
  }

  .weather-forecast-hour-row {
    grid-template-columns: 54px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .weather-forecast-hour-meta {
    display: none;
  }

  .weather-forecast-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 20px;
    font-size: 28px;
  }
}

body.dark-theme .weather-forecast-sheet {
  background:
    radial-gradient(circle at 12% 0%, rgba(139, 117, 255, 0.22), transparent 36%),
    rgba(20, 24, 36, 0.97);
}

body.dark-theme .weather-forecast-title-row h2,
body.dark-theme .weather-forecast-summary-card strong,
body.dark-theme .weather-forecast-hourly-heading h3,
body.dark-theme .weather-forecast-hour-temp {
  color: #f9fafb;
}

body.dark-theme .weather-forecast-title-row p,
body.dark-theme .weather-forecast-summary-card span,
body.dark-theme .weather-forecast-hour-time,
body.dark-theme .weather-forecast-hour-meta,
body.dark-theme .weather-forecast-empty,
body.dark-theme .weather-forecast-loading-card {
  color: #cbd5e1;
}

body.dark-theme .weather-forecast-close,
body.dark-theme .weather-forecast-hero-icon,
body.dark-theme .weather-forecast-summary-card,
body.dark-theme .weather-forecast-hour-row,
body.dark-theme .weather-forecast-empty,
body.dark-theme .weather-forecast-loading-card {
  background: rgba(30, 41, 59, 0.84);
  box-shadow: inset 0 0 0 1px rgba(71, 85, 105, 0.58);
}
