/* Shannon component foundation. Loads after tokens.css and before the inline <style>
   block so page-specific rules can still override during the migration. */

/* ---------- Accessibility primitives ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Universal focus ring. Only keyboard-driven focus shows it. */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: var(--rxs);
}
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--glow);
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--acc) !important;
  outline: none;
  box-shadow: 0 0 0 3px var(--glow);
}

/* Skip link (for the sidebar to main jump) */
.skip-to-content {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--acc);
  color: #0b0b0b;
  padding: 8px 14px;
  border-radius: var(--rxs);
  font-weight: 600;
  z-index: 10000;
}
.skip-to-content:focus-visible {
  left: 8px;
  outline: 2px solid var(--t0);
}

/* ---------- Severity badge (color + icon + text together) ---------- */
.sev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  line-height: 1;
  white-space: nowrap;
}
.sev::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.sev-critical { color: var(--sev-critical); background: var(--sev-critical-bg); }
.sev-high     { color: var(--sev-high);     background: var(--sev-high-bg); }
.sev-medium   { color: var(--sev-medium);   background: var(--sev-medium-bg); }
.sev-low      { color: var(--sev-low);      background: var(--sev-low-bg); }
.sev-info     { color: var(--sev-info);     background: var(--sev-info-bg); }

/* Team tags */
.team {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.team-red    { color: var(--rt); background: var(--red-bg); }
.team-blue   { color: var(--bt); background: var(--blu-bg); }
.team-purple { color: var(--pt); background: var(--pt-bg); }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--s1), var(--bg2));
  border: 1px dashed var(--brd2);
  min-height: 240px;
  color: var(--t2);
}
.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, var(--s4), var(--s2) 70%);
  border: 1px solid var(--brd2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-4);
  color: var(--t2);
}
.empty-state h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--fs-h3);
  color: var(--t0);
  margin-bottom: var(--sp-2);
  font-weight: 700;
}
.empty-state p {
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  max-width: 440px;
  margin-bottom: var(--sp-4);
}
.empty-state-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Skeleton loader ---------- */
.skel {
  background: linear-gradient(90deg, var(--s2) 0%, var(--s3) 50%, var(--s2) 100%);
  background-size: 200% 100%;
  border-radius: var(--rxs);
  animation: skel-shimmer 1.4s var(--ease-in-out) infinite;
  display: block;
}
.skel-line { height: 12px; margin-bottom: 8px; }
.skel-title { height: 22px; width: 60%; margin-bottom: 14px; }
.skel-card { height: 120px; border-radius: var(--rs); }
.skel-avatar { width: 42px; height: 42px; border-radius: 12px; }
@keyframes skel-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: var(--s2); }
}

/* ---------- Toast (one-shot copy/save feedback) ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--s3);
  color: var(--t0);
  border: 1px solid var(--brd2);
  padding: 10px 16px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fast), transform var(--fast);
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.success { border-color: rgba(127, 166, 110, 0.35); }
.toast.error   { border-color: rgba(226, 104, 71, 0.35); }

/* ---------- Section heading (used by redesigned pages) ---------- */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--acc2);
  margin-bottom: 10px;
}
.section-eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--acc);
  box-shadow: 0 0 10px var(--acc);
}

/* ---------- Card hover lift (interactive cards only) ---------- */
.card-interactive {
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
  cursor: pointer;
}
.card-interactive:hover {
  border-color: var(--brd3);
  background: var(--s2);
  transform: translateY(-1px);
}
.card-interactive:active {
  transform: translateY(0);
}

/* ---------- Disabled state ---------- */
[aria-disabled="true"],
button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Icon sizing ---------- */
.ico    { width: 16px; height: 16px; flex-shrink: 0; }
.ico-sm { width: 14px; height: 14px; flex-shrink: 0; }
.ico-lg { width: 20px; height: 20px; flex-shrink: 0; }
.ico-xl { width: 28px; height: 28px; flex-shrink: 0; }

