/* The weekly return loop (Round 3, WS3): Videos tab views (My donors, Team this week),
   the per-video results view, Home activation and watcher names. Linked from
   index.html. Logic in js/video-team.js and js/video-detail.js.
   The dashboard is dark-only, so these use its fixed palette (#222a34 cards). */

#dashboard {
  --vt-card: #222a34;
  --vt-raise: rgba(255, 255, 255, 0.06);
  --vt-rule: rgba(255, 255, 255, 0.1);
  --vt-text: #fff;
  --vt-muted: rgba(255, 255, 255, 0.66);
  --vt-accent: #7dd3fc;
  --vt-watched: #86efac;
  --vt-call: #fcd34d;
  --vt-sent: #c4b5fd;
}

/* ---------- view switcher ---------- */
.vt-views { display: flex; gap: 0.25rem; margin: 0.25rem 0 1.25rem; padding: 0.25rem; width: max-content; max-width: 100%; overflow-x: auto;
  border-radius: 0.7rem; background: var(--vt-raise); }
.vt-views a { padding: 0.4rem 0.85rem; border-radius: 0.5rem; font-size: 0.85rem; font-weight: 600; color: var(--vt-muted); white-space: nowrap; text-decoration: none; }
.vt-views a:hover { color: var(--vt-text); }
.vt-views a[aria-current="page"] { background: #3a4a5c; color: var(--vt-text); }
.vt-views a:focus-visible { outline: 2px solid var(--vt-accent); outline-offset: 1px; }

/* ---------- panels (My donors, Team) ---------- */
.vt-panel { display: block !important; background: var(--vt-card); border-radius: 1rem; padding: 1.5rem; color: var(--vt-text); }
.vt-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.vt-panel-head h2 { font-family: 'PPFragment TextRegular'; font-size: 1.3rem; font-weight: 800; margin: 0; }
.vt-panel-head p { margin: 0.25rem 0 0; color: var(--vt-muted); font-size: 0.88rem; }
.vt-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.vt-controls .select { background: rgba(53, 79, 102, 0.27); border: 0.15rem solid rgba(var(--buiilderFrontRGB)); color: #fff; width: auto; }
.vt-muted { color: var(--vt-muted); font-size: 0.85rem; }
.vt-error { color: #fca5a5; font-size: 0.88rem; }
.vt-note { margin: 0.5rem 0 0; padding: 0.5rem 0.75rem; border-radius: 0.5rem; background: var(--vt-raise); font-size: 0.85rem; }
.vt-empty { padding: 1.5rem 0; color: var(--vt-muted); display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; }
.vt-empty p { margin: 0; }
.vt-foot { margin: 1rem 0 0; font-size: 0.78rem; }

.vt-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }
.vt-chips span { font-size: 0.78rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 1rem; background: var(--vt-raise); color: var(--vt-muted); }

.vt-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.vt-table th { text-align: left; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--vt-muted); padding: 0 0.5rem 0.5rem; border-bottom: 1px solid var(--vt-rule); }
.vt-table td { padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--vt-rule); vertical-align: middle; }
.vt-table th:first-child, .vt-table td:first-child { padding-left: 0; }
.vt-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.vt-name { font-weight: 600; color: var(--vt-text); }
a.vt-name:hover, .vt-link:hover { text-decoration: underline; text-underline-offset: 0.2rem; }
.vt-link { color: var(--vt-muted); }
.vt-actions { display: inline-flex; gap: 0.25rem; justify-content: flex-end; flex-wrap: wrap; }
.vt-table td.vt-actions { display: table-cell; text-align: right; white-space: nowrap; }
.vt-actions .btn { color: var(--vt-text); }
.vt-actions .material-symbols-outlined { font-size: 1rem; }

