/* dashboard-admin-analytics.css
   The admin Analytics card (dashboard-admin-analytics.js, 2026-11-02): range and
   teacher controls, charts with a scale, the hover card, the By-teacher table.
   Uses dashboard.html's tokens (--red, --slate-*, --radius). */

.an-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.an-seg { display: inline-flex; background: var(--slate-100); border: 1px solid var(--slate-200); border-radius: 8px; padding: 2px; }
.an-seg-btn { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; font: inherit; font-size: 12px; font-weight: 600; color: var(--slate-600); cursor: pointer; }
.an-seg-btn:hover { color: var(--slate-900); }
.an-seg-btn.is-on { background: #fff; color: var(--slate-900); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.an-seg-btn:focus-visible, .an-sort:focus-visible, .an-bar:focus-visible { outline: 2px solid var(--red); outline-offset: 1px; }
.an-filter { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--slate-600); }
.an-select { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--slate-200); border-radius: 6px; background: #fff; color: var(--slate-800); max-width: 260px; }

#statsBox .stat-grid { margin-bottom: 8px; }

.an-chart { margin-top: 22px; }
.an-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.an-chart-title { font-size: 13px; font-weight: 700; color: var(--slate-900); }
.an-chart-total { font-weight: 400; color: var(--slate-400); margin-left: 8px; font-size: 12px; }
.an-chart-note { font-size: 11px; color: var(--slate-400); margin: -4px 0 8px; }
.an-chart-empty { font-size: 12px; color: var(--slate-400); padding: 10px 12px; background: var(--slate-100); border-radius: 8px; }

.an-chart-body { display: flex; gap: 8px; height: 140px; }
.an-axis { position: relative; width: 34px; flex: none; }
.an-axis-label { position: absolute; right: 0; transform: translateY(50%); font-size: 10px; line-height: 1; color: var(--slate-400); font-variant-numeric: tabular-nums; }
.an-plot { position: relative; flex: 1; min-width: 0; }
.an-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--slate-200); }
.an-grid.is-zero { border-top: 1px solid var(--slate-400); }
.an-bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.an-bar { flex: 1; min-width: 0; position: relative; border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 3px 3px 0 0; }
.an-bar:hover, .an-bar.is-pinned { background: rgba(200, 30, 45, 0.07); }
.an-bar-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--red); border-radius: 2px 2px 0 0; opacity: 0.85; }
.an-bar:hover .an-bar-fill, .an-bar.is-pinned .an-bar-fill { opacity: 1; background: var(--red-dark); }
.an-bar.is-zero .an-bar-fill { height: 0 !important; }

.an-xaxis { display: flex; gap: 2px; margin-left: 42px; margin-top: 6px; height: 14px; }
.an-x { flex: 1; min-width: 0; position: relative; font-size: 10px; color: var(--slate-400); }
.an-x { white-space: nowrap; overflow: visible; text-align: center; display: flex; justify-content: center; }
.an-x:last-child { justify-content: flex-end; }   /* today's label ends at the chart's edge */

.an-tip { position: fixed; z-index: 200; min-width: 200px; max-width: 320px; background: var(--slate-900); color: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.25); font-size: 12px; pointer-events: auto; }
.an-tip[hidden] { display: none; }
.an-tip-day { color: var(--slate-400); font-size: 11px; margin-bottom: 2px; }
.an-tip-num { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.an-tip-empty { color: var(--slate-400); }
.an-tip-list { border-top: 1px solid rgba(255,255,255,0.12); padding-top: 6px; display: grid; gap: 4px; }
.an-tip-row { display: flex; justify-content: space-between; gap: 12px; }
.an-tip-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.an-tip-val { color: #fecaca; white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-tip-more, .an-tip-hint { color: var(--slate-400); font-size: 11px; margin-top: 4px; }

.an-table-wrap { margin-top: 26px; }
.an-table-scroll { overflow-x: auto; }
.an-table { width: 100%; border-collapse: collapse; font-size: 12px; }
/* Headings wrap and cells are snug so every table fits its card without sideways scrolling (Chris, 2026-11-05). */
.an-table th { text-align: center; border-bottom: 1px solid var(--slate-200); padding: 0; white-space: normal; vertical-align: bottom; }
.an-table th:first-child { text-align: left; }
.an-sort { font: inherit; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate-600); background: none; border: 0; padding: 8px 5px; line-height: 1.25; cursor: pointer; }
.an-sort.is-on { color: var(--slate-900); }
.an-sort-dir { white-space: nowrap; }
.an-table td { padding: 7px 5px; border-bottom: 1px solid var(--slate-100); font-variant-numeric: tabular-nums; }
.an-table td.num { text-align: center; }   /* centered in their columns (Chris, 2026-11-02) */
.an-table td.an-email { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-table tbody tr { cursor: pointer; }
.an-table tbody tr:hover { background: var(--slate-100); }
.an-table tbody tr.is-on { background: var(--red-bg); }
.an-table tbody tr.is-quiet td { color: var(--slate-400); }
.an-table tbody tr:focus-visible { outline: 2px solid var(--red); outline-offset: -2px; }

.an-foot { margin-top: 14px; font-size: 11px; color: var(--slate-400); }

@media (max-width: 600px) {
  #statsBox .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-chart-body { height: 120px; }
  .an-select { max-width: 200px; }
}
