/* ==========================================================================
   SEO Analyzer — design system on top of Bootstrap 5
   ========================================================================== */
:root {
  --brand-navy: #111827;
  --brand-blue: #2563EB;
  --brand-violet: #7C3AED;
  --brand-bg: #F8FAFC;
  --ok: #16A34A; --warn: #F59E0B; --err: #DC2626;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --border: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(17,24,39,.04), 0 1px 3px rgba(17,24,39,.06);
  --shadow: 0 4px 16px rgba(17,24,39,.06);
  --sidebar-w: 248px;
  --bs-primary: #2563EB; --bs-primary-rgb: 37,99,235;
  --bs-body-font-family: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --bs-body-color: #111827; --bs-body-bg: #F8FAFC;
  --bs-border-color: #E5E7EB;
  --bs-link-color: #2563EB; --bs-link-hover-color: #1D4ED8;
}
[data-bs-theme="dark"] {
  --surface: #0F172A; --surface-2: #1E293B; --border: #1F2937; --text: #E5E7EB; --muted: #94A3B8;
  --brand-bg: #0B1120; --bs-body-bg: #0B1120; --bs-body-color: #E5E7EB; --bs-border-color: #1F2937;
  --shadow-sm: none; --shadow: none;
}
body { background: var(--brand-bg); color: var(--text); font-size: 14.5px; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5 { letter-spacing: -.015em; font-weight: 650; }
.text-muted, .muted { color: var(--muted) !important; }
.fw-650 { font-weight: 650; }
.small-caps { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.btn { border-radius: 8px; font-weight: 550; }
.btn-primary { background: var(--brand-blue); border-color: var(--brand-blue); }
.btn-primary:hover { background: #1D4ED8; border-color: #1D4ED8; }
.btn-dark { background: var(--brand-navy); }
.form-control, .form-select { border-radius: 8px; border-color: var(--border); }
.form-control:focus, .form-select:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 14px 18px; font-weight: 600; }
.card-body { padding: 18px; }
.table { --bs-table-bg: transparent; margin: 0; }
.table > :not(caption) > * > * { padding: 10px 14px; border-color: var(--border); }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.badge { font-weight: 600; border-radius: 6px; }
.icon { width: 18px; height: 18px; stroke-width: 1.9; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }

/* Severity */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.sev::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sev-critical { color: #B91C1C; background: #FEE2E2; }
.sev-high { color: #C2410C; background: #FFEDD5; }
.sev-medium { color: #A16207; background: #FEF9C3; }
.sev-low { color: #1D4ED8; background: #DBEAFE; }
.sev-passed { color: #15803D; background: #DCFCE7; }
[data-bs-theme="dark"] .sev-critical { background: rgba(220,38,38,.15); color: #FCA5A5; }
[data-bs-theme="dark"] .sev-high { background: rgba(234,88,12,.15); color: #FDBA74; }
[data-bs-theme="dark"] .sev-medium { background: rgba(234,179,8,.15); color: #FDE047; }
[data-bs-theme="dark"] .sev-low { background: rgba(37,99,235,.18); color: #93C5FD; }
[data-bs-theme="dark"] .sev-passed { background: rgba(22,163,74,.15); color: #86EFAC; }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--brand-navy); color: #CBD5E1; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1030; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-blue); display: grid; place-items: center; color: #fff; }
.sidebar nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.sidebar .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #64748B; padding: 14px 10px 6px; font-weight: 600; }
.sidebar a.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #CBD5E1; text-decoration: none; font-weight: 500; margin-bottom: 2px; }
.sidebar a.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav-item.active { background: rgba(37,99,235,.18); color: #fff; }
.sidebar a.nav-item.active .icon { color: #60A5FA; }
.sidebar .nav-item .lock { margin-left: auto; opacity: .55; }
.sidebar .plan-box { margin: 12px; padding: 14px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 13px; }
.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; }
.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1020; }
.content { padding: 24px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.breadcrumb { font-size: 12.5px; margin-bottom: 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--surface-2); display: inline-grid; place-items: center; font-weight: 600; font-size: 13px; color: var(--brand-blue); }
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .content { padding: 16px; }
}

/* Metrics */
.metric { padding: 16px 18px; }
.metric .label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.metric .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; }
.metric .sub { font-size: 12px; color: var(--muted); }
.unavailable { color: var(--muted); font-size: 13px; font-weight: 500; }

/* Score ring */
.score-ring { --v: 0; --c: var(--brand-blue); width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--v) * 1%), var(--surface-2) 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.score-ring span { position: relative; font-size: 34px; font-weight: 750; letter-spacing: -.03em; }
.score-ring small { position: relative; display: block; text-align: center; font-size: 11px; color: var(--muted); margin-top: -6px; }
.score-good { --c: var(--ok); } .score-ok { --c: var(--warn); } .score-bad { --c: var(--err); }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > div { height: 100%; background: var(--brand-blue); border-radius: 99px; }
.bar.warn > div { background: var(--warn); } .bar.full > div { background: var(--err); }

/* Issues */
.issue-row { cursor: pointer; }
.issue-detail { background: var(--surface-2); }
.issue-detail pre { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin: 0; }
.url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state .icon { width: 36px; height: 36px; color: #94A3B8; margin-bottom: 10px; }
.locked-feature { border: 1px dashed var(--border); background: var(--surface-2); border-radius: var(--radius); padding: 22px; }

/* Public site */
.site-nav { background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
[data-bs-theme="dark"] .site-nav { background: rgba(11,17,32,.9); }
.site-nav .nav-link { color: var(--text); font-weight: 500; }
.hero { padding: 88px 0 56px; }
.hero h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.hero .lead { color: var(--muted); font-size: 18px; max-width: 620px; }
.hero-form { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: var(--shadow); max-width: 620px; }
.hero-form input { border: 0; font-size: 16px; }
.hero-form input:focus { box-shadow: none; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--brand-violet); background: rgba(124,58,237,.08); padding: 5px 12px; border-radius: 99px; }
.section { padding: 72px 0; }
.section h2 { font-size: 32px; font-weight: 720; letter-spacing: -.025em; }
.feature-card { padding: 22px; height: 100%; }
.feature-card .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(37,99,235,.08); color: var(--brand-blue); margin-bottom: 14px; }
.price-card { padding: 26px; height: 100%; display: flex; flex-direction: column; }
.price-card.highlight { border: 2px solid var(--brand-blue); box-shadow: var(--shadow); }
.price-card .price { font-size: 34px; font-weight: 750; letter-spacing: -.03em; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0; flex: 1; }
.price-card li { padding: 5px 0; display: flex; gap: 8px; font-size: 14px; }
.preview-frame { border-radius: 14px; border: 1px solid var(--border); background: var(--surface); box-shadow: 0 24px 48px rgba(17,24,39,.08); overflow: hidden; }
.footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: 13.5px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }

/* Print (reports) */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .nav-link:hover, .nav-item:hover, .dropdown-item:hover { text-decoration: none; }
