/* Results Page Styles */
:root {
  --bg: #ffffff;
  --surface: #f8f7f4;
  --ink: #0d0d0d;
  --ink-muted: #555450;
  --ink-light: #9a9790;
  --accent: #1a2e5a; /* Deep navy */
  --accent-light: #f0f4f8;
  --border: rgba(0,0,0,0.09);
  --white: #ffffff;
  --success: #16a34a;
  --warning: #d97706;
  --danger:  #dc2626;
}

.results-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 120px 4rem 4rem; /* Adjusted for fixed navbar */
  width: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 48px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 32px;
}

.report-meta h1 {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--ink);
}

.report-meta h1 a {
  display: inline-block;
  font-size: 0.9em;
}

.report-meta a {
  text-decoration: none;
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}

.report-meta a:hover {
  border-color: var(--accent);
}

.report-meta p {
  color: var(--ink-muted);
}

.actions {
  display: flex;
  gap: 1rem;
}

/* Glassmorphism utility update */
.glass-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.02);
  padding: 40px;
  margin-bottom: 32px;
}

/* Device Tabs */
.device-tabs-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
}

.device-tabs {
  display: inline-flex;
  background: var(--surface);
  padding: 6px;
  border-radius: 100px;
  border: 1px solid var(--border);
}

.tab-btn {
  background: transparent;
  color: var(--ink-muted);
  border: none;
  padding: 10px 24px;
  border-radius: 100px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s;
}

.tab-btn.active {
  background: var(--white);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.device-view {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.device-view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Category Overview Bar */
.category-overview-bar {
  display: flex;
  justify-content: space-around;
  gap: 24px;
  padding: 32px;
  background: var(--surface);
  border-radius: 24px;
}

.overview-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.mini-gauge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 24px;
  font-family: 'DM Sans', sans-serif; /* Numbers usually look better in sans for gauges */
  background: var(--white);
  border: 4px solid var(--border);
  transition: transform 0.3s ease;
}

.mini-gauge.good {
  color: var(--success);
  border-color: var(--success);
}

.mini-gauge.average {
  color: var(--warning);
  border-color: var(--warning);
}

.mini-gauge.poor {
  color: var(--danger);
  border-color: var(--danger);
}

.overview-label {
  font-size: 14px;
  font-weight: 700;
  color: #475569; /* Slate 600 - close to image */
  text-align: center;
  margin-top: 8px;
}

/* Main Focus Section */
.main-focus-grid {
  display: block;
  padding: 2rem;
  margin-bottom: 2rem;
  background: white;
}

.focus-score {
  display: none;
}

.simple-gauge-container {
  width: 160px;
  height: 160px;
  margin: 0 auto 2rem;
  position: relative;
  display: flex;
  align-items: center;
}

.screenshot-wrapper.psi-styled {
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  background-color: #fff;
}

/* Mobile Phone Frame */
#view-mobile .screenshot-wrapper.psi-styled {
  max-width: 320px; /* Restrict to native PSI mobile width to prevent blur */
  border: 14px solid #0f172a;
  border-radius: 36px;
  border-top-width: 24px;
  border-bottom-width: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), inset 0 0 0 2px #334155;
  position: relative;
}

/* Mobile notch */
#view-mobile .screenshot-wrapper.psi-styled::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 24px;
  background: #0f172a;
  border-radius: 0 0 12px 12px;
  z-index: 10;
}

/* Desktop Monitor Frame */
#view-desktop .screenshot-wrapper.psi-styled {
  max-width: 800px; /* Restrict desktop screenshot width */
  border: 12px solid #1e293b;
  border-bottom-width: 32px;
  border-radius: 12px 12px 4px 4px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.screenshot-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: top;
  image-rendering: -webkit-optimize-contrast; /* Enhance sharpness */
}

.metrics-container {
  padding: 2rem 3rem;
  margin-bottom: 2rem;
  background: white;
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 4rem;
  row-gap: 1.5rem;
}

