/* pws-wu.css - stránky Historie WU a Přehled WU (PWS_wuhistory.php, PWS_wureports.php).
   Vzhled podle reportu čidel a DESIGN.md; karty, buňky a pilulky bere z pws-dashboard.css.
   Stránky se include-ují do dashboardu, proto je všechno scopované pod .pws-wu. */

.pws-wu {
  width: 100%;
  min-width: 0;
  padding: 2px 16px 28px;
  color: var(--pr-ink);
  font-family: var(--pr-sans);
  font-size: var(--pr-fs-body);
  line-height: 1.5;
  text-align: left;
}

.pws-wu * {
  box-sizing: border-box;
  font-family: inherit;
  text-align: inherit;
}

.pws-wu a { color: inherit; }
.pws-wu p { margin: 0; }

/* .PWS_weather_container má overflow: hidden a z vnitřní tabulky by udělal rolovací
   kontejner celé stránky; clip ořízne stejně (viz pws-report.css) */
.PWS_weather_container:has(> .pws-wu) { overflow: clip; min-width: 0; }

.pws-wu-head { padding: 12px 0 2px; }
.pws-wu-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.015em;
  color: var(--pr-ink);
  background: none;
}
.pws-wu-head p { margin-top: 4px; font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }
.pws-wu-head p a { text-decoration: underline; text-underline-offset: 2px; }
.pws-wu-head p a:hover { color: var(--pr-ink); }

/* ---------- ovládání ---------- */

.pws-wu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 16px 0 14px;
}

.pws-wu-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--pr-surface);
  border: 1px solid var(--pr-line);
  border-radius: 9px;
  max-width: 100%;
  overflow-x: auto;
}

.pws-wu-tabs a {
  padding: 7px 14px;
  border-radius: 6px;
  color: var(--pr-ink-dim);
  font-size: var(--pr-fs-control);
  white-space: nowrap;
  text-decoration: none;
}
.pws-wu-tabs a:hover { color: var(--pr-ink); }
.pws-wu-tabs a[aria-current] {
  background: var(--pr-surface-2);
  color: var(--pr-ink);
  box-shadow: inset 0 0 0 1px var(--pr-line);
}

.pws-wu-tabs + .pws-wu-tabs { margin-left: 0; }

.pws-wu-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  margin: 0;
}

.pws-wu-pick label { display: flex; flex-direction: column; gap: 2px; }

.pws-wu-pick input[type="date"] {
  height: 34px;
  padding: 0 8px;
  background: var(--pr-surface-2);
  border: 1px solid var(--pr-line);
  border-radius: 6px;
  color: var(--pr-ink);
  font-family: var(--pr-mono);
  font-size: var(--pr-fs-control);
  font-variant-numeric: tabular-nums;
}

.pws-wu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 11px;
  background: var(--pr-surface-2);
  border: 1px solid var(--pr-line);
  border-radius: 6px;
  color: var(--pr-ink-dim);
  font-family: var(--pr-sans);
  font-size: var(--pr-fs-body);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.pws-wu-btn:hover { color: var(--pr-ink); }
.pws-wu-btn[aria-disabled] { opacity: .35; cursor: default; }
.pws-wu-btn[aria-disabled]:hover { color: var(--pr-ink-dim); }
.pws-wu-nav .pws-wu-btn:not(.pws-wu-today) { font-size: 18px; padding: 0 0 2px; }

.pws-wu-nav { display: inline-flex; gap: 6px; margin-left: auto; }

.pws-wu :focus-visible { outline: 2px solid var(--pr-zast); outline-offset: 2px; }

/* ---------- karty ---------- */

.pws-wu .pws-wu-card { padding: 16px 18px 18px; }
.pws-wu .pws-wu-card + .pws-wu-card { margin-top: 14px; }
.pws-wu .pws-card-head { margin-bottom: 12px; }
.pws-wu .pws-card-head h3 { font-size: 15px; }
.pws-wu-sub { font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }
.pws-wu-empty { color: var(--pr-ink-dim); }
.pws-wu .pws-card-note { margin-top: 10px; font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }

