/* === Auto Theme Variables (Red Variant) === */
:root {
  --bg: #0a0a0a;
  --fg: #eee;
  --accent: #ff4d4d;         /* Warning Light Red */
  --accent-hover: #ff6666;   /* Hover Red */
  /* Inherit style.css's --font (IBM Plex Mono stack). Overriding it to the
     bare `monospace` keyword triggered the browser's fixed-width default size
     (~13px), shrinking this whole page vs the other audit pages (which use the
     shared stack at 16px). Do not re-add a bare `monospace` here. */
}

/* === Layout Reset === */
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  height: auto !important;
  min-height: 100vh;
  overflow-y: auto !important;
}

body.tool-page {
  position: relative;
  background: var(--bg);
  padding: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, rgba(255, 77, 77, 0.1), transparent 75%);
  z-index: -1;
  pointer-events: none;
}

/* === Background Canvas === */
#cortex-auto {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -2;
  pointer-events: none;
}

/* === Main Container === */
main {
  max-width: 800px;
  margin: 4rem auto;
  padding: 2rem;
  background: linear-gradient(
    to bottom,
    rgba(255, 77, 77, 0.05),
    rgba(24, 0, 0, 0.85)
  );
  border: 1px solid rgba(255, 77, 77, 0.15);
  border-radius: 10px;
  /*
    The Audit Scanner reads THROUGH the panel, and it was reading through the
    words. The canvas paints live numerals and rules straight behind the body
    copy, and at 0.85 alpha with nothing between them the two competed — the
    founder's report was simply that the text is too hard to read.
  
    `backdrop-filter` is the fix rather than more opacity: blur destroys the
    canvas's high-frequency detail and keeps only its luminance, so the
    atmosphere survives while the moving edges that fight the text do not. And
    it is scoped to this element's own box, which is exactly the behaviour
    asked for — the scanner is untouched everywhere the panel is not, and goes
    quiet the moment it passes behind it. Saturation is pushed with the blur so
    the glow stays coloured instead of going frosted grey, the same pairing the
    Pro shell's glass uses.
  */
  -webkit-backdrop-filter: blur(14px) saturate(135%);
  backdrop-filter: blur(14px) saturate(135%);
  box-shadow: inset 0 0 60px rgba(255,77,77,0.02);
  animation: fadeIn 0.6s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* === Headline === */
main h1 {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--accent);
  text-align: center;
  text-shadow: 0 2px 8px rgba(255, 77, 77, 0.25);
  letter-spacing: 0.03em;
  margin-bottom: 1.5rem;
}

/* === Textarea === */
textarea {
  width: 100%;
  min-height: 160px;
  padding: 1rem;
  background: rgba(34, 0, 0, 0.8);
  color: var(--accent);
  border: 1px solid rgba(255, 77, 77, 0.3);
  border-radius: 6px;
  font-family: var(--font);
  transition: border 0.2s ease, box-shadow 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--accent-hover);
  box-shadow: 0 0 14px rgba(255,77,77,0.25);
}

/* === Button Styles === */
button {
  margin: 1.5rem auto;
  display: block;
  padding: 0.8rem 1.6rem;
  font-family: var(--font);
  font-weight: bold;
  font-size: 1rem;
  color: #000;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

button:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 14px var(--accent-hover);
}

button:active {
  transform: scale(0.98);
  box-shadow: 0 0 10px var(--accent);
}

/* === File Upload === */
/* Style defined below with pro-mode look */

