/* =========================================================
   BirdPI – Page Styles: Auswertung
   ========================================================= */

body.page-auswertung .wrap.fullheight {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100vw;
  overflow: hidden;
  gap: 8px;
}

/* --- Filter-Bar --- */
.aw-filterbar {
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.aw-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.aw-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.aw-label {
  font-size: 12px;
  color: var(--muted);
}
.aw-filter select,
.aw-filter input[type="text"],
.aw-filter input[type="date"] {
  height: 36px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 0 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}
.aw-filter select { min-width: 140px; }
.aw-filter input[type="date"] { min-width: 130px; }
.aw-filter-custom[hidden] { display: none; }

.aw-filter-score { min-width: 140px; }
.aw-filter-score input[type="range"] {
  width: 140px;
  height: 36px;
  accent-color: var(--accent);
}
.aw-filter-species { flex-grow: 1; min-width: 140px; }
.aw-filter-species input { width: 100%; min-width: 0; }

.aw-reset {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
}
.aw-reset:hover { border-color: var(--accent); }

/* --- Tab-Bar --- */
.aw-tabbar {
  flex-shrink: 0;
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--grid);
  overflow-x: auto;
}
.aw-tab {
  height: 44px;
  padding: 0 16px;
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.aw-tab:hover { color: var(--fg); }
.aw-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.aw-tab[hidden] { display: none; }

/* --- Content --- */
.aw-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.aw-pane {
  display: none;
  flex: 1;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 12px;
  overflow: auto;
}
.aw-pane.active { display: flex; flex-direction: column; }
.aw-empty,
.aw-loading {
  margin: auto;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
.aw-loading::after {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: 8px;
  border: 2px solid var(--grid);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: middle;
  animation: aw-spin 0.8s linear infinite;
}
@keyframes aw-spin { to { transform: rotate(360deg); } }

/* --- Uebersicht: KPI-Grid + Mini-Chart --- */
.aw-kpi-grid {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding-bottom: 10px;
}
.aw-kpi {
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.aw-kpi-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.aw-kpi-value {
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-kpi-value-text {
  font-size: 18px;
}
.aw-kpi-delta {
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-kpi-delta-up      { color: var(--ok, #4caf50); }
.aw-kpi-delta-down    { color: var(--err, #e74c3c); }
.aw-kpi-delta-neutral { color: var(--muted); }
.aw-kpi-delta-hint    { color: var(--muted); }

.aw-mini-chart {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.aw-mini-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.aw-mini-canvas-wrap {
  flex: 1;
  min-height: 120px;
  position: relative;
}
.aw-mini-canvas-wrap canvas { width: 100% !important; height: 100% !important; }

@media (max-width: 1024px) {
  .aw-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .aw-kpi-value { font-size: 22px; }
  .aw-kpi-value-text { font-size: 16px; }
}
@media (max-width: 600px) {
  .aw-kpi { padding: 8px 10px; }
}

/* --- Tile-Header (Mode-Hinweis) --- */
.aw-tile-head {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 0 6px 0;
}
.aw-tile-mode {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* --- Chart-Wrap (Verlauf, Top-Arten) --- */
.aw-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}
.aw-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* --- Arten-Tile (Lehrpfad-Stil mit In-Bar-Labels) --- */
.aw-spec-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 2px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.aw-spec-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aw-spec-section-head {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 0 4px 0;
  border-bottom: 1px solid var(--grid);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}
.aw-spec-rare > .aw-spec-section-head { list-style: none; cursor: pointer; }
.aw-spec-rare > .aw-spec-section-head::-webkit-details-marker { display: none; }
.aw-spec-rare > .aw-spec-section-head::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  color: var(--muted);
  transition: transform .15s;
}
.aw-spec-rare[open] > .aw-spec-section-head::before { transform: rotate(90deg); }

.aw-spec-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 4px;
}
.aw-spec-row {
  display: grid;
  grid-template-columns: minmax(110px, 28%) 1fr;
  gap: 10px;
  align-items: center;
  background: none;
  border: none;
  padding: 4px 0;
  font: inherit;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius);
}
.aw-spec-row:hover { background: rgba(255,140,66,0.06); }
.aw-spec-row:hover .aw-spec-fill { filter: brightness(1.1); }
.aw-spec-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-spec-bar {
  position: relative;
  height: 22px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
  overflow: visible;
}
.aw-spec-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  background: rgba(255,140,66,0.55);
  border-radius: 3px;
  transition: filter .15s;
}
.aw-spec-count {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  pointer-events: none;
}
.aw-spec-list-rare .aw-spec-fill { background: rgba(255,140,66,0.30); }
.aw-spec-list-rare .aw-spec-name { color: var(--muted); }

@media (max-width: 1024px) {
  .aw-spec-row { grid-template-columns: minmax(90px, 32%) 1fr; gap: 8px; }
  .aw-spec-name { font-size: 12px; }
}

/* --- Chronologie-Tile --- */
.aw-chr-tbl th.aw-chr-num,
.aw-chr-tbl td.aw-chr-num { width: 40px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.aw-chr-tbl th.num,
.aw-chr-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.aw-chr-tbl td.small,
.aw-chr-tbl th.small,
.aw-chr-tbl td.small { color: var(--muted); }
.aw-chr-tbl tbody tr { cursor: pointer; }
.aw-chr-tbl tbody tr:hover { background: rgba(255,140,66,0.06); }
.aw-chr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* --- Confidence-Tile --- */
.aw-conf-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
}
.aw-conf-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
}
.aw-conf-label {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.aw-conf-bar {
  position: relative;
  height: 28px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
}
.aw-conf-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: rgba(255,140,66,0.55);
  border-radius: 3px;
}
.aw-conf-count {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  pointer-events: none;
}
.aw-conf-share { color: var(--muted); }

/* --- Standorte-Tile (Small-Multiples) --- */
.aw-sites-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  padding: 4px;
}
.aw-sites-card {
  background: var(--bg);
  border: 1px solid var(--grid);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aw-sites-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.aw-sites-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-sites-key {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
}
.aw-sites-total-bar {
  position: relative;
  height: 22px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
}
.aw-sites-total-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: rgba(255,140,66,0.55);
  border-radius: 3px;
}
.aw-sites-total-count {
  position: absolute;
  right: 8px; top: 50%; transform: translateY(-50%);
  font-size: 12px; color: var(--fg);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.aw-sites-top {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--grid);
  padding-top: 6px;
}
.aw-sites-top-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  gap: 8px;
}
.aw-sites-top-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-sites-top-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.aw-sites-top-empty { font-size: 12px; color: var(--muted); font-style: italic; }

/* --- Tageszeit-Tile (Wann singt wer?) --- */
.aw-tz-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
.aw-tz-head, .aw-tz-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 40px;
  gap: 6px;
  align-items: center;
}
.aw-tz-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--grid);
  font-size: 11px;
  color: var(--muted);
}
.aw-tz-hours {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
}
.aw-tz-head-hour {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.aw-tz-list { padding-top: 4px; }
.aw-tz-head {
  box-sizing: border-box;
  width: 100%;
}
.aw-tz-row {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  padding: 3px 0;
  margin: 0;
  border-radius: var(--radius);
}
.aw-tz-row:hover { background: rgba(255,140,66,0.06); }
.aw-tz-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.aw-tz-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 18px;
}
.aw-tz-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--grid);
  opacity: 0.25;
}
.aw-tz-dot.has { opacity: 1; }
.aw-tz-dot.peak {
  outline: 1.5px solid var(--accent);
  outline-offset: 1px;
}
.aw-tz-total {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding-right: 4px;
}