/* ---------- Sub-tabs (used by scan-detail group navigation) ---------- */
.subtab:hover {
  background: var(--s2) !important;
  color: var(--t1) !important;
  border-color: var(--brd2) !important;
}
.subtab.team-red[aria-selected="true"]    { color: var(--rt) !important; }
.subtab.team-blue[aria-selected="true"]   { color: var(--bt) !important; }
.subtab.team-purple[aria-selected="true"] { color: var(--pt) !important; }
.tabs-primary .tab.on {
  color: var(--t0);
  position: relative;
}
.tabs-primary .tab.on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--acc);
  border-radius: 2px 2px 0 0;
}

/* ---------- Code Scan page (redesign) ---------- */
.cs-hero {
  position: relative;
  padding: 30px 32px 26px;
  border-radius: 18px;
  border: 1px solid var(--brd);
  background:
    radial-gradient(700px 280px at 0% 0%, rgba(217, 119, 87, 0.10), transparent 60%),
    radial-gradient(600px 220px at 100% 100%, rgba(91, 148, 196, 0.07), transparent 60%),
    linear-gradient(180deg, var(--s1), var(--bg2));
  overflow: hidden;
  margin-bottom: 18px;
}
.cs-hero h1 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--t0);
  margin-bottom: 8px;
}
.cs-hero p {
  color: var(--t2);
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 640px;
}
.cs-hero-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Mode picker — segmented control */
.cs-modes {
  display: inline-flex;
  padding: 4px;
  border: 1px solid var(--brd2);
  border-radius: 12px;
  background: var(--bg);
  gap: 2px;
}
.cs-mode {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  background: transparent;
  color: var(--t2);
  border: 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 12.5px;
  transition: background var(--fast), color var(--fast);
}
.cs-mode:hover { color: var(--t0); }
.cs-mode.on {
  background: var(--glow);
  color: var(--t0);
  box-shadow: 0 0 0 1px var(--glow3);
}

/* Drop zone — bigger, friendlier */
.cs-dz {
  position: relative;
  border: 1.5px dashed var(--brd2);
  border-radius: var(--r);
  padding: 36px 22px;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  text-align: center;
  transition: border-color var(--fast), background var(--fast);
  cursor: pointer;
}
.cs-dz:hover { border-color: var(--brd3); }
.cs-dz.drag {
  border-color: var(--acc);
  background: var(--glow);
}
.cs-dz-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: radial-gradient(circle at 30% 30%, var(--s4), var(--s2) 70%);
  border: 1px solid var(--brd2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  color: var(--acc2);
}
.cs-dz h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  color: var(--t0);
  margin-bottom: 6px;
  font-weight: 700;
}
.cs-dz p {
  color: var(--t2);
  font-size: 12.5px;
  line-height: 1.55;
  max-width: 460px;
  margin: 0 auto 16px;
}
.cs-dz-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

/* File tree (project mode) */
.cs-tree {
  background: var(--bg);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  max-height: 460px;
  overflow: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 10px 0;
}
.cs-tree-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px;
  color: var(--t1);
  cursor: pointer;
  user-select: none;
  border-radius: 0;
  white-space: nowrap;
}
.cs-tree-row:hover { background: var(--s2); }
.cs-tree-row input[type="checkbox"] {
  accent-color: var(--acc);
  width: 14px; height: 14px;
}
.cs-tree-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cs-tree-row .meta {
  color: var(--t3);
  font-size: 10.5px;
  font-family: 'Inter', sans-serif;
}
.cs-tree-row.dir { color: var(--t0); font-weight: 600; }
.cs-tree-row.skipped { color: var(--t4); }
.cs-tree-row.scanned .name { color: var(--grn); }
.cs-tree-row.has-findings .name { color: var(--ylw); }
.cs-tree-row.has-critical .name { color: var(--red); }

/* Project summary cards */
.cs-proj-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.cs-proj-summary .crd {
  padding: 14px 16px;
}
.cs-proj-summary .crd-l {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--t3);
  font-weight: 700;
  margin-bottom: 6px;
}
.cs-proj-summary .crd-v {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--t0);
}

/* Per-file scan progress bar */
.cs-scan-progress {
  height: 6px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0 14px;
}
.cs-scan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--acc), var(--acc2));
  transition: width var(--fast);
}

/* ---------- Tap targets (mobile) ---------- */
@media (max-width: 640px) {
  button,
  .btn,
  [role="button"],
  a.btn {
    min-height: 44px;
    min-width: 44px;
  }
}
