/* AI Friendly — Component patterns shared across surfaces */

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}
.topbar__nav { display: flex; gap: 28px; align-items: center; }
.topbar__nav a {
  color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: color 120ms;
}
.topbar__nav a:hover { color: var(--text-1); }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 64px 0 48px; background: var(--surface); }
.footer__inner { max-width: 1240px; margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 48px; }
.footer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 0 16px; font-family: var(--font-mono); font-weight: 600; }
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer ul a { color: var(--text-2); font-size: 14px; }
.footer ul a:hover { color: var(--text-1); }
.footer__legal { max-width: 1240px; margin: 48px auto 0; padding: 24px 32px 0; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 13px; color: var(--text-3); }

/* ---------- Scan input ---------- */
.scan-field {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-md);
  gap: 6px;
}
.scan-field:focus-within { border-color: var(--af-blue); box-shadow: 0 0 0 4px var(--af-blue-50), var(--shadow-md); }
.scan-field__prefix {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 12px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 13px;
  border-right: 1px solid var(--border);
  height: 36px;
}
.scan-field input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  padding: 0 12px;
  height: 48px;
  color: var(--text-1);
  font-family: inherit;
}
.scan-field input::placeholder { color: var(--text-4); }
.scan-field .btn { height: 48px; padding: 0 22px; }

/* ---------- Score ring ---------- */
.score-ring { position: relative; width: 200px; height: 200px; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring__num {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.score-ring__num .num { font-size: 56px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.score-ring__num .denom { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 6px; }

/* ---------- Sidebar (app) ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; background: var(--bg); }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; gap: 8px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar__brand { padding: 8px 12px 16px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.sidebar__site {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: var(--ink-50);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.sidebar__site-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar__site-favicon { width: 22px; height: 22px; border-radius: 6px; background: var(--af-blue); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.sidebar__site-name { font-size: 13px; font-weight: 550; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__section-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-4); padding: 12px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}
.nav-item:hover { background: var(--ink-100); color: var(--text-1); }
.nav-item.is-active { background: var(--af-blue-50); color: var(--af-blue-700); }
.nav-item .stage {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-4);
  letter-spacing: 0.05em;
}
.nav-item.is-active .stage { color: var(--af-blue); }

/* App main */
.app-main { padding: 0; min-width: 0; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.app-content { padding: 32px; max-width: 1280px; }

.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-3); }
.crumbs b { color: var(--text-1); font-weight: 550; }

/* ---------- Stat / KPI tile ---------- */
.kpi { padding: 20px; }
.kpi__label { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.kpi__value { font-family: var(--font-display); font-size: 32px; font-weight: 580; letter-spacing: -0.02em; line-height: 1.1; }
.kpi__delta { font-size: 13px; margin-top: 6px; display: inline-flex; align-items: center; gap: 6px; }
.kpi__delta--up { color: var(--signal-good); }
.kpi__delta--down { color: var(--signal-bad); }

/* Issue card row */
.issue {
  display: grid; grid-template-columns: 24px 1fr auto auto; gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.issue:last-child { border-bottom: none; }
.issue__title { font-size: 14px; font-weight: 550; color: var(--text-1); }
.issue__sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.issue__meta { display: flex; gap: 8px; }
.issue:hover { background: var(--ink-50); }

/* Gauge bar */
.gauge { width: 100%; height: 8px; border-radius: var(--r-full); background: var(--ink-150); overflow: hidden; }
.gauge__fill { height: 100%; border-radius: inherit; background: var(--af-blue); }
.gauge__fill--good { background: var(--signal-good); }
.gauge__fill--warn { background: var(--signal-warn); }
.gauge__fill--bad  { background: var(--signal-bad); }

/* Code preview */
.codeblock {
  background: var(--ink-900);
  color: #E2E2E7;
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  overflow: auto;
  border: 1px solid var(--ink-800);
}
.codeblock .k { color: #8FB4FF; }
.codeblock .s { color: #A6E3B0; }
.codeblock .c { color: #6B6B78; }
.codeblock .p { color: #E89A2B; }

/* Mini line chart */
.spark { width: 100%; height: 40px; }

/* Step list */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.step__num { width: 28px; height: 28px; border-radius: 50%; background: var(--ink-100); color: var(--text-3); display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.step.is-done .step__num { background: var(--signal-good); color: #fff; }
.step.is-active .step__num { background: var(--af-blue); color: #fff; }
.step.is-active { border-color: var(--af-blue-200); background: var(--af-blue-50); }
.step__label { font-size: 14px; font-weight: 500; }
.step__hint { font-size: 12px; color: var(--text-3); font-family: var(--font-mono); }

/* Mobile frame */
.mobile-frame {
  width: 360px;
  border-radius: 36px;
  border: 10px solid var(--ink-900);
  background: var(--ink-900);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  flex-shrink: 0;
}
.mobile-frame__screen { background: var(--bg); height: 720px; overflow: hidden; position: relative; }

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--af-blue-100);
  border-top-color: var(--af-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Pulse */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.pulse { animation: pulse-dot 1.4s ease-in-out infinite; }

/* Scan-line shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, var(--ink-150) 0%, var(--ink-100) 50%, var(--ink-150) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

/* ---------- Back-to-system pill (fixed, bottom-left) ---------- */
.sys-back {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.04));
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  transition: border-color 120ms, color 120ms, transform 120ms, background 120ms;
}
.sys-back:hover {
  border-color: var(--af-blue);
  color: var(--text-1);
  transform: translateX(-1px);
}
.sys-back__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--af-blue);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  letter-spacing: 0;
}

/* ---------- Workspace footer (shared across internal app pages) ----------
   Use on every authenticated workspace surface (billing, asset review,
   onboarding, profile, publishing, track). Public marketing pages keep
   their own .site footer. */
.ws-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0 36px; margin-top: 56px; }
.ws-footer__inner { max-width: 1320px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.ws-footer__l { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.ws-footer__l .meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-4); letter-spacing: 0.06em; text-transform: uppercase; }
.ws-footer__l .meta b { color: var(--text-3); font-weight: 600; }
.ws-footer__r { display: inline-flex; align-items: center; gap: 20px; }
.ws-footer__r a { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; }
.ws-footer__r a:hover { color: var(--text-1); }
.ws-footer__r .dot--status { display: inline-flex; align-items: center; gap: 6px; color: var(--signal-good); }
.ws-footer__r .dot--status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
@media (max-width: 720px) {
  .ws-footer { padding: 20px 0 28px; margin-top: 40px; }
  .ws-footer__inner { padding: 0 18px; }
  .ws-footer__r { gap: 14px; }
}
