/* Report shell shared across analyzers — uses --r-* report tokens */

.report-shell,
.report-scope .report-shell {
  background: var(--r-surface-2, #F8FAFC);
  border: 1px solid var(--r-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--r-shadow, 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06));
}
.report-shell__header,
.report-scope .report-shell__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--r-text-muted, #6B7280);
  font-size: 0.95rem;
}
.report-shell__title,
.report-scope .report-shell__title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-primary, var(--accent-primary));
}
.report-shell__badge,
.report-scope .report-shell__badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(var(--accent-primary-rgb), 0.12);
  border: 1px solid rgba(var(--accent-primary-rgb), 0.35);
  color: var(--color-primary, var(--accent-primary));
  font-weight: 700;
  font-size: 0.8rem;
}
.report-shell__meta,
.report-scope .report-shell__meta {
  color: var(--r-text-faint, #a7a7a7);
  font-size: 0.9rem;
}

/* Summary donut grid */
.report-shell__summary,
.report-scope .report-shell__summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.25rem;
  margin-bottom: 1.75em;
}
@media (max-width: 768px) {
  .report-shell__summary,
  .report-scope .report-shell__summary {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .report-shell__summary,
  .report-scope .report-shell__summary {
    grid-template-columns: 1fr;
  }
}

/* Summary card */
.report-shell__summary-card,
.report-scope .report-shell__summary-card {
  background: var(--r-surface-1, #FFFFFF);
  border: 1px solid var(--r-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 12px);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: var(--r-shadow, 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06));
}
.report-shell__summary-label,
.report-scope .report-shell__summary-label {
  color: var(--r-text-muted, #6B7280);
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

/* SVG donut */
.report-shell__donut,
.report-scope .report-shell__donut {
  width: 110px;
  height: 110px;
  margin: 0 auto;
}
/* Track circle — uses report dial token for theme-aware color */
.report-shell__donut-track,
.report-scope .report-shell__donut-track {
  stroke: var(--r-dial-track, #e5e7eb);
}
.report-shell__donut text,
.report-scope .report-shell__donut text {
  font-size: 1.5rem;
  font-weight: 700;
  paint-order: stroke fill;
}
.report-shell__donut-grade,
.report-scope .report-shell__donut-grade {
  margin-top: 0.35rem;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Reports: headings left-aligned */
.report-scope h1,
.report-scope h2,
.report-scope h3,
.report-scope h4,
.report-scope h5,
.report-scope h6 {
  text-align: left;
}

/* Resource bars */
.report-shell__bar-row,
.report-scope .report-shell__bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--r-text-muted, #6B7280);
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}
.report-shell__bar-label,
.report-scope .report-shell__bar-label {
  min-width: 90px;
  color: var(--r-text-faint, #9CA3AF);
  font-weight: 600;
}
.report-shell__bar-track,
.report-scope .report-shell__bar-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--r-dial-track, rgba(0,0,0,0.10));
  overflow: hidden;
}
.report-shell__bar-fill,
.report-scope .report-shell__bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-primary-dark));
}
.report-shell__bar-value,
.report-scope .report-shell__bar-value {
  min-width: 70px;
  text-align: right;
  color: var(--r-text, #111827);
  font-weight: 600;
}

/* Device grid used by Lighthouse/CWV */
.report-shell__grid,
.report-scope .report-shell__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}
.report-shell__card,
.report-scope .report-shell__card {
  background: var(--r-surface-1, #FFFFFF);
  border: 1px solid var(--r-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-lg, 12px);
  padding: 1rem;
  overflow: hidden;
  box-shadow: var(--r-shadow, 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06));
}
.report-shell__card-title,
.report-scope .report-shell__card-title {
  font-weight: 600;
  color: var(--r-text, #111827);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Screenshot link */
.report-shell__screenshot-link,
.report-scope .report-shell__screenshot-link {
  display: block;
  position: relative;
  width: 100%;
  max-width: 100%;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--r-border, rgba(0,0,0,0.08));
  overflow: hidden;
  background: var(--r-bg, #FFFFFF);
  padding-top: 36px;
}

.report-shell__screenshot-link::before,
.report-scope .report-shell__screenshot-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.01));
  border-bottom: 1px solid rgba(0,0,0,0.08);
  pointer-events: none;
}