.vt-status { display: inline-block; font-size: 0.72rem; font-weight: 700; line-height: 1; padding: 0.3rem 0.5rem; border-radius: 0.3rem; background: var(--vt-raise); color: var(--vt-muted); white-space: nowrap; }
.vt-status[data-status="Call next"] { background: rgba(252, 211, 77, 0.18); color: var(--vt-call); }
.vt-status[data-status="Watched"] { background: rgba(134, 239, 172, 0.16); color: var(--vt-watched); }
.vt-status[data-status="Opened"] { background: rgba(125, 211, 252, 0.16); color: var(--vt-accent); }
.vt-status[data-status="Not yet"] { background: rgba(196, 181, 253, 0.14); color: var(--vt-sent); }
.vt-status[data-status="Shared (not confirmed)"] { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.vt-chips span[data-status="Call next"] { color: var(--vt-call); }
.vt-chips span[data-status="Watched"] { color: var(--vt-watched); }

/* team trend: two bars per week, sent and watched */
.vt-trend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) ; gap: 0.75rem; align-items: end; margin: 0 0 1.25rem; max-width: 32rem; }
.vt-trend-week { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 0; }
.vt-bars { height: 5rem; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 0.25rem; border-bottom: 1px solid var(--vt-rule); }
.vt-bars i { display: block; width: 0.9rem; min-height: 2px; border-radius: 0.2rem 0.2rem 0 0; }
.vt-bar-sent, .vt-key-sent { background: var(--vt-sent); }
.vt-bar-watched, .vt-key-watched { background: var(--vt-watched); }
.vt-trend-num { font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums; display: flex; gap: 0.5rem; }
.vt-num-sent { color: var(--vt-sent); }
.vt-num-watched { color: var(--vt-watched); }
.vt-trend-label { font-size: 0.72rem; color: var(--vt-muted); }
.vt-legend { grid-column: 1 / -1; display: flex; align-items: center; gap: 0.35rem; margin: 0; font-size: 0.75rem; color: var(--vt-muted); }
.vt-legend span { display: inline-block; width: 0.6rem; height: 0.6rem; border-radius: 0.15rem; margin-left: 0.5rem; }
.vt-legend span:first-child { margin-left: 0; }
.vt-spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 1.4rem; }
.vt-spark i { display: block; width: 0.45rem; background: var(--vt-sent); border-radius: 1px; }
.vt-spark i[data-zero] { background: var(--vt-rule); }

/* ---------- card: See who watched ---------- */
#dashboard [data-video-tab] .vt-card-results { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem;
  padding: 0.55rem 0.9rem; background: var(--vt-raise); border-top: 1px solid var(--vt-rule); color: var(--vt-text); font-size: 0.8rem; font-weight: 700;
  border-radius: 0 0 0.5rem 0.5rem; text-decoration: none; }
#dashboard [data-video-tab] .vt-card-results:hover, #dashboard [data-video-tab] .vt-card-results:focus-visible { background: rgba(255, 255, 255, 0.12); }
#dashboard [data-video-tab] .vt-card-results .material-symbols-outlined { color: var(--vt-accent); }
#dashboard [data-video-tab] .vt-card-results .material-symbols-outlined { font-size: 1rem; }

/* ---------- results view (modal) ---------- */
.vt-modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; background: rgba(8, 12, 18, 0.6); }
.vt-modal-card { width: 100%; max-width: 44rem; max-height: 88vh; overflow: auto; border-radius: 1rem; background: #1d232a; color: var(--vt-text); padding: 1.5rem; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.vt-modal-small { max-width: 28rem; }
.vt-modal-small h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 0.5rem; }
.vt-modal-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.vt-modal-head h2 { font-size: 1.25rem; font-weight: 700; margin: 0; text-wrap: balance; }
.vt-modal-head .btn { color: var(--vt-text); }
.vt-eyebrow { margin: 0 0 0.2rem; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--vt-muted); }

.vt-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.vt-stats > div { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.7rem 0.75rem; border-radius: 0.6rem; background: var(--vt-raise); min-width: 0; }
.vt-stats strong { font-size: 1.35rem; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; }
.vt-stats strong small { font-size: 0.85rem; font-weight: 600; color: var(--vt-muted); }
.vt-stats span { font-size: 0.75rem; color: var(--vt-muted); }

.vt-curve { margin: 0 0 1rem; }
.vt-curve figcaption { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.4rem; }
.vt-curve figcaption span { font-weight: 400; color: var(--vt-muted); }
.vt-plot { position: relative; height: 6rem; border-bottom: 1px solid var(--vt-rule);
  background: repeating-linear-gradient(to bottom, var(--vt-rule) 0 1px, transparent 1px 25%); }
