/* ==========================================================================
   privacy-inspector — shared theme
   Mirrors looca.xyz: #06070a canvas, glass cards, Plus Jakarta Sans + JetBrains Mono,
   purple accent, mono micro-labels, spring easing. Used by the web app and the extension.
   ========================================================================== */

@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('fonts/PlusJakartaSans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/JetBrainsMono-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-color: #06070a;
  --card-bg: rgba(13, 14, 19, 0.62);
  --card-solid: #0d0e13;
  --card-border: rgba(255, 255, 255, 0.08);
  --card-border-hover: rgba(255, 255, 255, 0.18);
  --hairline: rgba(255, 255, 255, 0.05);

  --text-main: #ffffff;
  --text-soft: #c9ccd6;
  --text-muted: #8b90a0;
  --text-dim: #555a6d;

  --accent: #a855f7;
  --accent-soft: #c084fc;
  --accent-glow: rgba(168, 85, 247, 0.35);

  --ok: #34d399;
  --info: #38bdf8;
  --warn: #fbbf24;
  --bad: #f87171;
  --critical: #fb7185;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius-card: 20px;
  --radius-ctl: 10px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
}

::selection { background: rgba(168, 85, 247, 0.35); color: #fff; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: rgba(6, 7, 10, 0.95); }
::-webkit-scrollbar-thumb { background: rgba(168, 85, 247, 0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(168, 85, 247, 0.55); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.accent-dot { color: var(--accent); }

.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;
}

/* --------------------------------------------------------------------------
   Glass surfaces
   -------------------------------------------------------------------------- */

.glass {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-radius: var(--radius-card);
  box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.7);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  background: rgba(13, 14, 19, 0.5);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 12px;
  border-radius: 20px;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

a.pill:hover { color: #fff; border-color: rgba(255, 255, 255, 0.2); }

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--accent-soft);
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  padding: 5px 14px;
  border-radius: 20px;
}

.tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: ring-pulse 2s infinite;
}

@keyframes ring-pulse {
  0% { box-shadow: 0 0 0 0 currentColor; }
  70% { box-shadow: 0 0 0 5px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-ctl);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  color: #fff;
  transition: transform 0.2s var(--ease-spring), background-color 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, color 0.2s ease;
}

.btn svg { flex-shrink: 0; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.btn-primary {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not([disabled]) {
    background: rgba(168, 85, 247, 0.35);
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.25);
    transform: translateY(-1px);
  }
  .btn-secondary:hover:not([disabled]) {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #fff;
    transform: translateY(-1px);
  }
}

/* --------------------------------------------------------------------------
   Status badges & dots
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 11, 16, 0.6);
  color: var(--text-soft);
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.badge.plain::before { display: none; }

.is-ok { color: var(--ok); }
.is-info { color: var(--info); }
.is-warn { color: var(--warn); }
.is-bad { color: var(--bad); }
.is-critical { color: var(--critical); }
.is-dim { color: var(--text-dim); }

.badge.is-ok { border-color: rgba(52, 211, 153, 0.35); }
.badge.is-info { border-color: rgba(56, 189, 248, 0.35); }
.badge.is-warn { border-color: rgba(251, 191, 36, 0.35); }
.badge.is-bad, .badge.is-critical { border-color: rgba(248, 113, 113, 0.4); }
.badge.is-dim { border-color: rgba(255, 255, 255, 0.08); }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #a1a1aa;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Score ring
   -------------------------------------------------------------------------- */

.score-ring {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.score-ring svg { display: block; transform: rotate(-90deg); }
.score-ring .ring-track { stroke: rgba(255, 255, 255, 0.06); }
.score-ring .ring-value {
  stroke: currentColor;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.1s var(--ease-spring);
  filter: drop-shadow(0 0 6px currentColor);
}

.score-ring .ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.score-ring .ring-num {
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -1.5px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.score-ring .ring-max {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* --------------------------------------------------------------------------
   Report sections (rendered by shared/render.js)
   -------------------------------------------------------------------------- */

.report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.report-card {
  padding: 22px 22px 20px;
  min-width: 0;
  transition: border-color 0.3s ease;
}

.report-card.span-2 { grid-column: 1 / -1; }

@media (hover: hover) and (pointer: fine) {
  .report-card:hover { border-color: rgba(255, 255, 255, 0.14); }
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  margin-top: 6px;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.card-sub {
  margin-top: 4px;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.empty {
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-dim);
  text-align: center;
}

/* Rows */
.rows { list-style: none; display: flex; flex-direction: column; }

.row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 11px 0;
  border-top: 1px solid var(--hairline);
}

.row:first-child { border-top: 0; padding-top: 2px; }
.row .dot { margin-top: 6px; }

.row-main { min-width: 0; }

.row-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  overflow-wrap: anywhere;
}

.row-note {
  margin-top: 2px;
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.row-value {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.row-side {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

table.data th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 8px 10px;
  white-space: nowrap;
}

table.data td {
  padding: 10px 8px;
  border-top: 1px solid var(--hairline);
  color: var(--text-soft);
  vertical-align: middle;
}

table.data td.name {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: #fff;
  overflow-wrap: anywhere;
  max-width: 260px;
}

table.data td.center, table.data th.center { text-align: center; }

.flag {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  font-size: 0.7rem;
}

.flag.yes { background: rgba(52, 211, 153, 0.12); color: var(--ok); }
.flag.no { background: rgba(248, 113, 113, 0.12); color: var(--bad); }

/* CSP directives */
.directives {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-height: 260px;
  overflow: auto;
  padding: 12px 14px;
  background: #090a10;
  border: 1px solid var(--hairline);
  border-radius: 12px;
}

.directives .d-name { color: var(--accent-soft); }
.directives .d-src { color: var(--text-muted); overflow-wrap: anywhere; }
.directives .d-src .risky { color: var(--warn); }

/* Findings list */
.findings { list-style: none; display: flex; flex-direction: column; gap: 2px; }

.finding {
  border-top: 1px solid var(--hairline);
}

.finding:first-child { border-top: 0; }

.finding > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 2px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
}

.finding > summary::-webkit-details-marker { display: none; }

.finding .penalty {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

.finding .chev {
  color: var(--text-dim);
  transition: transform 0.25s var(--ease-out);
}

.finding[open] .chev { transform: rotate(45deg); }

.finding-body {
  padding: 0 2px 14px 26px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.finding-body .fix {
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.06);
  border: 1px solid rgba(168, 85, 247, 0.16);
  border-radius: 10px;
  color: var(--text-soft);
}

.finding-body .fix b { color: var(--accent-soft); font-weight: 600; }

.finding-body ul {
  margin-top: 10px;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.finding-body li { padding: 2px 0; overflow-wrap: anywhere; }
.finding-body li::before { content: '\203A  '; color: var(--accent-soft); }

/* Reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal-in 0.7s var(--ease-spring) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes reveal-in {
  to { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  .report-grid { grid-template-columns: 1fr; }
  .report-card.span-2 { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
