/* Interactive landing-page demo styles -- copied verbatim from extension/popup/popup.css
   so the demo is pixel-identical to the real popup. Keep these two files in sync by hand
   when popup.css changes; this file is intentionally NOT loaded by the real extension. */

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

/* No :focus-visible rule existed anywhere in this file except the whitelist text
   input -- a keyboard user tabbing through Settings/tabs/buttons got no indication
   of which control had focus. One rule for every real <button> (tab bar, master
   toggle, share, add-current, add-domain, export, DoH, refresh, whitelist-remove
   are all <button> elements) plus a dedicated rule for the toggle-switch pattern,
   whose actual <input> is visually hidden so :focus-visible has to target the
   sibling .slider instead. */
button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.switch input:focus-visible + .slider {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

:root {
  --bg:         #0d0d0d;
  --bg-card:    #161616;
  --bg-row:     #1a1a1a;
  --bg-hover:   #202020;
  --border:     #242424;
  --purple:     #7c3aed;
  --purple-mid: #6d28d9;
  --indigo:     #4f46e5;
  --text:       #f0f0f0;
  --text-muted: #888;
  --text-dim:   #8a8a8a; /* was #555 (~2.3-2.6:1 against dark backgrounds -- fails WCAG AA's 4.5:1 minimum); now ~5.0-5.6:1 */
  --green:      #22c55e;
  --red:        #ef4444;
  --accent-grd: linear-gradient(135deg, #7c3aed, #4f46e5);
  --radius:     10px;
  --tab-h:      52px;
  --header-h:   46px;
}

html, body {
  width: 320px;
  height: 520px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ────────────────────────────────────────────────────────── */
.app {
  display: flex;
  flex-direction: column;
  height: 520px;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 26px;
  height: 26px;
  background: var(--accent-grd);
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #fff;
}

.version-badge {
  font-size: 10px;
  color: var(--text-dim);
  background: #1a1a1a;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ── Content / Tab Panels ─────────────────────────────────────────────── */
.content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.tab-panel {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  overflow: hidden;
}

.tab-panel.active {
  opacity: 1;
  pointer-events: all;
}

/* ── HOME TAB ─────────────────────────────────────────────────────────── */
#tab-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
}

.shield-wrap {
  position: relative;
  width: 72px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.shield-svg {
  width: 64px;
  height: 72px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.5));
  transition: filter 0.3s ease;
}

.shield-svg.paused {
  filter: drop-shadow(0 0 4px rgba(100,100,100,0.3));
}

.shield-pulse {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(124,58,237,0.18) 0%, transparent 70%);
  animation: pulse 2.5s ease-in-out infinite;
}

.shield-pulse.paused {
  animation: none;
  background: transparent;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%       { transform: scale(1.15); opacity: 0.3; }
}

.shield-status {
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
  letter-spacing: 0.3px;
  transition: color 0.2s;
}

.shield-status.paused {
  color: var(--text-dim);
}

/* Groups a stat (or stat cluster) with its own label(s) at a tight, consistent gap,
   so #tab-home's own gap (below) only ever governs spacing BETWEEN distinct groups --
   previously each pair fought that outer gap with its own ad-hoc negative margin
   (-4px/-4px/+2px), producing inconsistent effective spacing (6px/12px/10px) with no
   shared scale governing it. */
.stat-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.blocked-total {
  font-size: 40px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -2px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.blocked-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tab-total {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.8px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tab-total-label,
.pills-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.tab-total-detail {
  font-size: 10px;
  color: var(--text-dim);
  text-align: center;
  max-width: 220px;
  line-height: 1.35;
}

.category-pills {
  display: flex;
  gap: 6px;
}

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px 6px;
  min-width: 58px;
  gap: 2px;
}

.pill-count {
  font-size: 16px;
  font-weight: 700;
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
}

.pill-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.master-toggle-btn {
  margin-top: 4px;
  padding: 9px 28px;
  border-radius: 20px;
  border: none;
  background: var(--accent-grd);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  letter-spacing: 0.2px;
}

.master-toggle-btn:hover { opacity: 0.88; }
.master-toggle-btn:active { transform: scale(0.97); }

.master-toggle-btn.paused {
  background: #2a2a2a;
  border: 1px solid var(--border);
  color: var(--green);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 20px;
  border-radius: 20px;
  border: 1px solid #2e2e2e;
  background: transparent;
  color: var(--text-dim); /* was #666 (~3.4:1 against #0d0d0d -- fails WCAG AA) */
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  letter-spacing: 0.2px;
  margin-top: 2px;
  margin-bottom: 12px;
}

.share-btn:hover {
  color: #a78bfa;
  border-color: var(--purple);
}

.share-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

/* ── SETTINGS TAB ─────────────────────────────────────────────────────── */
.settings-scroll {
  height: calc(520px - var(--header-h) - var(--tab-h));
  overflow-y: auto;
  padding: 10px 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.settings-scroll::-webkit-scrollbar { width: 4px; }
.settings-scroll::-webkit-scrollbar-track { background: transparent; }
.settings-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.settings-group {
  margin-bottom: 14px;
}

.group-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0 2px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 8px;
  transition: background 0.1s;
  gap: 12px;
}

.toggle-row:hover { background: var(--bg-hover); }

.toggle-row.action-row { cursor: default; }

.row-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-desc {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toggle switch */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  background: #2e2e2e;
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
  border: 1px solid #3a3a3a;
}

.slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #888;
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

input:checked + .slider {
  background: var(--accent-grd);
  border-color: var(--purple-mid);
}

input:checked + .slider::before {
  transform: translateX(16px);
  background: #fff;
}

input:disabled + .slider {
  opacity: 0.35;
  cursor: not-allowed;
}

.action-btn {
  padding: 5px 12px;
  background: #252525;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: #a78bfa;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.1s;
}

.action-btn:hover { background: #2e2e2e; }

/* Disabled state (master toggle off) */
.app.master-off .settings-scroll .toggle-row:not([data-feature="blocklist_sync"]) .slider {
  opacity: 0.28;
  pointer-events: none;
}

.app.master-off .settings-scroll .feature-toggle {
  pointer-events: none;
}

/* Explains WHY the toggles above just went dark -- otherwise "paused disables
   every setting" reads as broken, not intentional. Hidden unless paused. */
.paused-settings-notice {
  display: none;
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.app.master-off .paused-settings-notice {
  display: block;
}

/* Clarifies the one row that's the deliberate exception to the notice above. */
.paused-exception-note {
  display: none;
  font-size: 10px;
  color: var(--purple);
  margin-top: 2px;
}

.app.master-off .paused-exception-note {
  display: block;
}

/* ── REPORT TAB ───────────────────────────────────────────────────────── */
#tab-report {
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
  gap: 12px;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.report-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.refresh-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-row);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}

.refresh-btn:hover { background: var(--bg-hover); color: var(--text); }

#report-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.report-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
}

.report-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-row);
  border-radius: var(--radius);
  border-left: 3px solid transparent;
}