.metric-card-psi {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.metric-header-psi {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.metric-name-psi {
  font-weight: 600;
  color: #475569;
  font-size: 14px;
}

.metric-value-psi {
  font-size: 28px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  margin-left: 0;
  color: var(--ink);
}


.metric-value-psi.good { color: var(--success); }
.metric-value-psi.average {
  color: var(--warning);
}

.metric-value-psi.poor {
  color: var(--danger);
}

/* New Audit Button Refinement */
.btn-new-audit {
  background: var(--accent);
  color: white !important;
  padding: 10px 24px;
  border-radius: 100px;
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  box-shadow: 0 4px 10px rgba(26, 46, 90, 0.15);
}

.btn-new-audit:hover {
  background: var(--ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
}

/* Actions Button Refinement */
.results-header .btn-primary {
  padding: 10px 24px;
  font-size: 14.5px;
  border-radius: 100px;
  width: auto; /* Ensure it's not full width in header */
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.psi-marker {
  width: 14px;
  height: 14px;
  display: inline-block;
  flex-shrink: 0;
}

.psi-marker.good {
  background-color: var(--success);
  border-radius: 50%; /* Good is a circle */
}

.psi-marker.average {
  background-color: var(--warning);
  border-radius: 2px; /* Average is a square */
}

.psi-marker.poor {
  background-color: var(--danger);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.gauge circle {
  fill: none !important;
}

.gauge-bg {
  stroke: #f1f5f9;
}

.diagnostics-panel {
  padding: 2rem;
  margin-top: 2rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 1rem;
}

.btn-text-sm {
  background: white;
  border: 1px solid #e2e8f0;
  color: var(--primary);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-text-sm:hover {
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.accordion {
  border: 1px solid #f1f5f9;
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
  background: white;
}

.accordion-header {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.psi-acc-title {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-weight: 500;
  color: var(--text-main);
}

.accordion-header:hover {
  background: #fcfdfe;
}

.accordion-header.active {
  border-bottom: 1px solid #f1f5f9;
  background: #fcfdfe;
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
}

.accordion-content>div,
.accordion-content>ul,
.accordion-content>p {
  padding: 1.5rem;
}

.resource-list {
  list-style: none;
  padding: 0;
}

.resource-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #f8fafc;
}

.resource-list li:last-child {
  border-bottom: none;
}

.resource-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.resource-url {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  color: var(--primary);
  word-break: break-all;
  margin-right: 1.5rem;
}

.resource-rec {
  font-size: 0.85rem;
  font-weight: 500;
}

.resource-size {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.technical-deep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.t-check-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.t-check-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.t-check-card .t-check-info {
  flex: 1;
  min-width: 0;
}

.t-check-card .ai-inline-card {
  margin-top: 1rem;
  width: 100%;
  flex: 0 0 100%;
  background: #fcfdfe;
  border-left: 4px solid #10b981;
  box-shadow: none;
}

.url-text {
  word-break: break-all;
  line-height: 1.4;
}

.t-check-card.full-row {
  grid-column: 1 / -1;
}

.t-check-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.t-check-icon.success {
  background: #ecfdf5;
  color: #10b981;
}

.t-check-icon.warning {
  background: #fffbeb;
  color: #f59e0b;
}

.t-check-icon.danger {
  background: #fef2f2;
  color: #ef4444;
}

.t-check-info label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.t-check-info span {
  display: inline-block;
  font-size: 0.95rem;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 500;
  margin-top: 0.3rem;
  word-break: break-all;
  max-width: 100%;
}

.badge {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge.success {
  background: #dcfce7;
  color: #166534;
}

.badge.warning {
  background: #fef9c3;
  color: #854d0e;
}

.badge.danger {
  background: #fee2e2;
  color: #991b1b;
}



.a-check.passed .a-status {
  background: #ecfdf5;
  color: #10b981;
}

.a-check.failed .a-status {
  background: #fef2f2;
  color: #ef4444;
}

.a-check.passed .a-icon {
  color: #10b981;
}

.a-check.failed .a-icon {
  color: #ef4444;
}

/* Site Branding Header */
.site-branding-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.report-favicon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: white;
  padding: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
}

.report-meta h1 {
  font-size: 1.8rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* =============================================
   PREMIUM AI PROGRESS PANEL (floating card)
   ============================================= */
.ai-progress-panel {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 320px;
  background: #ffffff;
  border: 1px solid rgba(26, 46, 90, 0.15);
  border-radius: 20px;
  padding: 18px 20px 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.10), 0 0 0 1px rgba(26,46,90,0.06);
  animation: panel-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes panel-slide-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ai-progress-panel.ai-status-done {
  border-color: rgba(26, 46, 90, 0.3);
  animation: panel-slide-in 0s, panel-fade-out 0.6s ease 1.5s forwards;
}
@keyframes panel-fade-out {
  to { opacity: 0; transform: translateY(12px); pointer-events: none; }
}
.ai-progress-panel.ai-status-error { border-color: rgba(239, 68, 68, 0.2); }
.ai-panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.ai-panel-orb {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #1a2e5a 0%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  animation: orb-pulse 2s ease-in-out infinite;
  box-shadow: 0 4px 12px rgba(26, 46, 90, 0.3);
}
@keyframes orb-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(26,46,90,0.3); }
  50%       { box-shadow: 0 4px 22px rgba(26,46,90,0.55); }
}
.ai-status-done .ai-panel-orb   { animation: none; }
.ai-status-error .ai-panel-orb  {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  animation: none; box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.ai-panel-title-group { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ai-panel-title { font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: -0.2px; }
.ai-panel-subtitle { font-family: 'DM Sans', sans-serif; font-size: 12px; font-weight: 400; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-panel-dots { display: flex; gap: 4px; align-items: center; }
.ai-panel-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: 0.3;
  animation: dot-breathe 1.4s ease-in-out infinite;
}
.ai-panel-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-panel-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-breathe {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%       { opacity: 1;    transform: scale(1); }
}
.ai-status-done .ai-panel-dots span  { animation: none; opacity: 1; background: #3b82f6; }
.ai-status-error .ai-panel-dots span { animation: none; opacity: 1; background: #ef4444; }
.ai-panel-track {
  height: 4px; background: rgba(26,46,90,0.08);
  border-radius: 100px; overflow: hidden; margin-bottom: 14px;
}
.ai-panel-bar {
  height: 100%; width: 0%; border-radius: 100px;
  background: linear-gradient(90deg, #1a2e5a, #3b82f6);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.ai-panel-bar::after {
  content: ''; position: absolute; top: 0; right: 0;
  height: 100%; width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5));
  animation: bar-shimmer 1.5s ease-in-out infinite;
}
@keyframes bar-shimmer {
  0%, 100% { opacity: 0; }
  50%       { opacity: 1; }
}
.ai-status-error .ai-panel-bar { background: linear-gradient(90deg, #ef4444, #f97316); }
.ai-status-error .ai-panel-bar::after { display: none; }
.ai-panel-sections { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-section-pill {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: 100px;
  background: rgba(26, 46, 90, 0.06); color: var(--ink-muted);
  border: 1px solid rgba(26, 46, 90, 0.1); transition: all 0.3s ease;
}
.ai-section-pill.done {
  background: rgba(26, 46, 90, 0.1); color: var(--accent);
  border-color: rgba(26, 46, 90, 0.25);
}
.ai-section-pill.active {
  background: var(--accent); color: white; border-color: var(--accent);
  animation: pill-pulse 1s ease-in-out infinite;
}
@keyframes pill-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 46, 90, 0.35); }
  50%       { box-shadow: 0 0 0 5px rgba(26, 46, 90, 0); }
}
body.pdf-mode .ai-progress-panel { display: none !important; }
/* AI Inline Card Update */
.ai-inline-card {
  margin-top: 24px;
  background: var(--accent-light);
  border: 1px solid rgba(26, 107, 74, 0.1);
  border-radius: 16px;
  padding: 24px;
  font-size: 14px;
  color: var(--accent);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Card header row */
.ai-inline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.ai-inline-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #059669;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ai-inline-label svg {
  color: #10b981;
  flex-shrink: 0;
}

/* Toggle button */
.ai-inline-toggle {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-inline-toggle:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-inline-toggle svg {
  transition: transform 0.25s ease;
}

.ai-inline-toggle.open svg {
  transform: rotate(180deg);
}

/* Impact line (always visible) */
.ai-impact-line {
  color: #334155;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
  font-weight: 500;
}

/* Expandable body */
.ai-inline-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

/* Fix steps */
.ai-fix-steps {
  margin-top: 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem 1.25rem;
}

.ai-fix-steps strong {
  color: #0f172a;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.75rem;
}

.ai-fix-steps ol {
  margin: 0;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ai-fix-steps ol li {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Tip line */
.ai-tip-line {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1rem;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  color: #065f46;
  font-size: 0.9rem;
  line-height: 1.5;
  font-weight: 600;
}

.ai-tip-line svg {
  flex-shrink: 0;
  margin-top: 3px;
}

/* -- Responsive -- */
@media (max-width: 600px) {
  .ai-inline-card {
    padding: 0.7rem 0.85rem;
  }

  .ai-fix-steps {
    padding: 0.7rem 0.85rem;
  }
}

/* --------------------------------------------------------------------------- */
/* Issue Detection & Listing Items                                            */
/* --------------------------------------------------------------------------- */

.issues-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 0.5rem 0;
}

.issue-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.issue-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.issue-score {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.issue-score.poor {
  background: #ef4444;
}

.issue-score.average {
  background: #f59e0b;
}

.issue-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: #0f172a;
  flex: 1;
  min-width: 200px;
}

.impact-badge {
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.impact-badge.high {
  background: #fef2f2;
  color: #ef4444;
  border: 1px solid #fecaca;
}

.impact-badge.medium {
  background: #fffbeb;
  color: #f59e0b;
  border: 1px solid #fde68a;
}

.issue-item p {
  color: #475569;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  overflow-wrap: anywhere;
}

.issue-val {
  display: inline-block;
  background: #f1f5f9;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #334155;
  font-family: monospace;
  margin-bottom: 1rem;
  border: 1px solid #cbd5e1;
}

.resource-links strong {
  display: block;
  font-size: 0.85rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.resource-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.resource-links li a {
  color: #2563eb;
  font-size: 0.85rem;
  text-decoration: none;
  word-break: break-all;
}

.resource-links li a:hover {
  text-decoration: underline;
  color: #1d4ed8;
}

/* --- Premium SEO Content Styling --- */
.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1rem 0;
}

.seo-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-weight: 600;
  color: #334155;
  transition: all 0.2s ease;
}

.seo-check:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border-color: #cbd5e1;
}

.seo-check i {
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.seo-check.success {
  background: #f0fdf4;
  border-color: #bcf0da;
  color: #166534;
}

.seo-check.success i {
  background: #10b981;
  color: white;
}

.seo-check.danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.seo-check.danger i {
  background: #ef4444;
  color: white;
}

/* --- Ratio Diagnostic --- */
.ratio-diagnostic {
  margin-top: 2rem;
  padding: 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ratio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.ratio-header h4 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  color: #1e293b;
}

.ratio-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

.ratio-badge.good {
  background: #dcfce7;
  color: #166534;
}

.ratio-badge.average {
  background: #fef9c3;
  color: #854d0e;
}

.ratio-bar-bg {
  height: 12px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.ratio-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  border-radius: 6px;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.ratio-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.5rem;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.05em;
}

.meta-item span {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.ratio-hint {
  grid-column: 1 / -1;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #475569;
  font-weight: 400;
  line-height: 1.5;
}

.ratio-hint i {
  font-size: 1.1rem;
}

/* --- PSI Table Overhaul --- */
.table-scroll {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
}

.psi-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

.psi-table th {
  background: #f8fafc;
  padding: 1rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid #e2e8f0;
}

.psi-table td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: middle;
}

.psi-table tr:last-child td {
  border-bottom: none;
}

.psi-table tr:hover td {
  background: #fcfdfe;
}

.psi-table a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
}

.psi-table a:hover {
  text-decoration: underline;
}

.anchor-cell {
  font-style: italic;
  color: #64748b;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.url-cell {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Resource List & Advanced Resource List --- */
.advanced-resource-list,
.resource-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.advanced-resource-list li,
.resource-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.2s;
}

.advanced-resource-list li:hover,
.resource-list li:hover {
  background: #f8fafc;
}

.advanced-resource-list li:last-child,
.resource-list li:last-child {
  border-bottom: none;
}

.url-hint,
.resource-url {
  color: #2563eb !important;
  font-weight: 500;
  text-decoration: none !important;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 75%;
}

.url-hint:hover,
.resource-url:hover {
  text-decoration: underline !important;
}

.issue-tag,
.val-tag,
.resource-size {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.issue-tag.red {
  background: #fee2e2;
  color: #991b1b;
}

.issue-tag.orange {
  background: #ffedd5;
  color: #9a3412;
}

.val-tag,
.resource-size {
  background: #f1f5f9;
  color: #475569;
}

/* AI Insight Styling - Red Impact, Green Fix */
.ai-impact-line {
  color: #ef4444 !important;
  /* Force red for issue explanation */
  font-size: 0.9rem;
  margin: 0.5rem 0;
  font-weight: 500;
  line-height: 1.4;
}

.ai-fix-steps {
  color: #10b981 !important;
  /* Force green for fix steps */
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
}

.ai-fix-steps strong {
  color: #059669;
  display: block;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.ai-fix-steps ol {
  padding-left: 1.25rem;
  margin: 0;
}

.ai-fix-steps li {
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #10b981;
  /* Ensure list items are also green */
}

.ai-tip-line span {
  color: #64748b;
  font-size: 0.8rem;
  font-style: italic;
}

/* --- Passed Audits Success Grid --- */
.passed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
  padding: 1.5rem;
}

.passed-item {
  background: #f0fdf4;
  border: 1px solid #dcfce7;
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.passed-item:hover {
  transform: translateY(-3px);
  background: #ffffff;
  border-color: #10b981;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.1);
}

.passed-icon {
  width: 28px;
  height: 28px;
  background: #10b981;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.passed-content {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.passed-content strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.35rem;
  font-family: 'Outfit', sans-serif;
}

.passed-content p {
  font-size: 0.9rem;
  color: #3f6212;
  margin: 0;
  line-height: 1.5;
  opacity: 0.85;
  overflow-wrap: anywhere;
}



/* Technical SEO Section Styles */
.technical-seo-section {
  padding: 2.5rem;
  margin-bottom: 2rem;
  background: #ffffff;
  border-radius: 20px;
}

.tech-seo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.tech-seo-title h3 {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.tech-score-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.tech-score-num {
  font-size: 1.1rem;
  font-weight: 600;
  color: #64748b;
}

.tech-grade-badge {
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tech-grade-badge.grade-a {
  background: #dcfce7;
  color: #166534;
}

.tech-grade-badge.grade-b {
  background: #ecfdf5;
  color: #059669;
}

.tech-grade-badge.grade-c {
  background: #fef9c3;
  color: #854d0e;
}

.tech-grade-badge.grade-d {
  background: #ffedd5;
  color: #9a3412;
}

.tech-grade-badge.grade-f {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Fallback for N/A or unknown grades */
.tech-grade-badge.grade-n\/a,
.tech-grade-badge[class*="grade-n"] {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.tech-issues-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.tech-issue-item {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #f8fafc;
}

.tech-issue-item:last-child {
  border-bottom: none;
}

.issue-tag-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tech-tag {
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tech-tag.critical,
.tech-tag.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.tech-tag.warning {
  background: #fff8ed;
  color: #c05621;
  border: 1px solid #fbd38d;
}

.tech-tag.opportunity {
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
}

.tech-tag.passed {
  background: #f0fff4;
  color: #276749;
  border: 1px solid #9ae6b4;
}

.issue-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e293b;
}

.issue-desc {
  color: #475569;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.issue-fix {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-radius: 10px;
  border-left: 4px solid #cbd5e1;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.5;
}

.issue-fix strong {
  color: #0f172a;
  margin-right: 0.5rem;
}

/* Image Diagnostics Sub-sections */
.image-audit-sub {
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 1.5rem;
}

.image-audit-sub:last-child {
  border-bottom: none;
}

.sub-audit-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #334155;
}

.success-msg-sm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #10b981;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}

/* Link Architecture Stats */
.link-stats-grid {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #475569;
}

.stat-pill strong {
  color: var(--primary);
  font-size: 1rem;
  margin-right: 0.25rem;
}

.link-tables-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.link-sub-section h4 {
  margin-bottom: 1.25rem;
}

/* Network Tree View */
.tree-view {
  background: #0f172a;
  border-radius: 12px;
  padding: 1.5rem;
  color: #e2e8f0;
  font-family: 'Roboto Mono', monospace;
}

.network-json {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Accessibility Status */
.a-status {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 80px;
  text-align: center;
}
/* Freemium Restricted View */
body:not(.pdf-mode) .freemium-restricted {
  max-height: 5200px; /* Reality: 90% visibility */
  overflow: hidden;
  position: relative;
}

body:not(.pdf-mode) .freemium-restricted::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 600px;
  background: linear-gradient(to bottom, rgba(248, 250, 252, 0) 0%, #f8fafc 90%);
  pointer-events: none;
  z-index: 20;
}

body.pdf-mode .freemium-cta-container {
  display: none !important;
}

body.pdf-mode .navbar {
  display: none !important;
}

.freemium-cta-container {
  text-align: center;
  padding: 4rem 2rem;
  margin-top: -300px;
  position: relative;
  z-index: 30;
  display: flex;
  justify-content: center;
}

.freemium-box {
  background: white;
  border-radius: 24px;
  padding: 3rem;
  max-width: 600px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(79, 70, 229, 0.25);
  border: 2px solid rgba(79, 70, 229, 0.1);
}

.freemium-box i {
  font-size: 4rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.freemium-box h2 {
  font-size: 1.8rem;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.freemium-box p {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.freemium-box .small-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0;
}



/* --- Results Page: Tablet ------------------------------------------- */
@media (max-width: 1024px) {
  .results-page { padding: 100px 1.5rem 3rem; }
  .main-focus-grid { grid-template-columns: 1fr; padding: 2.5rem 1.5rem; gap: 3rem; }
  .metrics-grid { column-gap: 2rem; }
  .category-overview-bar { gap: 1.5rem; overflow-x: auto; justify-content: flex-start; padding: 1rem; }
  .overview-item { flex-shrink: 0; }
  .glass-panel { padding: 28px 24px; }
}

/* --- Results Page: Mobile ------------------------------------------- */
@media (max-width: 768px) {
  .results-page { padding: 88px 1rem 2.5rem; overflow-x: hidden; }

  .results-header { flex-direction: column; align-items: flex-start; gap: 20px; margin-bottom: 28px; padding-bottom: 20px; }
  .report-meta h1 { font-size: clamp(18px, 5vw, 26px); word-break: break-all; overflow-wrap: anywhere; }
  .report-meta a, .report-meta h1 a { word-break: break-all; overflow-wrap: anywhere; }

  .actions { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
  .actions .btn-primary, .actions .btn-new-audit { flex: 1 1 auto; text-align: center; justify-content: center; font-size: 13px; padding: 10px 16px; }

  .glass-panel { padding: 20px 16px; border-radius: 16px; }

  .device-tabs-wrapper { margin-bottom: 1.5rem; }
  .device-tabs { width: 100%; justify-content: center; }
  .tab-btn { flex: 1; justify-content: center; font-size: 13px; padding: 9px 16px; }

  .metrics-grid { grid-template-columns: 1fr; column-gap: 0; row-gap: 1rem; }
  .metrics-container { padding: 1.5rem 1rem; }

  .category-overview-bar { padding: 1rem 0.5rem; gap: 1rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; border-radius: 16px; }
  .overview-item { flex-shrink: 0; scroll-snap-align: start; }
  .mini-gauge { width: 64px; height: 64px; font-size: 18px; }
  .overview-label { font-size: 12px; }

  .technical-seo-section { padding: 1.5rem 1rem; border-radius: 14px; }
  .tech-seo-header { flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1rem; }
  .tech-seo-title h3 { font-size: 1.35rem; }
  .tech-score-row { flex-wrap: wrap; gap: 0.75rem; }

  .technical-deep-grid { grid-template-columns: 1fr; gap: 1rem; }
  .t-check-card { padding: 20px; border-radius: 14px; }

  .issue-head { flex-wrap: wrap; gap: 0.5rem; }
  .issue-tag-row { flex-wrap: wrap; gap: 0.5rem; }
  .issue-title { font-size: 1rem; }
  .issue-desc { font-size: 0.9rem; }

  .diagnostics-panel { padding: 1.25rem 1rem; }
  .panel-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; margin-bottom: 1.25rem; }

  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .psi-table th, .psi-table td { font-size: 0.8rem; padding: 0.65rem; white-space: nowrap; }

  .resource-url, .url-hint, .url-cell, .anchor-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .passed-grid { grid-template-columns: 1fr; padding: 1rem; gap: 0.85rem; }
  .ratio-meta { grid-template-columns: 1fr 1fr; gap: 1rem; }

  .accordion-header { padding: 1rem; }
  .psi-acc-title { font-size: 0.9rem; gap: 0.75rem; }

  .freemium-box { padding: 2rem 1.5rem; border-radius: 18px; }
  .freemium-box h2 { font-size: 1.4rem; }
  .freemium-box p { font-size: 1rem; }

  .ai-progress-panel { width: calc(100% - 2rem); left: 1rem; right: 1rem; bottom: 16px; border-radius: 14px; }
  .ai-inline-card { padding: 1rem; border-radius: 12px; }
  .ai-fix-steps { padding: 0.85rem 1rem; }

  .seo-grid { grid-template-columns: 1fr; }
  .main-focus-grid { padding: 1.5rem 1rem; }

  #view-mobile .screenshot-wrapper.psi-styled { max-width: 280px; }
  #view-desktop .screenshot-wrapper.psi-styled { max-width: 100%; }
}

/* --- Results Page: Small phones ------------------------------------ */
@media (max-width: 480px) {
  .results-page { padding: 80px 0.75rem 2rem; }
  .report-meta h1 { font-size: 16px; }
  .tab-btn { font-size: 12px; padding: 8px 12px; }
  .metric-value-psi { font-size: 22px; }
  .tech-grade-badge { font-size: 0.75rem; padding: 0.4rem 1rem; }
  .tech-tag { font-size: 0.65rem; padding: 0.25rem 0.6rem; }
  .ratio-meta { grid-template-columns: 1fr; }
  .link-stats-grid { flex-direction: column; }
}