@media (max-width: 1024px) {
  .aw-tz-head, .aw-tz-row {
    grid-template-columns: 90px 1fr 36px;
    gap: 4px;
  }
  .aw-tz-name { font-size: 11px; }
  .aw-tz-dot { width: 10px; height: 10px; }
}

/* --- Heatmap (Tag x Stunde) --- */
.aw-heatmap-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px;
}
.aw-heatmap-grid {
  display: grid;
  gap: 2px;
}
.aw-hm-corner { /* leere obere linke Ecke */ }
.aw-hm-day {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aw-hm-hour {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  padding: 0 6px;
  align-self: center;
}
.aw-hm-cell {
  height: 18px;
  background: var(--grid);
  border-radius: 2px;
  opacity: 0.35;
  transition: opacity .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,0.6);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  line-height: 1;
}
.aw-hm-cell.has { opacity: 1; }
.aw-hm-cell:hover { transform: scale(1.15); z-index: 2; outline: 1px solid var(--accent); }

/* --- Calendar (GitHub-Style, responsiv mit max 30px Cells) --- */
.aw-cal {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;  /* zentriert wenn schmaler als Container */
}
.aw-cal-months {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(14px, 30px);
  gap: 2px;
  padding-left: 28px;
  font-size: 10px;
  color: var(--muted);
}
.aw-cal-month-cell {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: visible;
}
.aw-cal-body {
  display: grid;
  grid-template-columns: 24px auto;
  gap: 4px;
  align-items: start;
}
.aw-cal-weekdays {
  display: grid;
  grid-template-rows: repeat(7, minmax(14px, 30px));
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
}
.aw-cal-weekdays > div {
  display: flex;
  align-items: center;
}
.aw-cal-grid {
  display: grid;
  grid-template-rows: repeat(7, minmax(14px, 30px));
  gap: 2px;
}
.aw-cal-cell {
  background: var(--grid);
  border-radius: 2px;
  opacity: 0.35;
  transition: transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: #fff;
  text-shadow: 0 0 2px rgba(0,0,0,0.6);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  line-height: 1;
}
.aw-cal-cell.has    { opacity: 1; }
.aw-cal-cell.out    { opacity: 0; pointer-events: none; }
.aw-cal-cell:hover  { transform: scale(1.5); z-index: 2; outline: 1px solid var(--accent); }