.report-shell__screenshot-link::after,
.report-scope .report-shell__screenshot-link::after {
  content: '';
  position: absolute;
  top: 13px;
  left: 14px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 95, 86, 0.95);
  box-shadow:
    16px 0 0 rgba(255, 189, 46, 0.95),
    32px 0 0 rgba(39, 201, 63, 0.95);
  pointer-events: none;
}

.report-shell__screenshot,
.report-scope .report-shell__screenshot {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(520px, 75vh);
  display: block;
  border-radius: 0;
  border: none;
  object-fit: contain;
  background: var(--r-bg, #FFFFFF);
}

/* Metric grid */
.report-shell__metric-grid,
.report-scope .report-shell__metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}
.report-shell__metric-grid--cwv,
.report-scope .report-shell__metric-grid--cwv {
  border-top: 1px solid var(--r-border, rgba(0,0,0,0.06));
  padding-top: 0.75rem;
}

/* Locked content overlay */
.report-shell__lock-overlay,
.report-scope .report-shell__lock-overlay {
  position: relative;
  overflow: hidden;
}
.report-shell__lock-overlay .is-locked,
.report-scope .report-shell__lock-overlay .is-locked {
  position: relative;
  z-index: 0;
  filter: blur(2px);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.report-shell__lock-overlay::after,
.report-scope .report-shell__lock-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%);
  z-index: 1;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.report-shell__lock-overlay [data-paid-unlock-card],
.report-scope .report-shell__lock-overlay [data-paid-unlock-card] {
  position: relative;
  z-index: 2;
}
.report-shell__lock-cta,
.report-scope .report-shell__lock-cta {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dark));
  color: var(--accent-primary-contrast);
  border: none;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(var(--accent-primary-rgb), 0.25);
}

/* ========================================
   TABLE THEMING
   ======================================== */
.report-scope table {
  border-collapse: collapse;
  width: 100%;
}
.report-scope th,
.report-scope td {
  border-bottom: 1px solid var(--r-table-divider, rgba(0,0,0,0.06));
  padding: 0.5rem 0.75rem;
  text-align: left;
  color: var(--r-text, inherit);
}
.report-scope th {
  font-weight: 600;
  color: var(--r-text-muted, inherit);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.report-scope tbody tr:nth-child(even) {
  background: var(--r-table-row-alt, transparent);
}

/* ========================================
   CODE BLOCKS IN REPORTS
   ======================================== */
.report-scope pre,
.report-scope code {
  background: var(--r-code-bg, #F3F4F6);
  border: 1px solid var(--r-code-border, rgba(0,0,0,0.08));
  border-radius: var(--radius-sm, 4px);
  color: var(--r-text, inherit);
}
.report-scope pre {
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
.report-scope code {
  padding: 0.15rem 0.35rem;
  font-size: 0.85em;
}

/* ========================================
   WCAG CONFORMANCE METER
   ======================================== */
[data-testid="wcag-conformance-meter"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Level row base styles */
.wcag-level-A,
.wcag-level-AA,
.wcag-level-AAA {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  transition: opacity 0.2s, box-shadow 0.2s;
}

/* Achieved level highlight */
.wcag-level--achieved {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Badge — minimum 44x44 touch target */
.wcag-level__badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

/* Score display */
.wcag-level__score {
  text-align: right;
  white-space: nowrap;
}

/* Status icon — minimum 44x44 touch target */
.wcag-level__status {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* WCAG level cards grid — responsive */
.wcag-levels-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .wcag-levels-grid {
    grid-template-columns: 1fr;
  }
  .wcag-level-A,
  .wcag-level-AA,
  .wcag-level-AAA {
    grid-template-columns: auto 1fr auto auto;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
  }
}

/* ========================================
   WCAG CONFORMANCE METER — PRINT / PDF
   ======================================== */
@media print {
  [data-testid="wcag-conformance-meter"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }
  .wcag-level-A,
  .wcag-level-AA,
  .wcag-level-AAA {
    display: grid !important;
    grid-template-columns: auto 1fr auto auto !important;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #FFFFFF !important;
  }
  .wcag-level--achieved {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .wcag-level__badge,
  .wcag-level__status {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .wcag-levels-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .wcag-level-card {
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .wcag-status-box {
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