#report-row-ads         { border-left-color: #f97316; }
#report-row-analytics   { border-left-color: #a855f7; }
#report-row-social      { border-left-color: #06b6d4; }
#report-row-telemetry   { border-left-color: #3b82f6; }
#report-row-fingerprint { border-left-color: #22c55e; }
#report-row-fonts       { border-left-color: #f59e0b; }
#report-row-cookies     { border-left-color: #ec4899; }

.report-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.report-cat {
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}

.report-badge {
  font-size: 13px;
  font-weight: 700;
  color: #a78bfa;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

/* ── WHITELIST TAB ────────────────────────────────────────────────────── */
#tab-whitelist {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  gap: 10px;
}

.add-current-btn {
  width: 100%;
  padding: 9px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px dashed #6d28d9;
  border-radius: var(--radius);
  color: #a78bfa;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.1s;
}

.add-current-btn:hover { background: rgba(124, 58, 237, 0.2); }

.whitelist-input-row {
  display: flex;
  gap: 8px;
}

.whitelist-input {
  flex: 1;
  padding: 8px 10px;
  background: var(--bg-row);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.whitelist-input:focus {
  border-color: var(--purple);
}

.whitelist-input:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 1px;
}

.whitelist-input::placeholder { color: var(--text-dim); }

.add-domain-btn {
  padding: 8px 14px;
  background: var(--accent-grd);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.add-domain-btn:hover { opacity: 0.88; }

.whitelist-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.whitelist-list::-webkit-scrollbar { width: 4px; }
.whitelist-list::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.whitelist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 20px 0;
}

.whitelist-error {
  display: none;
  color: var(--red);
  font-size: 11px;
  margin: -4px 0 8px;
}

.whitelist-error.visible {
  display: block;
}

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

.whitelist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-row);
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 8px;
}

.whitelist-domain {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whitelist-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: #2a2a2a;
  border-radius: 5px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}

.whitelist-remove:hover { background: #3a1414; color: var(--red); }

/* ── TAB BAR ──────────────────────────────────────────────────────────── */
.tab-bar {
  height: var(--tab-h);
  display: flex;
  border-top: 1px solid var(--border);
  background: #111;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.15s, background 0.15s;
  padding: 6px 0 4px;
  position: relative;
}

.tab-btn:hover { color: #aaa; background: #181818; }

.tab-btn.active {
  color: #a78bfa;
}

.tab-btn.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 2px;
  background: var(--accent-grd);
  border-radius: 0 0 4px 4px;
}

/* ── Disabled overlay when master toggle is off ───────────────────────── */
.app.master-off #tab-home .category-pills,
.app.master-off #tab-home .tab-total,
.app.master-off #tab-home .tab-total-label,
.app.master-off #tab-home .tab-total-detail,
.app.master-off #tab-home .blocked-total,
.app.master-off #tab-home .blocked-label {
  opacity: 0.4;
}

/* ── Privacy Score ────────────────────────────────────────────────────────────── */
.privacy-score-section {
  margin: 12px 14px 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.score-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.score-gauge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-bar-bg {
  flex: 1;
  height: 6px;
  background: #222;
  border-radius: 6px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: #22c55e;
  transition: width 0.6s ease, background 0.3s ease;
  width: 0%;
}

.score-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Export Button ────────────────────────────────────────────────────────────── */
.export-btn {
  display: block;
  width: calc(100% - 28px);
  margin: 10px 14px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: center;
}

.export-btn:hover {
  border-color: var(--purple);
  color: #a78bfa;
}

/* ── Keyboard Shortcut Badge ──────────────────────────────────────────────────── */
.shortcut-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: #1e1e1e;
  border: 1px solid #333;
  color: var(--text-muted);
  font-family: monospace;
  flex-shrink: 0;
  white-space: nowrap;
}
