/* ==========================================================================
   Weather widget (js/weather.js): top-right corner of the home screen,
   mirroring the Wikipedia widget in the top-left corner (requires/wiki.css)
   ========================================================================== */

/* Top-right column: the weather, and under it the holiday countdown (js/countdown.js) */
.top-right-dock {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.weather-widget-wrapper {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
  animation: wikiFadeIn 0.3s ease;
}

.weather-widget-wrapper * {
  text-align: left;
  box-sizing: border-box;
}

.weather-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 12px 16px 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: #0f172a;
}

.weather-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.weather-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.weather-title i {
  color: #04AA6D;
}

.weather-minmax {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.weather-minmax b {
  color: #0f172a;
  font-weight: 800;
}

/* Now: pictogram, temperature + description, details */
.weather-now {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.weather-now-icon {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
}

.weather-now-icon svg,
.weather-hour-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.weather-now-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.weather-now-temp {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.weather-now-desc {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-top: 3px;
  white-space: nowrap;
}

.weather-now-details {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
}

.weather-now-details i {
  width: 16px;
  margin-right: 5px;
  color: #94a3b8;
  text-align: center;
}

/* Next hours */
.weather-hours {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.weather-hour {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.weather-hour * {
  text-align: center;
}

.weather-hour-time {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
}

.weather-hour-icon {
  width: 34px;
  height: 34px;
}

.weather-hour-temp {
  font-size: 13.5px;
  font-weight: 800;
}

.weather-hour-rain {
  font-size: 10.5px;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
}

.weather-stale {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
}

/* Tappable like the Wikipedia widget: opens the forecast window */
.weather-card {
  cursor: pointer;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.weather-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.11);
  transform: translateY(-1px);
}

/* ==========================================================================
   Forecast window. Frame: the shared kiosk window (requires/obsadzovnik.css);
   content cards: .info-* in requires/wiki.css
   ========================================================================== */

/* The body is exactly the window height; the 7 day rows share what is left, so they always fit */
.weather-window-body {
  grid-template-rows: minmax(0, 1fr);
  padding: 14px 18px;
  gap: 14px;
}

.weather-window-body .info-col {
  gap: 12px;
}

/* On a very short screen the left column scrolls on its own instead of cutting the forecast */
.weather-window-body .info-col:first-child {
  overflow-y: auto;
}

.weather-window-body .info-card {
  padding: 12px 16px;
}

.weather-window-body .info-card-header {
  margin-bottom: 8px;
}

/* Header pill: current weather */
.weather-now-badge b {
  color: #0f172a;
}

/* The icon may overlap the pill's padding, so this pill is exactly as tall as its text-only neighbour */
.weather-badge-icon {
  width: 26px;
  height: 26px;
  margin: -4px 0;
  flex-shrink: 0;
}

.weather-badge-icon svg,
.weather-tab-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Bottom bar: day buttons with the day's pictogram and maximum */
.weather-day-tabs .obs-day-card-btn {
  gap: 6px;
  padding: 0 8px;
}

.weather-tab-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.weather-tab-temp {
  font-size: 13.5px;
  font-weight: 800;
  opacity: 0.75;
}

.weather-day-tabs .obs-day-card-btn.active .weather-tab-temp {
  opacity: 1;
}

.weather-day-tabs .obs-day-card-btn.active .weather-tab-icon {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* Now */
.weather-modal-now-main {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.weather-modal-now-icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.weather-modal-now-icon svg,
.weather-modal-hour .weather-hour-icon svg,
.weather-day-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.weather-modal-now-temp {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.weather-modal-now-desc {
  font-size: 16px;
  font-weight: 700;
  color: #475569;
  margin-top: 4px;
}

.weather-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.weather-stat {
  display: grid;
  grid-template-columns: 18px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 5px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
}

.weather-stat:last-child:nth-child(odd) {
  grid-column: span 2;
}

.weather-stat i {
  grid-row: span 2;
  align-self: center;
  color: #3da870;
  text-align: center;
}

.weather-stat-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
}

.weather-stat-value {
  font-size: 14.5px;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
}

/* Hourly strip */
.weather-modal-hours {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
}

.weather-modal-hour {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border-radius: 12px;
}

.weather-modal-hour:nth-child(odd) {
  background: #f8fafc;
}

.info-window-body .weather-modal-hour * {
  text-align: center;
}

.weather-modal-hour .weather-hour-icon {
  width: 34px;
  height: 34px;
}

.weather-modal-hour .weather-hour-temp {
  font-size: 15px;
}

/* Days */
.weather-modal-days-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.weather-days {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.weather-day {
  flex: 1 1 0;
  min-height: 42px;
  display: grid;
  grid-template-columns: 110px 46px minmax(0, 1fr) 110px 96px 230px;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 2px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.weather-day:hover {
  background: #f8fafc;
}

/* Selected day: same subtle green as the current lesson in the other windows */
.weather-day.is-selected {
  background: #eef8f2;
  border-color: #c3ebd5;
}

.weather-day-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.weather-day-name b {
  font-size: 15.5px;
  font-weight: 800;
}

.weather-day-name small {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.weather-day-icon {
  width: 36px;
  height: 36px;
}

.weather-day-desc {
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-day-rain,
.weather-day-wind {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
}

.weather-day-rain small {
  font-size: 11.5px;
  font-weight: 600;
}

.weather-day-rain.is-likely {
  color: #2563eb;
}

.weather-day-temps {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.info-window-body .weather-day-min {
  font-size: 15px;
  font-weight: 700;
  color: #64748b;
  text-align: right;
}

.weather-day-max {
  font-size: 15px;
  font-weight: 800;
}

/* Temperature range on a common scale for the whole week */
.weather-range {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: #e2e8f0;
}

.weather-range span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #60a5fa, #fbbf24, #f97316);
}

/* Short screens (e.g. 1280x720): a tighter window so all 7 days still fit */
@media (max-height: 740px) {
  .weather-window-body {
    padding: 10px 14px;
    gap: 10px;
  }

  .weather-window-body .info-col {
    gap: 10px;
  }

  .weather-window-body .info-card {
    padding: 10px 14px;
  }

  .weather-modal-now-icon {
    width: 52px;
    height: 52px;
  }

  .weather-modal-now-temp {
    font-size: 34px;
  }

  .weather-stat {
    padding: 3px 10px;
  }

  .weather-modal-hour .weather-hour-icon {
    width: 28px;
    height: 28px;
  }

  .weather-day {
    min-height: 34px;
  }

  .weather-day-icon {
    width: 30px;
    height: 30px;
  }
}
