/* ==== Weather (/weather): current conditions and forecast of a place, from Open-Meteo (wx-) ====
   Same look as the rest of OneStop (app.css: panels, panel-head, hint, error, empty). Loaded by Components\App.razor for
   every page, after app.css. Pages: TTech.Platform.Client\Apps\Weather. Classes built in code (grep the prefix):
   wx-ok / wx-caution / wx-warning and their -text (Wx.LevelClass, the gust colours), day / night (WxNow, WxHours),
   new-day, today, weekend, the wx-ico-... parts of WeatherIcon. Phones: one column under 1000px, sideways scroll of the
   48 hours. */
:root {
  --wx-ok: #2f7d32;
  --wx-ok-soft: #e6f2e6;
  --wx-caution: #a15c00;
  --wx-caution-soft: #fdf0d8;
  --wx-warning: #b23b2e;
  --wx-warning-soft: #fbe7e4;
  --wx-rain: #4a7bb7;
  --wx-snow: #7aa7d6;
  --wx-cloud: #9ca3af;
  --wx-night: #2f3b52;
  --wx-now-from: #fbf3d5;       /* the "now" header by day: gold to beige to white */
  --wx-now-mid: #f4f1e8;
  --wx-now-to: #ffffff;
  --wx-hour-night: #f3f4f7;
}
/* Dark theme (html[data-theme="dark"]): the levels lightened, the day header and the night hours darkened */
:root[data-theme="dark"] {
  --wx-ok: #5cc260;
  --wx-ok-soft: #1d3420;
  --wx-caution: #e8a54e;
  --wx-caution-soft: #3b2c16;
  --wx-warning: #ee8a7e;
  --wx-warning-soft: #3e2220;
  --wx-rain: #6f9fd8;
  --wx-snow: #9cc0e6;
  --wx-now-from: #3a3217;
  --wx-now-mid: #2d291f;
  --wx-now-to: #221f1a;
  --wx-hour-night: #1b1e26;
}

