/* Copyright (c) 2026 Barking Flea LLC. All rights reserved.
   Unauthorized copying, distribution, or modification of this file is strictly prohibited. */

/* The Activity page: a table of counts per window. Kept in its own file so the page does not
   touch the shared stylesheet. */
.activity-body {
  display: grid;
  gap: 28px;
}

.activity-section {
  display: grid;
  gap: 10px;
}

.activity-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

/* The table scrolls sideways on a narrow screen instead of squeezing the numbers. */
.activity-table-wrap {
  overflow-x: auto;
}

.activity-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.activity-table th,
.activity-table td {
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: right;
  white-space: nowrap;
}

.activity-table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.activity-table th.activity-metric {
  text-align: left;
  font-weight: 700;
  color: var(--text);
}

.activity-count {
  color: var(--text);
  font-weight: 700;
}

.activity-zero {
  color: var(--muted);
  font-weight: 400;
}

.activity-footnote {
  margin: 0;
}

/* The last 30 days as tiles above the table. */
.activity-tiles-caption {
  margin: 0;
}

.activity-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.activity-tile {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

.activity-tile-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.activity-tile-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

/* A heading between groups of rows, and the finer rows (the tap types) under their total. */
.activity-table tr.activity-group th {
  text-align: left;
  padding-top: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.activity-table tr.activity-sub th.activity-metric {
  padding-left: 28px;
  font-weight: 400;
  color: var(--muted);
}

/* The list of posts: a title that opens the post, and numbers to sort by. */
.activity-posts th.activity-metric {
  white-space: normal;
  min-width: 200px;
  max-width: 360px;
}

.activity-post-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.activity-post-link:hover,
.activity-post-link:focus-visible {
  text-decoration: underline;
}

.activity-post-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.activity-sort {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.activity-sort:hover,
.activity-sort:focus-visible {
  color: var(--text);
}

.activity-back {
  justify-self: start;
}

.activity-post-detail {
  display: grid;
  gap: 10px;
}

/* In the dashboard's post Analytics dialog the table spans the whole dialog. */
.analytics-grid > .activity-table-wrap,
.analytics-grid > .activity-footnote {
  grid-column: 1 / -1;
}

/* Post activity: a period picker and actions, then groups of posts. */
.pa-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pa-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pa-controls .pa-range {
  margin: 0;
}

/* The controls are hidden while one post's detail is open; display:flex would otherwise win. */
.pa-controls[hidden] {
  display: none;
}

.pa-period-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
}

.pa-period {
  width: auto;
  min-width: 200px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--text);
  font: inherit;
}

.pa-content,
.pa-report {
  display: grid;
  gap: 18px;
}

.pa-status:empty {
  display: none;
}

.pa-group {
  display: grid;
  gap: 8px;
}

.pa-group-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: flex-start;
  justify-content: space-between;
}

.pa-group-titles {
  display: grid;
  gap: 2px;
}

.pa-group-summary,
.pa-range {
  margin: 0;
}

/* A group's posts in a window about five rows tall (a header and five two-line rows); more scroll inside it.
   The column headings stay put, on an opaque background so rows do not show through them. */
.pa-scroll {
  max-height: 346px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.pa-scroll:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pa-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--select-bg);
}

/* A table caption names the table for assistive technology; sighted users have the group heading. */
.pa-caption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The Export dialog (partner-export.js): a short radio list over the report. */
.export-dialog {
  width: min(480px, 100%);
}

.export-dialog-sub {
  margin: 0;
}

.export-dialog-choices {
  display: grid;
  gap: 8px;
}

.export-dialog-choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
}

.export-dialog-choice:has(input:checked) {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

.export-dialog-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.export-dialog-choice input {
  margin-top: 3px;
}

.export-dialog-choice-text {
  display: grid;
  gap: 2px;
}

.export-dialog-choice-label {
  color: var(--text);
  font-weight: 700;
}

.export-dialog-choice-hint {
  color: var(--muted);
  font-size: 12px;
}

.export-dialog-actions {
  display: flex;
  gap: 8px;
}

.export-dialog-status:empty {
  display: none;
}

@media (max-width: 640px) {
  .pa-controls {
    align-items: stretch;
  }
  .pa-actions .btn {
    flex: 1 1 100%;
  }
}
