/* ==========================================================================
   PNLE-REVIEW — Results page
   Overall score, stats strip, score-progress chart, subject bars,
   results table, insights and the attempt-details dialog.
   ========================================================================== */

/* Fit-to-screen rows: top bar · top section · bottom section (design 177 : 130) */
.main--results { --fit-rows: auto 177fr 130fr; }

/* ============================== Grid ============================== */
.res-top {
  display: grid;
  grid-template-columns: minmax(0, 133fr) minmax(0, 335fr);
  gap: 14px;
  min-height: 0;
}
.res-right {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}
.res-charts {
  display: grid;
  grid-template-columns: minmax(0, 170fr) minmax(0, 157fr);
  gap: 14px;
  min-height: 0;
}
.res-bottom {
  display: grid;
  grid-template-columns: minmax(0, 327fr) minmax(0, 138fr);
  gap: 14px;
  min-height: 0;
}

/* ============================== Overall score ============================== */
.overall {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 30px;
  text-align: center;
}
.overall__ring { margin-top: auto; }
.overall__caption { margin-bottom: auto; }
.overall__title { font-size: 15px; font-weight: 600; color: var(--text); }
.overall__ring { position: relative; }
.ring--lg { width: 176px; height: 176px; }
.ring--lg circle { stroke-width: 10; }
.ring--lg .ring__label { padding-bottom: 22px; font-size: 36px; }
.overall__verdict {
  position: absolute;
  top: 58%;
  left: 0;
  right: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.overall__caption { font-size: 11px; color: var(--muted); }
.overall__flowers { position: absolute; bottom: 4px; width: 92px; pointer-events: none; }
.overall__flowers--left { left: -6px; transform: scaleX(-1) rotate(-18deg); }
.overall__flowers--right { right: -8px; transform: rotate(-18deg); }

/* ============================== Stats strip ============================== */
.stat-strip { padding: 16px 8px; }
.stat-strip__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-strip__list li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 2px 22px;
  border-left: 1px solid var(--line);
}
.stat-strip__list li:first-child { border-left: 0; }
.stat-strip__label { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.stat-strip__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.stat-strip__icon .icon { width: 15px; height: 15px; }
.stat-strip__list strong { padding-left: 38px; font-size: 24px; font-weight: 600; color: var(--text); }

/* ============================== Score progress ============================== */
.progress-chart { display: flex; flex-direction: column; padding: 14px 16px 10px; }
.progress-chart .card__head { margin-bottom: 6px; }
.progress-chart .card__title,
.subject-chart .card__title { font-size: 13.5px; }
.trend-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 999px;
}
.trend-chip .icon { width: 12px; height: 12px; color: currentColor !important; }
.trend-chip.is-up { color: #24835b; background: var(--tone-green); }
.trend-chip.is-down { color: var(--pink); background: var(--tone-pink); }
.trend-chip.is-down .icon { transform: scaleY(-1); }

.line-chart { position: relative; flex: 1; min-height: 170px; cursor: crosshair; }
.line-chart svg { position: absolute; inset: 0; display: block; }
.lc-grid { stroke: var(--line); stroke-width: 1; }
.lc-axis { fill: var(--muted); font-size: 9.5px; font-family: var(--font); }
.lc-pass { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.8; }
.lc-pass-label { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.lc-area { fill: url(#lcFill); }
.lc-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lc-last { fill: var(--primary); stroke: var(--card-solid); stroke-width: 2; }
.lc-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.lc-dot { fill: var(--primary); stroke: var(--card-solid); stroke-width: 2; }
.lc-hit { fill: transparent; }

/* ============================== Subject bars ============================== */
.subject-chart { display: flex; flex-direction: column; padding: 14px 16px 12px; }
.subject-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.subject-bar {
  display: grid;
  grid-template-columns: minmax(90px, 0.9fr) minmax(0, 1fr) 34px;
  align-items: center;
  gap: 12px;
  padding: 6px 4px;
  font-size: 11px;
  color: var(--text);
  border-radius: 6px;
  outline: none;
}
.subject-bar:hover,
.subject-bar:focus-visible { background: var(--primary-softer); }
.subject-bar .bar { height: 8px; }
.subject-bar__pct { text-align: right; color: var(--text-2); }
.fill--subject { background: linear-gradient(90deg, #7ea7ec, var(--primary)); }

/* ============================== Table ============================== */
.recent-results { display: flex; flex-direction: column; padding: 14px 16px 10px; }
.recent-results .card__head { margin-bottom: 8px; }
.recent-results .card__title { font-size: 14px; }
.table-wrap { flex: 1; min-height: 0; overflow: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.results-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 0;
  text-align: left;
  font-weight: 500;
  background: var(--subtle);
}
.results-table th:first-child { border-radius: 8px 0 0 8px; }
.results-table th:last-child { border-radius: 0 8px 8px 0; }
.results-table th button,
.results-table th.results-table__details {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}
.results-table th button .icon { width: 12px; height: 12px; opacity: 0.45; transition: transform 0.15s ease; }
.results-table th button:hover { color: var(--text); }
.results-table th button.is-sorted { color: var(--text); }
.results-table th button.is-sorted .icon { opacity: 1; color: var(--primary); }
.results-table th button.is-asc .icon { transform: rotate(180deg); }
.results-table td {
  padding: 10px 12px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.results-table tbody tr:last-child td { border-bottom: 0; }
.results-table tbody tr:hover td { background: var(--primary-softer); }
.results-table td:nth-child(2),
.results-table td:nth-child(3) { color: var(--text-2); }
.results-table__name { max-width: 0; width: 38%; overflow: hidden; text-overflow: ellipsis; }
.results-table__details { width: 1%; text-align: center; }
.results-table__empty { padding: 30px 0 !important; text-align: center; color: var(--muted) !important; }
.sample-tag {
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 8.5px;
  font-weight: 500;
  color: var(--muted);
  background: var(--subtle-2);
  border-radius: 4px;
  vertical-align: 1px;
}
.score { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--text); }
.score .icon { width: 13px; height: 13px; stroke-width: 2.5; }
.score.is-pass .icon { color: #36a271; }
.score.is-below .icon { color: var(--orange); transform: scaleY(-1); }

/* ============================== Insights ============================== */
.insights { display: flex; flex-direction: column; padding: 14px 16px 12px; }
.insights .card__title { font-size: 14px; }
.insight-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  margin-top: 12px;
  padding-right: 30px;
}
.insight-list li { display: flex; align-items: flex-start; gap: 12px; }
.insight-list__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.insight-list__icon .icon { width: 15px; height: 15px; }
.insight-list p { font-size: 11.5px; line-height: 1.55; color: var(--text-2); }
.insight-list strong { color: var(--text); font-weight: 600; }
.insight-list a { color: var(--primary); text-decoration: underline; }
.insights__flower { position: absolute; right: -14px; bottom: -6px; width: 70px; transform: rotate(-40deg); pointer-events: none; }

/* ============================== Tooltip ============================== */
.chart-tip {
  position: fixed;
  z-index: 200;
  max-width: 240px;
  padding: 8px 11px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-2);
  background: var(--card-solid);
  border: 1px solid var(--card-border);
  border-radius: 9px;
  box-shadow: 0 10px 26px rgba(30, 50, 100, 0.18);
  pointer-events: none;
}
.chart-tip strong { display: block; font-size: 13px; color: var(--text); }
.chart-tip span { display: block; }
.chart-tip small { display: block; color: var(--muted); }

/* ============================== Details dialog ============================== */
.modal__summary {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--subtle);
  border-radius: 12px;
}
.modal__summary .ring { width: 86px; height: 86px; }
.modal__summary .ring__label { font-size: 18px; }
.modal__summary dl { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.modal__summary dt { font-size: 10.5px; color: var(--muted); }
.modal__summary dd { margin: 2px 0 0; font-size: 15px; font-weight: 600; color: var(--text); }
.modal h3 { margin: 18px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
.modal__topics li {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 52px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 11.5px;
}
.modal__topics li span:last-child { text-align: right; }

/* ============================== Breakpoints ============================== */
@media (max-width: 1320px) {
  .res-top { grid-template-columns: minmax(240px, 1fr) minmax(0, 2.4fr); }
  .res-bottom { grid-template-columns: minmax(0, 1fr); }
  .insight-list { flex-direction: row; flex-wrap: wrap; }
  .insight-list li { flex: 1 1 220px; }
}
@media (max-width: 1024px) {
  .res-top { grid-template-columns: minmax(0, 1fr); }
  .res-charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .stat-strip__list { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stat-strip__list li { border-left: 0; padding: 0 8px; }
  .results-table td:nth-child(2),
  .results-table th:nth-child(2) { display: none; }
  .modal__summary { flex-direction: column; }
}

/* Select & delete */
.recent-results__tools { display: flex; align-items: center; gap: 12px; }
.results-table .bulk-check { margin-right: 6px; vertical-align: middle; }