.pws-wu-csv {
  margin-left: auto;
  font-size: var(--pr-fs-note);
  color: var(--pr-ink-dim) !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.pws-wu-csv:hover { color: var(--pr-ink) !important; }

/* souhrn: 6 buněk, na telefonu 2 sloupce (DESIGN.md, Layout) */
.pws-wu-sum { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pws-wu-sum .pws-cell { padding: 10px 11px 11px; }
.pws-wu-sum .pws-v { align-items: flex-start; gap: 6px 12px; margin-top: 6px; }

.pws-wu-pair { display: inline-flex; flex-direction: column; gap: 2px; }
.pws-wu-pk,
.pws-wu-when {
  font-size: var(--pr-fs-note);
  color: var(--pr-ink-dim);
  line-height: 1.3;
}
.pws-wu-when { font-family: var(--pr-mono); font-variant-numeric: tabular-nums; }
.pws-wu-inl { font-family: var(--pr-mono); font-weight: 600; font-variant-numeric: tabular-nums; }

.pws-wu .pws-q-wind .pws-k { color: var(--q-wind); }
.pws-wu .pws-q-baro .pws-k { color: var(--q-baro); }
.pws-wu .pws-q-rain .pws-k { color: var(--q-rain); }
.pws-wu .pws-k .pws-u { text-transform: none; letter-spacing: 0; font-weight: 400; }

@media (max-width: 1100px) {
  .pws-wu-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .pws-wu-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- tabulky ---------- */

/* vlastní rolování: hlavička i první sloupec zůstávají na místě (DESIGN.md, Layout) */
.pws-wu-scroll:last-child { margin-bottom: -18px; border-bottom: 0; border-radius: 0 0 10px 10px; }

.pws-wu-scroll {
  max-height: min(72vh, 820px);
  overflow: auto;
  margin: 0 -18px;
  border-top: 1px solid var(--pr-line);
  border-bottom: 1px solid var(--pr-line);
  overscroll-behavior-x: contain;
}

.pws-wu-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--pr-fs-body);
  background: none;
}

.pws-wu-table th,
.pws-wu-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--pr-line-soft);
  background: none;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.pws-wu-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-top: 9px;
  padding-bottom: 7px;
  background: var(--pr-surface);
  border-bottom: 1px solid var(--pr-line);
  font-size: var(--pr-fs-label);
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--pr-ink-dim);
}
.pws-wu-table thead .pws-u { text-transform: none; letter-spacing: 0; font-weight: 400; }

.pws-wu-table tbody th {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--pr-surface);
  text-align: left;
  font-family: var(--pr-mono);
  font-size: var(--pr-fs-note);
  font-weight: 400;
  color: var(--pr-ink-dim);
  font-variant-numeric: tabular-nums;
}
.pws-wu-table thead th:first-child { left: 0; z-index: 3; text-align: left; }
.pws-wu-table th:first-child,
.pws-wu-table td:first-child { padding-left: 18px; }
.pws-wu-table th:last-child,
.pws-wu-table td:last-child { padding-right: 18px; }

.pws-wu-table tbody th a { color: var(--pr-ink); text-decoration: none; }
.pws-wu-table tbody th a:hover { text-decoration: underline; text-underline-offset: 2px; }
.pws-wu-wd { display: inline-block; min-width: 2.2em; color: var(--pr-ink-dim); font-family: var(--pr-sans); }

.pws-wu-table tbody tr:hover > * { background: var(--pr-surface-2); }
.pws-wu-table tr.pws-wu-hr > * { border-top: 1px solid var(--pr-line); }
.pws-wu-table tbody tr:last-child > * { border-bottom: 0; }

