/*
 * Trial History page styles (public/history.css)
 * Loaded on top of the shared style.css design tokens.
 */

.history-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.history-masthead h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
  font-weight: 700;
}

.history-subtitle {
  margin: 0;
  max-width: 70ch;
  color: #9aa4b5;
  font-size: 0.9rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- controls */

.history-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  border: 1px solid #2a3140;
  background: #161b23;
  border-radius: 10px;
  padding: 12px 16px;
  margin: 18px 0 8px;
}

.history-weekpick {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-weekpick label {
  color: #9aa4b5;
  font-size: 0.85rem;
}

.history-weekpick select {
  background: #0f131a;
  color: #e6ebf2;
  border: 1px solid #2a3140;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.9rem;
  min-width: 220px;
}

.history-weekmeta {
  color: #9aa4b5;
  font-size: 0.85rem;
  flex: 1 1 auto;
  min-width: 200px;
}

/* Admin-only block: hidden unless logged in as a site admin. Scoped to
   this page so other pages' nav rules (style.css) keep working. */
/* ------------------------------------------------------------------- groups */

.history-group { margin-top: 26px; }

.history-group .section-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text-primary);
}

.history-none {
  color: var(--text-muted);
  font-style: italic;
  padding: 8px 2px;
  font-size: 0.9rem;
}

/* The trial blocks are the equivalent of the Stats page's .stats-panel:
   the same shared theme tokens (see style.css) so the stats tables inside
   render on exactly the same surface — same background, border and shadow
   as stats.css's .stats-panel, and the table's own row borders/hover
   (also token-based in stats.css) read identically on both pages. */
.trial-block {
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: var(--surface);
  margin-bottom: 14px;
  overflow: hidden;
}

.trial-block-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  background: transparent;
  border-bottom: 1px solid var(--border-soft);
}

.trial-block-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.trial-block-count {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* The trial's tier + points, mirrored from the in-game Guild -> Trials
   tile (the gold tier line above the grey "N pts" line) so each table
   head answers the same question the game panel does. */
.trial-block-tier {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.trial-block-points {
  color: var(--text-secondary);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* --------------------------------------------------------------------- misc */

.history-empty {
  margin-top: 30px;
  border: 1px dashed #2a3140;
  border-radius: 10px;
  padding: 26px;
  color: #9aa4b5;
}

.history-empty h2 {
  margin: 0 0 8px;
  color: #e6ebf2;
  font-size: 1.1rem;
}

.history-empty p {
  margin: 0;
  max-width: 72ch;
  line-height: 1.5;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .history-wrap { padding: 14px 12px 40px; }
  .history-controls { gap: 10px; }
  .history-weekpick select { min-width: 0; flex: 1; }
}

/* --------------------------------------------------------------- gear tip */
/* Hover a member's name in a trial table -> the loadout popup. The
   .sim-loadout-tip / .sim-tip-* rules live in the SHARED public/sim-tip.css
   (linked by both History and Combat — no more 1:1 mirror to keep in sync).
   History-only tweak: cap the menu's height on short viewports so it
   scrolls instead of overflowing. */
.sim-loadout-tip {
  max-height: 78vh;
  overflow-y: auto;
}

/* The skilling/combat tables (Stats-page table style, see stats.css) use
   the .member-card-head element as their name cell — neutralise the
   card's bottom margin so row heights match the other table cells, and
   take on the table's font size so the name reads exactly like the Stats
   page's name links. The name is a clickable link to the member's
   profile on the Members page (accent color / weight / hover underline
   come from stats.css's .stats-table td.name-cell a); pointer cursor
   (hovering the name still opens the gear-loadout tip). */
.stats-table .member-card-head {
  margin-bottom: 0;
  cursor: pointer;
  font-size: inherit;
}

/* Uniform column geometry across ALL skilling blocks. Every block is a
   separate <table> and stats-table sizes its columns automatically, so the
   WORK DONE / LOADOUT # columns landed at different x offsets per trial
   and the numbers looked misaligned down the page. table-layout: fixed
   plus the first-row (th) widths pins every block to the same layout.
   Scoped to #skillingSection so the Stats page's own (many-column,
   searchable) tables keep their auto sizing. */
#skillingSection table.stats-table {
  table-layout: fixed;
}
#skillingSection table.stats-table th:nth-child(1) { width: 50%; }
#skillingSection table.stats-table th:nth-child(2) { width: 25%; }
#skillingSection table.stats-table th:nth-child(3) { width: 25%; }

/* Same pinning for the combat tables (6 fixed columns: member, damage
   dealt, healing done, damage taken, role, loadout #). */
#combatSection table.stats-table {
  table-layout: fixed;
}
#combatSection table.stats-table th:nth-child(1) { width: 25%; }
#combatSection table.stats-table th:nth-child(n+2) { width: 15%; }

/* ------------------------------------------------- guild sim-context block */
/* The week's frozen baseline (userscript v1.37.2+): building/shrine level
   chips and one line per member's purchased guild buffs. The blocks reuse
   .trial-block so they sit on the same surface as the trial tables. */
/* The global `section { display: flex }` rule beats the [hidden] attribute,
   same trap style.css documents for the admin sections — pin it off. */
#guildContextGroup[hidden] { display: none !important; }

.history-ctx-note { margin: 0 0 14px; font-size: 0.85rem; }

.history-ctx-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 14px 14px;
}

.history-ctx-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #161b23;
  padding: 5px 10px;
  font-size: 0.82rem;
}

/* Combat shrines carry the gold tint of the tier chips above them — they
   are the ones that cap members' buff levels. */
.history-ctx-shrine {
  background: var(--accent-wash);
}

.history-ctx-name {
  color: var(--text-primary);
  font-weight: 600;
}

.history-ctx-level {
  color: var(--text-secondary);
  font-size: 0.76rem;
  white-space: nowrap;
}

.history-ctx-legend {
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 8px 14px 10px;
}

.history-ctx-member {
  border-top: 1px solid var(--border-soft);
  padding: 9px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.history-ctx-member-name {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 4px;
}

.history-ctx-member .history-ctx-chip {
  padding: 2px 8px;
}

.history-ctx-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}