.wx-page { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.wx-h { display: flex; align-items: center; gap: 6px; }
.panel h3.wx-h { margin: 0; }

/* ---- Where: place, search, coordinates, chips ---- */
.wx-place { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.wx-place-main { min-width: 0; }
.wx-eyebrow { color: var(--accent); font-size: 0.7rem; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.panel h2.wx-place-name { margin: 2px 0 4px; font-size: 1.45rem; font-weight: 900; overflow-wrap: anywhere; }
.wx-place-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 0.82rem; }
.wx-place-meta span + span::before { margin-right: 14px; margin-left: -8px; color: var(--faint); content: "·"; }
.wx-place-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wx-saved { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: 0.85rem; font-weight: 700; }

.wx-forms { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 16px; margin-top: 14px; }
.wx-form { display: flex; min-width: 0; flex-direction: column; gap: 4px; margin: 0; }
.wx-label { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.wx-inline { display: flex; gap: 6px; min-width: 0; }
.wx-input {
  min-width: 0;
  flex: 1 1 auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.wx-input:focus { border-color: var(--accent); outline: 2px solid rgba(141, 127, 86, 0.25); }
.wx-coord { width: 0; }
.wx-form-error { margin-top: 6px; color: var(--wx-warning); font-size: 0.82rem; font-weight: 600; }

.wx-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--btn);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.wx-btn:hover:not(:disabled) { background: var(--btn-hover); }
.wx-btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.wx-btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(0.9); }
.wx-btn:disabled { cursor: not-allowed; opacity: 0.55; }
.wx-link { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 700; }

.wx-results { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.wx-results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: var(--accent-soft); }
.wx-results-msg { margin-top: 10px; }
.wx-result {
  display: grid;
  grid-template-columns: auto minmax(0, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--rule);
  color: inherit;
  text-decoration: none;
}
.wx-result:hover { background: var(--panel-2); }
.wx-result-name { font-weight: 800; }
.wx-result-where { overflow: hidden; color: var(--muted); font-size: 0.85rem; text-overflow: ellipsis; white-space: nowrap; }
.wx-result-coord { color: var(--faint); font-size: 0.8rem; white-space: nowrap; }

.wx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.wx-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  font-size: 0.82rem;
  font-weight: 700;
}
.wx-chip a { display: inline-flex; min-width: 0; align-items: center; gap: 4px; color: inherit; text-decoration: none; }
.wx-chip .mud-icon-root { color: var(--brand-gold); }
.wx-chip.mine { padding-right: 12px; border-color: var(--accent); color: var(--accent); text-decoration: none; }
.wx-chip.mine .mud-icon-root { color: var(--accent); }
.wx-chip.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.wx-chip-x {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.wx-chip-x:hover { background: var(--btn-hover); color: var(--text); }

/* ---- Now and site operations ---- */
/* Now (left) and the site operations (right, its checks in two columns when there is room) side by side */
.wx-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 12px; align-items: stretch; }

.wx-now { overflow: hidden; padding: 0; }
.wx-now-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 18px 16px;
  background: linear-gradient(135deg, var(--wx-now-from) 0%, var(--wx-now-mid) 60%, var(--wx-now-to) 100%);
}
.wx-now.night .wx-now-head { background: linear-gradient(135deg, #2f3b52 0%, #46526b 70%, #5b6680 100%); color: #f3f4f6; }
.wx-now-main { min-width: 0; }
.wx-now-temp { font-size: 2.6rem; font-weight: 900; letter-spacing: -1px; line-height: 1; }
.wx-now-desc { margin-top: 4px; font-size: 1.05rem; font-weight: 800; }
.wx-now-feels { margin-top: 2px; color: var(--muted); font-size: 0.88rem; }
.wx-now.night .wx-now-feels { color: #cfd5e1; }
.wx-daynight {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 800;
}
.wx-now.day .wx-daynight .mud-icon-root { color: #c49a1a; }
.wx-now.night .wx-daynight { background: rgba(255, 255, 255, 0.15); color: #f3f4f6; }
.wx-now-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); border-top: 1px solid var(--rule); }
.wx-metric { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.wx-metric .label { color: var(--muted); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase; }
.wx-metric b { display: inline-flex; align-items: center; gap: 5px; font-size: 1.05rem; font-weight: 800; }
.wx-metric .sub { color: var(--muted); font-size: 0.76rem; }
.wx-min { color: var(--muted); font-weight: 700; }
.wx-metric b.wx-sun { font-size: 0.95rem; white-space: nowrap; }
.wx-sun .mud-icon-root { color: #c49a1a; }

.wx-ops-summary { margin-bottom: 8px; padding: 8px 12px; border-radius: 8px; font-weight: 700; }
.wx-ops-summary.wx-ok { background: var(--wx-ok-soft); color: var(--wx-ok); }
.wx-ops-summary.wx-caution { background: var(--wx-caution-soft); color: var(--wx-caution); }
.wx-ops-summary.wx-warning { background: var(--wx-warning-soft); color: var(--wx-warning); }
.wx-ops-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.wx-op { display: flex; gap: 10px; padding: 8px 10px; border-left: 4px solid var(--wx-ok); border-radius: 6px; background: var(--panel-2); }
.wx-op.wx-caution { border-left-color: var(--wx-caution); background: color-mix(in srgb, var(--wx-caution-soft) 50%, var(--panel)); }
.wx-op.wx-warning { border-left-color: var(--wx-warning); background: color-mix(in srgb, var(--wx-warning-soft) 50%, var(--panel)); }
.wx-op-icon { flex: 0 0 auto; padding-top: 1px; color: var(--muted); }
.wx-op.wx-caution .wx-op-icon { color: var(--wx-caution); }
.wx-op.wx-warning .wx-op-icon { color: var(--wx-warning); }
.wx-op-body { min-width: 0; flex: 1; }
.wx-op-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.wx-op-title { margin-right: auto; font-weight: 800; }
.wx-op-detail { margin-top: 2px; font-size: 0.88rem; }
.wx-op-advice { margin-top: 3px; font-size: 0.85rem; font-weight: 600; }
.wx-op-rule { margin-top: 3px; font-size: 0.74rem; }
.wx-ops-note { margin-bottom: 0; font-size: 0.76rem; }
.wx-level { padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.wx-level.wx-ok { background: var(--wx-ok-soft); color: var(--wx-ok); }
.wx-level.wx-caution { background: var(--wx-caution-soft); color: var(--wx-caution); }
.wx-level.wx-warning { background: var(--wx-warning-soft); color: var(--wx-warning); }
.wx-level.now { border: 1px solid currentColor; background: var(--panel); text-transform: uppercase; }
.wx-caution-text { color: var(--wx-caution); font-weight: 800; }
.wx-warning-text { color: var(--wx-warning); font-weight: 800; }

/* ---- Next 48 hours: a strip that scrolls sideways ---- */
.wx-hours { display: flex; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.wx-hour {
  display: flex;
  min-width: 62px;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 6px;
  border-left: 1px solid transparent;
  font-size: 0.8rem;
}
.wx-hour.night { background: var(--wx-hour-night); }
.wx-hour.new-day { border-left-color: var(--accent); }
.wx-hour:first-child { border-left-color: transparent; }
.wx-hour-day { min-height: 1.1em; color: var(--accent); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.wx-hour-time { color: var(--muted); font-weight: 700; }
.wx-hour-temp { font-size: 0.95rem; font-weight: 800; }
.wx-hour-pop { display: inline-flex; align-items: center; color: var(--faint); font-size: 0.74rem; }
.wx-hour-pop .mud-icon-root { width: 13px; height: 13px; }
.wx-hour-pop.wet { color: var(--wx-rain); font-weight: 700; }
.wx-hour-mm { min-height: 1.1em; color: var(--wx-rain); font-size: 0.72rem; font-weight: 700; }
.wx-hour-wind { display: inline-flex; align-items: center; gap: 2px; }
.wx-hour-gust { color: var(--muted); font-size: 0.74rem; }
.wx-hours-legend { margin-top: 4px; font-size: 0.75rem; }

/* ---- The three charts ---- */
.wx-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.wx-chart { min-height: 240px; }

/* ---- Next 16 days ---- */
.wx-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.wx-day {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
}
.wx-day.today { border-top-color: var(--brand-gold); background: var(--panel-2); }
.wx-day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.wx-day-name { font-weight: 900; text-transform: capitalize; }
.wx-day.weekend .wx-day-name { color: var(--accent); }
.wx-day-date { color: var(--muted); font-size: 0.8rem; }
.wx-day-sky { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wx-day-temps { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.wx-day-max { font-size: 1.35rem; font-weight: 900; }
.wx-day-min { color: var(--muted); font-size: 0.95rem; font-weight: 700; }
.wx-day-desc { min-height: 2.4em; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.wx-range { position: relative; height: 6px; border-radius: 3px; background: var(--chip); }
.wx-range span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #7aa7d6, var(--brand-gold), #d9822b);
}
.wx-day-facts { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 3px 6px; margin: 2px 0 0; font-size: 0.8rem; }
.wx-day-facts dt { display: flex; justify-content: center; color: var(--muted); }
.wx-day-facts dt .mud-icon-root { width: 16px; height: 16px; }
.wx-day-facts dd { margin: 0; font-weight: 700; }
.wx-day-facts .muted { margin-left: 4px; font-weight: 600; }
.wx-day-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.wx-flag { padding: 1px 7px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; }
.wx-flag.wx-caution { background: var(--wx-caution-soft); color: var(--wx-caution); }
.wx-flag.wx-warning { background: var(--wx-warning-soft); color: var(--wx-warning); }
.wx-days-legend { margin-top: 8px; font-size: 0.75rem; }

/* ---- Attribution (required by Open-Meteo's terms: keep it on the page) ---- */
.wx-footer { display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 0 4px 8px; color: var(--muted); font-size: 0.78rem; }
.wx-footer a { color: var(--accent); font-weight: 700; }

/* ---- Pictures (WeatherIcon) and the wind arrow (WindArrow) ---- */
.wx-ico { flex: 0 0 auto; overflow: visible; }
.wx-ico-sun circle { fill: var(--brand-gold); }
.wx-ico-sun line { stroke: var(--brand-gold); stroke-width: 3; stroke-linecap: round; }
.wx-ico-moon { fill: #c9cfdb; stroke: #9aa3b5; stroke-width: 1; }
.wx-now.night .wx-ico-moon { fill: #f1e7bf; stroke: none; }
.wx-ico-cloud { fill: var(--wx-cloud-fill, #ffffff); stroke: var(--wx-cloud); stroke-width: 2; stroke-linejoin: round; }
.wx-ico-cloud.back { fill: var(--wx-cloud-back, #e5e7eb); }
:root[data-theme="dark"] .wx-ico { --wx-cloud-fill: #d7dbe2; --wx-cloud-back: #9ea5b0; }
.wx-ico-cloud.dark { fill: #6b7280; stroke: #4b5563; }
.wx-ico-rain { stroke: var(--wx-rain); stroke-width: 3; stroke-linecap: round; }
.wx-ico-drop-dot { fill: var(--wx-rain); }
.wx-ico-snow line { stroke: var(--wx-snow); stroke-width: 2; stroke-linecap: round; }
.wx-ico-bolt { fill: var(--brand-gold); stroke: #a8841a; stroke-width: 1; stroke-linejoin: round; }
.wx-ico-fog { stroke: var(--wx-cloud); stroke-width: 3; stroke-linecap: round; }
.wx-arrow { flex: 0 0 auto; vertical-align: middle; }
.wx-arrow path { fill: var(--accent); }

/* ---- Phones and narrow windows ---- */
@media (max-width: 1100px) {
  .wx-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1000px) {
  .wx-top { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .wx-forms { grid-template-columns: minmax(0, 1fr); }
  .wx-now-temp { font-size: 2.2rem; }
  .wx-now-head { gap: 10px; padding: 16px 12px 14px; }
  .wx-now-head .wx-ico { width: 72px; height: 72px; }
  .wx-result { grid-template-columns: auto minmax(0, 1fr); }
  .wx-result-where, .wx-result-coord { grid-column: 2; }
  .wx-days { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .wx-day { padding: 8px 10px; }
}
@media (max-width: 330px) {
  .wx-days { grid-template-columns: minmax(0, 1fr); }
}