.pws-wu-table .pws-num { font-size: var(--pr-fs-body); }
.pws-wu-table .pws-pill { padding: 0 7px; font-size: var(--pr-fs-body); }
.pws-wu-zero { color: var(--pr-ink-dim) !important; font-weight: 400 !important; }
.pws-wu-none { color: var(--pr-ink-faint); }
.pws-wu-hum { color: var(--pr-hum-ink); }

.pws-wu-dir { text-align: left !important; color: var(--pr-ink-dim); padding-right: 2px !important; }
.pws-wu-arrow {
  width: 13px;
  height: 13px;
  margin-right: 4px;
  vertical-align: -2px;
  fill: none;
  stroke: var(--q-wind);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pws-wu-c-range { width: 120px; padding-left: 4px !important; padding-right: 14px !important; }
.pws-wu-range {
  position: relative;
  display: block;
  width: 110px;
  height: 8px;
  border-radius: 4px;
  background: var(--pr-line-soft);
  overflow: hidden;
}
.pws-wu-range i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }

.pws-wu-table .pws-sep { margin: 0 3px; color: var(--pr-ink-faint); }

/* ---------- kalendář roku (Přehled WU) ---------- */

.pws-wu-cal { table-layout: fixed; min-width: 640px; }
.pws-wu-scroll-cal { max-height: none; }
.pws-wu-cal thead th { text-align: center; }
.pws-wu-cal thead th:first-child { width: 46px; }
.pws-wu-cal tbody th { text-align: right; padding-right: 10px; }
.pws-wu-cal td {
  padding: 1px;
  border: 0;
  text-align: center;
}
.pws-wu-cal tbody tr:hover > * { background: none; }
.pws-wu-cal td > span {
  display: block;
  height: 22px;
  border-radius: 3px;
  font-family: var(--pr-mono);
  font-size: var(--pr-fs-note);
  font-weight: 600;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.pws-wu-cal td > .pws-wu-cal-0 { background: var(--pr-surface-2); color: var(--pr-ink-dim); text-shadow: none; font-weight: 400; }
.pws-wu-cal td > .pws-wu-cal-x { background: none; }
.pws-wu-cal td > .pws-wu-cal-x::after { content: "·"; color: var(--pr-ink-faint); }

/* ---------- měsíce a srovnání let ---------- */

.pws-wu-months td,
.pws-wu-months th { padding-top: 8px; padding-bottom: 8px; }
.pws-wu-months tbody th { font-family: var(--pr-sans); font-size: var(--pr-fs-body); color: var(--pr-ink); }
.pws-wu-months tfoot th,
.pws-wu-months tfoot td {
  padding: 9px 10px;
  border-top: 1px solid var(--pr-line);
  background: var(--pr-surface);
  text-align: right;
  white-space: nowrap;
}
.pws-wu-months tfoot th {
  position: sticky;
  left: 0;
  text-align: left;
  font-weight: 600;
  padding-left: 18px;
}
.pws-wu-months tfoot td:last-child { padding-right: 18px; }
.pws-wu-months .pws-wu-when { display: block; margin-top: 1px; }
.pws-wu-months .pws-wu-range { width: 132px; }
.pws-wu-months .pws-wu-c-range { width: 150px; }

.pws-wu-count { font-family: var(--pr-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.pws-wu-rules { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }
.pws-wu-rules b { font-weight: 600; }

/* ---------- telefon a dotyk ---------- */

@media (max-width: 640px) {
  .pws-wu { padding-inline: 0; }
  .pws-wu-head { padding-inline: 2px; }
  .pws-wu .pws-wu-card { padding: 14px; }
  .pws-wu-scroll { margin-inline: -14px; }
  .pws-wu-scroll:last-child { margin-bottom: -14px; }
  .pws-wu-table th:first-child,
  .pws-wu-table td:first-child { padding-left: 14px; }
  .pws-wu-tabs { width: 100%; }
  .pws-wu-tabs a { flex: 1 0 auto; text-align: center; }
  /* šest veličin by se rolovalo a poslední byla useknutá: na telefonu dvě řady po třech */
  .pws-wu-tabs-q { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pws-wu-tabs-q a { padding-inline: 4px; overflow: hidden; text-overflow: ellipsis; }
  .pws-wu-nav { margin-left: 0; }
}

@media (pointer: coarse) {
  .pws-wu-btn,
  .pws-wu-pick input[type="date"] { height: 40px; min-width: 40px; }
  .pws-wu-tabs a { padding-block: 10px; }
}

/* ---------- Přehled WU: kalendář, klíč, volba statistiky ---------- */

.pws-wu-cal td > a,
.pws-wu-cal td > span {
  display: block;
  height: 22px;
  border-radius: 3px;
  font-family: var(--pr-mono);
  font-size: var(--pr-fs-note);
  font-weight: 600;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.pws-wu-cal td > a:hover { box-shadow: inset 0 0 0 2px var(--pr-ink); }
.pws-wu-cal td > a.pws-wu-cal-0 { background: var(--pr-surface-2); }
.pws-wu-cal td > a.pws-wu-cal-h { color: var(--pr-ink); text-shadow: none; }

.pws-wu-key { display: inline-flex; align-items: center; gap: 6px; }
.pws-wu-key i { display: block; width: 120px; height: 8px; border-radius: 4px; }

.pws-wu-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.pws-wu-chips a {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--pr-surface-2);
  box-shadow: inset 0 0 0 1px var(--pr-line);
  color: var(--pr-ink-dim);
  font-size: var(--pr-fs-body);
  text-decoration: none;
}
.pws-wu-chips a:hover { color: var(--pr-ink); }
.pws-wu-chips a[aria-current] { background: var(--pr-ink); color: var(--pr-surface); box-shadow: none; }

.pws-wu-part { opacity: .5; }
.pws-wu-cmp td { text-align: right; }
.pws-wu-cmp tbody th a { color: var(--pr-ink); font-family: var(--pr-mono); font-weight: 600; }

@media (pointer: coarse) {
  .pws-wu-chips a { padding-block: 9px; }
}

.pws-wu-until { font-family: var(--pr-sans); font-size: var(--pr-fs-label); color: var(--pr-ink-dim); }

/* ---------- rekordy roku (PWS_wureports.php) ---------- */
.pws-wu-rec-cols { display: grid; gap: 6px 36px; }
@media (min-width: 900px) { .pws-wu-rec-cols:has(> div + div) { grid-template-columns: 1fr 1fr; } }
.pws-wu-rec-cols .pws-k { margin: 4px 0 2px; }
.pws-wu-rec { list-style: none; margin: 0; padding: 0; }
.pws-wu-rec li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--pr-line-soft); }
.pws-wu-rec li:first-child { border-top: 0; }
.pws-wu-rec-n { display: block; font-size: 14px; color: var(--pr-ink); }
.pws-wu-rec-q { font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }
.pws-wu-rec .pws-wu-when { display: block; margin-top: 1px; }
.pws-wu-rec .pws-wu-when a { color: inherit; text-decoration: underline; text-decoration-color: var(--pr-line); text-underline-offset: 2px; }
.pws-wu-rec .pws-wu-when a:hover { color: var(--pr-ink); }
/* rekord celého měření, když padl jinde: druhý plán pod datem */
.pws-wu-rec-all { display: block; margin-top: 2px; font-size: var(--pr-fs-note); color: var(--pr-ink-dim); }
.pws-wu-rec-all .pws-num { font-size: 13px; }
.pws-wu-rec-all a { color: inherit; text-decoration: underline; text-decoration-color: var(--pr-line); text-underline-offset: 2px; }
.pws-wu-rec-v { flex: none; text-align: right; }
.pws-wu-rec-v .pws-u { color: var(--pr-ink-dim); }