.vt-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.vt-area { fill: rgba(125, 211, 252, 0.18); }
.vt-line { fill: none; stroke: var(--vt-accent); stroke-width: 2; stroke-linejoin: round; }
.vt-axis { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--vt-muted); margin-top: 0.25rem; }

.vt-callnext { padding: 0.75rem 0.9rem; border-radius: 0.6rem; background: rgba(252, 211, 77, 0.12); margin-bottom: 0.5rem; }
#dashboard .vt-callnext h3 { font-family: inherit; line-height: 1.3; display: flex; align-items: center; gap: 0.35rem; margin: 0 0 0.2rem; font-size: 0.9rem; font-weight: 700; color: var(--vt-call); }
.vt-callnext h3 .material-symbols-outlined { font-size: 1.1rem; }
.vt-callnext p { margin: 0; font-size: 0.83rem; color: var(--vt-muted); }

.vt-rows { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.vt-rows li { padding: 0.75rem 0; border-bottom: 1px solid var(--vt-rule); display: flex; flex-direction: column; gap: 0.4rem; }
.vt-rows li[data-status="Call next"] { box-shadow: inset 3px 0 0 var(--vt-call); padding-left: 0.75rem; }
.vt-row-main { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.vt-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--vt-muted); }
.vt-bar { height: 0.3rem; border-radius: 1rem; background: var(--vt-rule); overflow: hidden; }
.vt-bar i { display: block; height: 100%; border-radius: inherit; background: var(--vt-accent); }
.vt-rows li[data-status="Watched"] .vt-bar i, .vt-rows li[data-status="Call next"] .vt-bar i { background: var(--vt-watched); }

/* ---------- Home ---------- */
.vt-activate { display: flex; justify-content: space-between; align-items: flex-end; gap: 1.5rem; flex-wrap: wrap; }
.vt-activate > div:first-child { flex: 1 1 22rem; min-width: 0; }
.vt-activate-sub { margin: 0.4rem 0 0; color: var(--vt-muted); font-size: 0.9rem; line-height: 1.55; max-width: 36rem; }
.vt-activate-list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.vt-activate-list li { display: flex; flex-direction: column; padding: 0.5rem 0.75rem; border-radius: 0.6rem; background: var(--vt-raise); min-width: 9rem; }
.vt-activate-list li span { font-weight: 600; color: var(--vt-text); }
.vt-activate-list li small { font-size: 0.75rem; color: var(--vt-muted); }
.vt-watchers { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--vt-rule); }
#dashboard .vt-watchers h3 { font-family: inherit; line-height: 1.3; margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--vt-muted); }
.vt-watchers ul { list-style: none; margin: 0; padding: 0; }
.vt-watchers li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--vt-rule); }
.vt-watchers li:last-child { border-bottom: 0; }
.vt-watchers li > div { min-width: 0; display: flex; flex-direction: column; }
.vt-watchers small { font-size: 0.78rem; color: var(--vt-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-watchers small a { color: inherit; text-decoration: underline; text-underline-offset: 0.15rem; }

@media (max-width: 640px) {
  .vt-panel { padding: 1rem; }
  .vt-stats { grid-template-columns: 1fr 1fr; }
  /* below the dashboard's fixed mobile bar */
  .vt-modal { padding: 0; top: 57px; }
  .vt-modal-card { max-height: 100vh; height: 100%; border-radius: 0; padding: 1rem 16px; }
  .vt-modal-head { flex-direction: column-reverse; gap: 0.5rem; }
  .vt-modal-head .vt-controls { align-self: stretch; justify-content: space-between; }
  .vt-table thead { display: none; }
  .vt-table tr { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.5rem; padding: 0.6rem 0; border-bottom: 1px solid var(--vt-rule); }
  .vt-table td { padding: 0; border: 0; }
  .vt-table td.vt-actions { grid-column: 1 / -1; text-align: left; }
  .vt-watchers li { flex-wrap: wrap; }
}