/* === Output Layout === */
.output-area {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* === Audit Card === */
.audit-card {
  background: linear-gradient(
    to bottom,
    rgba(255, 77, 77, 0.04),
    rgba(30, 0, 0, 0.8)
  );
  border: 1px solid rgba(255, 77, 77, 0.1);
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 0 10px rgba(255,77,77,0.05);
  animation: popIn 0.3s ease;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.audit-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(255,77,77,0.15);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.audit-card .category {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-card .item,
.audit-card .price,
.audit-card .flagged {
  color: #ccc;
  font-size: 0.95rem;
  margin: 0.3rem 0;
}

.audit-card .flagged {
  color: #f55;
}

.audit-card .flagged.good {
  color: #999;
  font-style: italic;
}

.flagged.soft {
  color: #ffd966;
  font-weight: bold;
}

.details {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: #ff9b9b;
  line-height: 1.4;
}

/* === Loading Animation === */
#qc-loader,
.qc-loader {
  background: linear-gradient(
    160deg,
    rgba(255, 77, 77, 0.08),
    rgba(38, 0, 0, 0.78)
  );
  border: 1px solid rgba(255, 77, 77, 0.22);
  border-radius: 14px;
  box-shadow: 0 18px 38px -26px rgba(0, 0, 0, 0.78);
}

.loading {
  color: var(--accent);
}

.analyzing-text {
  color: #ffc1c1;
  text-shadow: 0 0 24px rgba(255, 77, 77, 0.22);
}

.qc-micro {
  color: rgba(255, 204, 204, 0.75);
}

@media (max-width: 540px) {
  #qc-loader,
  .qc-loader {
    padding: 1rem 1.1rem;
    max-width: min(100%, 18rem);
  }

  .qc-micro {
    font-size: 0.85rem;
  }
}

/* === Footer === */
footer.site-footer {
  width: 100%;
  margin: 0;
  padding: 1rem;
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  background: #000;
  color: var(--text-muted, #adcdda);
  font-size: 0.85rem;
  text-align: center;
}

footer.site-footer a {
  color: inherit;
  text-decoration: underline;
}

/* ----- Mobile footer behavior ----- */
@media (max-width:600px){
  body.tool-page{
    display:flex;
    flex-direction:column;
    min-height:100vh;
  }
  main{
    flex:1 0 auto;
  }
  footer.site-footer{
    position:static;
    margin-top:auto;
  }
}

/* === Inline Styles Moved to CSS === */
.accent-text { color: var(--accent); }

.metro-label { display: block; margin-bottom: 0.5rem; }

/* Pro-style metro dropdown — #qcCountry is the country selector
   lib/country-select.js injects above it; both share the tint. */
#metro,
#qcCountry {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.6rem;
  background: rgba(34, 0, 0, 0.8);
  color: var(--accent);
  border: 1px solid rgba(255, 77, 77, 0.35);
  border-radius: 4px;
  font-family: var(--font);
  font-size: 0.9rem;
}

/* Pro-style file input */
input[type="file"] {
  display: block;
  width: 100%;
  margin: 1rem 0;
  padding: 0.6rem;
  background: rgba(34, 0, 0, 0.8);
  color: var(--accent);
  border: 1px solid rgba(255, 77, 77, 0.35);
  border-radius: 4px;
  font-family: var(--font);
  font-size: 0.9rem;
}

input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: bold;
  margin-right: 0.8rem;
}

input[type="file"]::file-selector-button:hover {
  background: var(--accent-hover);
}

.legal-disclaimer {
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted, #adcdda);
  text-align: center;
  line-height: 1.4;
}

.privacy-note {
  color: #aaa;
  font-size: 0.9rem;
  text-align: center;
  margin-bottom: 1rem;
}
.preframe-note {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-muted, #adcdda);
  text-align: center;
}

#pro-modal {
  position: fixed;
  top: 10vh;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.95);
  border: 1px solid var(--accent);
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  z-index: 999;
  border-radius: 8px;
  color: var(--fg);
  font-family: var(--font);
  backdrop-filter: blur(8px);
  box-shadow: 0 0 40px rgba(0,255,255,0.1);
  text-align: center;
}

#pro-modal .modal-form { margin-top: 1rem; }
#pro-modal .modal-input {
  padding: 0.7rem;
  width: 80%;
  margin-bottom: 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: #000;
  color: var(--accent);
  font-family: var(--font);
}

#pro-modal .modal-submit {
  background: var(--accent);
  color: #000;
  font-weight: bold;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  display: inline-block;
  text-decoration: none;
}

#pro-modal .close-btn {
  margin-top: 1.5rem;
  background: none;
  border: none;
  color: var(--accent-hover);
  cursor: pointer;
  font-family: var(--font);
}

.modal-msg { margin: 1rem 0 1.5rem; }
.modal-note { font-size: 0.95rem; }
.modal-prompt { margin-top: 1rem; }

