/* LeaderLab History page. Builds on styles.css (palette, topbar, footer, buttons). Spec: docs/specs/accounts-history.md */

:root { --purple: #a970ff; }

.hist [hidden] { display: none !important; }
/* No bottom nav on this page, so drop the landing page's mobile padding for it. */
@media (max-width: 719.98px) { body { padding-bottom: 0; } }

.topbar__right { display: flex; align-items: center; gap: 10px; min-width: 0; }


.hist { padding-block: 36px 56px; max-width: 820px; }
.hist__head { margin-bottom: 20px; }
.hist__title { margin-top: 6px; font: 700 clamp(34px, 6vw, 52px)/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Small buttons ---------- */
.hbtn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: 600 13px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer;
}
.hbtn:hover { border-color: var(--muted); }
.hbtn:disabled { opacity: 0.6; cursor: progress; }
.hbtn--gold { border-color: rgba(242, 181, 58, 0.5); color: var(--gold); }
.hbtn--danger { border-color: rgba(226, 67, 59, 0.45); color: #ff7a72; }
.hbtn--danger:hover { border-color: var(--red); }

/* ---------- Account strip / guest banner ---------- */
.hist-account, .hist-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface);
}
.hist-banner { border-color: rgba(242, 181, 58, 0.3); background: linear-gradient(90deg, rgba(242, 181, 58, 0.08), var(--surface)); }
.hist-banner p { font-size: 14px; color: #c5cbe0; flex: 1 1 240px; }
.hist-account__who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 220px; }
.hist-account__who > div { min-width: 0; }
.hist-account__initial {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--gold); color: var(--gold); font: 700 18px/1 var(--display);
}
.hist-account__name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-account__email { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-account__actions { display: flex; flex-wrap: wrap; gap: 8px; }

.hist-confirm {
  flex: 1 1 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid rgba(226, 67, 59, 0.45); background: rgba(226, 67, 59, 0.08); font-size: 14px;
}
.hist-confirm__row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hist-confirm__err { margin-top: 8px; color: #ff7a72; font-size: 13px; }
.hist-confirm__err:empty { display: none; }

.hist-notice {
  margin-bottom: 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  border: 1px solid rgba(59, 123, 255, 0.4); background: rgba(59, 123, 255, 0.08); color: #c5d6ff;
}
.hist-loading { color: var(--muted); padding: 24px 0; }

/* ---------- List ---------- */
.hist-list { display: grid; gap: 10px; }
.hist-card {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: border-color 0.15s ease;
}
.hist-card:hover, .hist-card.is-open { border-color: #34406a; }
.hist-card__head {
  position: relative; display: grid; gap: 6px; width: 100%; padding: 14px 44px 14px 16px; text-align: left;
  background: none; border: 0; border-radius: var(--radius); cursor: pointer;
}
.hist-card__top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.hist-card__name {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font: 700 20px/1.15 var(--display); letter-spacing: 0.03em; text-transform: uppercase;
}
.hist-card__nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { flex: none; display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.hist-card__date { flex: none; font-size: 12px; color: var(--muted); }
.hist-card__verdict { font: 700 15px/1.1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--vc, var(--text)); }
.hist-card__meta { font-size: 13px; color: var(--muted); }
.hist-card__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.hist-badge {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: rgba(242, 181, 58, 0.1); border: 1px solid rgba(242, 181, 58, 0.3); color: #f6cd74;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hist-card__chev {
  position: absolute; right: 16px; top: 16px; color: var(--muted); font-size: 14px; transition: transform 0.15s ease;
}
.hist-card.is-open .hist-card__chev { transform: rotate(180deg); color: var(--gold); }

.hist-card__panel { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.hist-blurb { margin-top: 12px; color: #c5cbe0; font-size: 14px; }
.hist-end { margin-top: 4px; color: var(--muted); font-size: 13px; }
.hist-sub { margin: 16px 0 8px; font: 600 12px/1 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

.hist-build { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hist-build li { min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.hist-build span { display: block; font: 600 10px/1.1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hist-build b { display: block; font: 700 22px/1.15 var(--display); color: var(--text); }
.hist-build em { display: block; font-style: normal; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hist-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; margin: 0; }
.hist-stats dt { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hist-stats dd { margin: 2px 0 0; font-weight: 700; }

.hist-el, .hist-ach { display: grid; gap: 6px; font-size: 14px; }
.hist-el li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.hist-el__yr { font-weight: 700; font-variant-numeric: tabular-nums; }
.hist-el__res { font: 700 13px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.hist-el__res.won { color: var(--green); }
.hist-el__res.lost { color: #ff7a72; }
.muted { color: var(--muted); }
.hist-fails { margin-top: 8px; font-size: 13px; }

.hist-card__del { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; }

.hist-more { display: flex; justify-content: center; margin-top: 18px; }

/* ---------- Empty ---------- */
.hist-empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.hist-empty__big { font: 700 32px/1 var(--display); text-transform: uppercase; letter-spacing: 0.04em; }
.hist-empty__sub { margin: 8px 0 20px; color: var(--muted); }

@media (max-width: 560px) {
  .hist-build { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hist-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hist-card__name { font-size: 18px; }
}
@media (max-width: 440px) {
  .hist-card__top { flex-direction: column; gap: 2px; }
  .hist-empty .btn { width: 100%; }
}
