/* AGS tool results card — shared by the AGS Validator and AGS→Excel tools.
 * Built client-side by static/assets/js/pages/ags-validator.js +
 * static/assets/js/pages/ags-to-excel.js and loaded from
 * templates/apps/tools/agsvalidator/runTool.html +
 * templates/apps/tools/agstoexcel/runTool.html.
 *
 * Theme-aware (light + :root.dark-version). Both tools emit the SAME markup so
 * the two results panels look identical. Upload-card styles live in
 * ags-upload.css — do NOT add them here (and don't edit that shared file). */

.agr-card {
  --agr-surface: #ffffff;
  --agr-inset: #fafbfc;
  --agr-border: #eaecf1;
  --agr-hair: #eef0f4;
  --agr-ink: #344767;
  --agr-label: #8a90a2;
  --agr-sub: #67748e;
  --agr-accent: var(--agr-border);
  --agr-shadow: 0 8px 26px rgba(20, 20, 43, 0.08);

  max-width: 640px;
  margin: 0 auto;
  background: var(--agr-surface);
  /* max-width/centering below is overridden to fill the column on the
   * two-column tool pages — see the `.ags-tool-2col .agr-card` rule at the end. */
  border: 1px solid var(--agr-border);
  border-top: 3px solid var(--agr-accent);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--agr-shadow);
  animation: agr-in 0.28s ease-out both;
}

@keyframes agr-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .agr-card { animation: none; }
}

/* ── status header ── */
.agr-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--agr-hair);
}
.agr-status-badge {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.16);
}
.agr-status-badge .material-symbols-rounded { font-size: 30px; line-height: 1; }
.agr-status-text { min-width: 0; }
.agr-status-headline {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--agr-ink);
}
.agr-status-headline .agr-num {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.agr-status-sub {
  margin: 3px 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--agr-sub);
}

/* ── status variants (class sits on .agr-card) ── */
.agr-card.agr-ok      { --agr-accent: #4caf50; }
.agr-card.agr-warn    { --agr-accent: #fb8c00; }
.agr-card.agr-neutral { --agr-accent: #8a90a2; }

.agr-ok   .agr-status       { background: linear-gradient(180deg, rgba(76, 175, 80, 0.10), rgba(76, 175, 80, 0)); }
.agr-ok   .agr-status-badge { background: linear-gradient(135deg, #66bb6a, #43a047); }

.agr-warn .agr-status       { background: linear-gradient(180deg, rgba(251, 140, 0, 0.13), rgba(251, 140, 0, 0)); }
.agr-warn .agr-status-badge { background: linear-gradient(135deg, #ffa726, #fb8c00); }
.agr-warn .agr-num          { color: #e07b00; }

.agr-neutral .agr-status       { background: linear-gradient(180deg, rgba(103, 116, 142, 0.10), rgba(103, 116, 142, 0)); }
.agr-neutral .agr-status-badge { background: linear-gradient(135deg, #8a97a8, #67748e); }

/* ── metadata: mini stat tiles ── */
.agr-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 24px 4px;
}
@media (min-width: 576px) {
  .agr-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.agr-tile {
  min-width: 0;
  padding: 12px 14px;
  background: var(--agr-inset);
  border: 1px solid var(--agr-hair);
  border-radius: 12px;
}
.agr-tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--agr-label);
}
.agr-tile-label .material-symbols-rounded { font-size: 16px; color: var(--agr-label); }
.agr-tile-value {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--agr-ink);
  overflow-wrap: anywhere;
}

/* ── download actions ── */
.agr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 24px 20px;
}
.agr-actions .agr-dl {
  flex: 1 1 160px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── dark mode ── */
:root.dark-version .agr-card {
  --agr-surface: #272727;
  --agr-inset: #1f1f1f;
  --agr-border: rgba(255, 255, 255, 0.07);
  --agr-hair: rgba(255, 255, 255, 0.07);
  --agr-ink: rgba(255, 255, 255, 0.92);
  --agr-label: rgba(255, 255, 255, 0.5);
  --agr-sub: rgba(255, 255, 255, 0.62);
  --agr-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
}
:root.dark-version .agr-warn .agr-num { color: #ffb74d; }
:root.dark-version .agr-ok   .agr-status { background: linear-gradient(180deg, rgba(76, 175, 80, 0.18), rgba(76, 175, 80, 0)); }
:root.dark-version .agr-warn .agr-status { background: linear-gradient(180deg, rgba(251, 140, 0, 0.20), rgba(251, 140, 0, 0)); }
:root.dark-version .agr-neutral .agr-status { background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)); }

/* The outline download button is invisible on the dark card by default — the
 * theme only lightens .btn-outline-primary, not -dark (documented gotcha). */
:root.dark-version .agr-card .btn-outline-dark {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.28);
}
:root.dark-version .agr-card .btn-outline-dark:hover,
:root.dark-version .agr-card .btn-outline-dark:focus {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.42);
}

/* On the two-column tool pages (AGS→Excel, AGS Validator) the result card fills
 * its right column instead of staying capped + centred. Scoped to the wrapper
 * class the tool templates add, so any other/full-page use of .agr-card is
 * unaffected. */
.ags-tool-2col .agr-card { max-width: none; margin: 0; }