/* Terms & Privacy Modal */
#legalModal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.95);
  color: var(--fg);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 2rem;
  max-width: 26rem;
  z-index: 999;
  text-align: center;
  box-shadow: 0 0 40px rgba(0,255,255,0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
}
#legalModal.fade-in { opacity: 1; }
.legal-check { display: block; margin: 1rem 0; }
.legal-actions { display: flex; justify-content: center; gap: 1rem; }
.legal-title { margin-top: 0; }
.legal-footer {
  font-size: 0.85rem;
  color: var(--text-muted, #adcdda);
  margin-top: 0.5rem;
}

/* Privacy TL;DR bullet list */
.privacy-tldr-list {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  text-align: left;
  line-height: 1.4;
}

.privacy-tldr-list li::before {
  content: "\2022"; /* bullet */
  margin-right: 0.5rem;
}

/* --- Next-steps action buttons --- */
.next-steps-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.next-step-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.9rem;
  border-radius: 6px;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.next-step-btn:hover {
  transform: translateY(-1px);
}

.next-step-free {
  background: var(--accent);
  color: #000;
  border: none;
}

.next-step-free:hover {
  box-shadow: 0 0 14px rgba(255, 77, 77, 0.3);
}

.next-step-pro {
  background: rgba(255, 77, 77, 0.08);
  color: #ffcaca;
  border: 1px solid rgba(255, 77, 77, 0.2);
}

.next-step-pro:hover {
  border-color: rgba(255, 77, 77, 0.45);
  box-shadow: 0 0 12px rgba(255, 77, 77, 0.15);
}

.next-step-pro-cta {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-family: var(--font);
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 0 18px rgba(255, 77, 77, 0.2);
  text-align: center;
}

.next-step-pro-cta:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 22px rgba(255, 77, 77, 0.3);
}

.pro-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: rgba(255, 77, 77, 0.18);
  color: var(--accent);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.quota-context {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted, #adcdda);
  text-align: left;
}

/* --- Pro upsell card (post-results) --- */
.pro-upsell {
  margin-top: 1rem;
  border: 1px solid rgba(255, 77, 77, 0.25);
  background: linear-gradient(160deg, rgba(255, 77, 77, 0.06), rgba(30, 0, 0, 0.82));
  text-align: center;
}

/* --- Quota modal improvements --- */
.modal-benefits {
  text-align: left;
  margin: 1rem 0;
}

.modal-benefits-lead {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: #ffcaca;
}

.modal-benefits-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.modal-benefits-list li {
  padding: 0.25rem 0;
  font-size: 0.9rem;
  color: #ffcaca;
}

.modal-benefits-list li::before {
  content: "\2713";
  color: var(--accent);
  margin-right: 0.5rem;
  font-weight: bold;
}

.modal-price {
  font-size: 0.88rem;
  color: #aaa;
  margin: 0.75rem 0 1rem;
}

.modal-reset {
  font-size: 0.85rem;
  color: var(--text-muted, #adcdda);
  margin: 0.75rem 0 0;
}

/* --- Section labels for grouped audit results --- */
.section-label {
  margin-top: 1.2rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #aaa;
}

@media (max-width: 540px) {
  .next-steps-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------- Global Scrollbar Styling --------- */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 77, 77, 0.04);
}

::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: limegreen;
}

/* Firefox support */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) rgba(255, 77, 77, 0.05);
}

/* Entrance rhythm: stagger the first dozen result cards (40ms steps) so the
   audit reads as a delivery rather than a one-frame dump; later cards share
   the cap so long audits don't crawl. */
#output .audit-card { animation-fill-mode: backwards; } /* hidden during its delay */
#output .audit-card:nth-child(1) { animation-delay: 0ms; }
#output .audit-card:nth-child(2) { animation-delay: 40ms; }
#output .audit-card:nth-child(3) { animation-delay: 80ms; }
#output .audit-card:nth-child(4) { animation-delay: 120ms; }
#output .audit-card:nth-child(5) { animation-delay: 160ms; }
#output .audit-card:nth-child(6) { animation-delay: 200ms; }
#output .audit-card:nth-child(7) { animation-delay: 240ms; }
#output .audit-card:nth-child(8) { animation-delay: 280ms; }
#output .audit-card:nth-child(9) { animation-delay: 320ms; }
#output .audit-card:nth-child(10) { animation-delay: 360ms; }
#output .audit-card:nth-child(n + 11) { animation-delay: 400ms; }

/* Reduced motion: results appear immediately — no pop, no stagger, and the
   `both` fill can't hide cards behind a delayed start. */
@media (prefers-reduced-motion: reduce) {
  #output .audit-card {
    animation: none;
    transition: none;
  }
}