/* --- Monat × Jahr --- */
.aw-my-grid {
  display: grid;
  grid-template-columns: 56px repeat(12, minmax(40px, 1fr));
  gap: 2px;
  padding: 4px;
}
.aw-my-corner {}
.aw-my-month {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
}
.aw-my-year {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  padding-right: 8px;
  align-self: center;
  font-variant-numeric: tabular-nums;
}
.aw-my-cell {
  height: 32px;
  background: var(--grid);
  border-radius: 3px;
  opacity: 0.35;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--bg);
  transition: transform .1s;
}
.aw-my-cell.has   { opacity: 1; }
.aw-my-cell:hover { transform: scale(1.05); z-index: 2; outline: 1px solid var(--accent); }

/* --- Tabelle --- */
.aw-table-head {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 8px 0;
}
.aw-table-count {
  font-size: 13px;
  color: var(--muted);
}
.aw-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.aw-tbl {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.aw-tbl th, .aw-tbl td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--grid);
  text-align: left;
}
.aw-tbl th {
  position: sticky;
  top: 0;
  background: var(--tbl-b, var(--card));
  font-size: 12px;
  color: var(--muted);
  z-index: 2;
  box-shadow: 0 1px 0 var(--grid);
}
.aw-tbl tr:nth-child(even) { background: var(--row-alt); }
.aw-tbl th.time, .aw-tbl td.t { width: 18%; white-space: nowrap; }
.aw-tbl th.site            { width: 14%; }
.aw-tbl th.name            { width: auto; }
.aw-tbl th.score, .aw-tbl td.score-cell { width: 22%; }

.aw-tbl td.name-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
}
.aw-tbl td.name-cell .name-content {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aw-tbl td.score-cell {
  display: flex; align-items: center; gap: 8px;
}
.aw-tbl .score-bar {
  flex: 1; height: 8px; background: var(--grid);
  border-radius: 4px; overflow: hidden;
}
.aw-tbl .score-bar-fill { height: 100%; }
.aw-tbl .score-num { font-variant-numeric: tabular-nums; font-size: 13px; min-width: 36px; text-align: right; }
.aw-table-foot {
  flex-shrink: 0;
  padding: 8px 0 0;
  text-align: center;
}

/* --- 7-Zoll / Tablets --- */
@media (max-width: 1024px) {
  .aw-filter-row { gap: 8px; }
  .aw-filter select { min-width: 120px; }
  .aw-filter input[type="date"] { min-width: 120px; }
  .aw-filter-score { min-width: 110px; }
  .aw-filter-score input[type="range"] { width: 110px; }
  .aw-filter-species { min-width: 100px; }
}

@media (max-width: 600px) {
  .aw-filter-row { gap: 6px; }
  .aw-tab { padding: 0 10px; font-size: 13px; }
}
