/* ==========================================================================
   OneClick KB — Extensions to the marketing site theme
   Loaded ALONGSIDE oneclick-website/styles.css. Only adds KB-specific
   components; never overrides shared header/footer/button rules.
   ========================================================================== */

/* ----- KB header / "Help" badge ------------------------------------------- */
/* The KB is gated; the header is KB-internal nav, not the marketing nav.
   The logo carries a small "Help" badge so users always know which surface
   they're on. */
.logo .help-badge {
  display: inline-block; vertical-align: middle;
  margin-left: 10px; padding: 4px 9px;
  background: var(--red); color: white;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: var(--radius-sm);
}
/* Active-state used when an audience hub is rendered */
.header-nav > a.help-active {
  color: white;
}
.header-nav > a.help-active::after {
  content: ""; position: absolute; bottom: -22px; left: 0; right: 0;
  height: 3px; background: var(--red);
}

/* ----- Welcome banner ------------------------------------------------------ */
/* Hidden by default; kb-tracking.js shows it when identity is captured from
   the clientToken JWT in the URL. Subtle pill above the H1 in the hero. */
.kb-welcome {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--ink-soft); background: white;
  border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.kb-welcome [data-kb-welcome-greeting] { color: var(--ink); font-weight: 700; }
.kb-welcome [data-kb-welcome-store]    { color: var(--ink-soft); }
.kb-welcome.is-demo { border-color: var(--red-soft); background: var(--red-soft); }
.kb-welcome-demo {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--red); color: white;
  padding: 3px 8px; border-radius: var(--radius-sm);
  margin-left: 4px;
}

/* ----- KB hero search ------------------------------------------------------ */
.kb-search {
  position: relative; max-width: 720px; margin: 32px auto 0;
  background: white; border: 2px solid var(--line);
  border-radius: var(--radius-md); padding: 6px 6px 6px 22px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-1); transition: border-color 0.15s, box-shadow 0.15s;
}
.kb-search:focus-within { border-color: var(--red); box-shadow: var(--shadow-2); }
.kb-search svg, .kb-search .icon {
  width: 22px; height: 22px; color: var(--ink-muted); flex-shrink: 0;
  font-size: 18px;
}
.kb-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 17px; padding: 14px 0; color: var(--ink);
}
.kb-search input::placeholder { color: var(--ink-muted); }
.kb-search button {
  background: var(--red); color: white; border: none; cursor: pointer;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-family: inherit; font-weight: 700; font-size: 13px;
  letter-spacing: 0.06em; text-transform: uppercase;
  transition: background 0.15s;
}
.kb-search button:hover { background: var(--red-deep); }

.kb-suggestions {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  margin-top: 18px; max-width: 720px; margin-left: auto; margin-right: auto;
}
.kb-suggestions .label {
  font-size: 13px; color: var(--ink-muted); margin-right: 4px;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
  align-self: center;
}
.kb-suggestions a {
  font-size: 14px; padding: 7px 14px; border-radius: 999px;
  background: white; border: 1px solid var(--line);
  color: var(--ink-soft); transition: all 0.15s;
  text-decoration: none;
}
.kb-suggestions a:hover {
  border-color: var(--red); color: var(--red); text-decoration: none;
}

/* KB-specific hero (centered, search-forward) */
.kb-hero {
  position: relative; overflow: hidden; background: white;
  padding: 72px 32px 64px; text-align: center;
  border-bottom: 1px solid var(--line);
}
.kb-hero::before {
  content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 38%;
  background: repeating-linear-gradient(
    135deg, transparent 0, transparent 18px,
    var(--stripe-blue) 18px, var(--stripe-blue) 20px);
  opacity: 0.5; z-index: 1;
}
.kb-hero::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 38%;
  background: repeating-linear-gradient(
    -135deg, transparent 0, transparent 18px,
    var(--stripe-blue) 18px, var(--stripe-blue) 20px);
  opacity: 0.5; z-index: 1;
}
.kb-hero-inner { position: relative; z-index: 2; max-width: 880px; margin: 0 auto; }
.kb-hero h1 {
  font-size: 52px; line-height: 1.05; letter-spacing: -0.02em;
  margin: 0 0 16px; color: var(--ink); font-weight: 800;
}
.kb-hero .lede {
  font-size: 19px; color: var(--ink-soft);
  max-width: 640px; margin: 0 auto 12px;
}

/* ----- Audience picker (3 cards) ------------------------------------------ */
.kb-audience-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  margin-top: 48px;
}
.kb-audience-card {
  background: white; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 36px 32px 32px; transition: all 0.2s; display: flex; flex-direction: column;
  text-decoration: none;
}
.kb-audience-card:hover {
  border-color: var(--red); box-shadow: var(--shadow-2);
  transform: translateY(-2px); text-decoration: none;
}
.kb-audience-card .icon-square {
  width: 56px; height: 56px; border-radius: var(--radius-md);
  background: var(--red-soft); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin-bottom: 22px;
}
.kb-audience-card h3 {
  font-size: 22px; color: var(--ink); margin: 0 0 4px;
}
.kb-audience-card .role-tag {
  font-size: 13px; color: var(--ink-muted); margin-bottom: 16px;
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600;
}
.kb-audience-card p {
  margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; line-height: 1.55;
}
.kb-audience-card ul {
  list-style: none; padding: 0; margin: 0 0 22px; flex: 1;
}
.kb-audience-card ul li {
  font-size: 14px; color: var(--ink-soft); padding: 5px 0;
  display: flex; align-items: flex-start; gap: 10px;
}
.kb-audience-card ul li::before {
  content: "→"; color: var(--red); font-weight: 800; flex-shrink: 0;
}
.kb-audience-card .card-link {
  font-weight: 700; font-size: 14px; color: var(--red);
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: auto;
}

/* ----- Module grid (used on landing + audience hubs) ---------------------- */
.kb-module-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
  margin-top: 32px;
}
.kb-module-card {
  background: white; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 28px; transition: all 0.2s; display: flex; flex-direction: column;
  text-decoration: none;
}
.kb-module-card:hover {
  border-color: var(--red); box-shadow: var(--shadow-2);
  transform: translateY(-2px); text-decoration: none;
}
.kb-module-card .icon-square {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--red-soft); color: var(--red);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; margin-bottom: 16px;
}
.kb-module-card h3 {
  font-size: 17px; color: var(--ink); margin: 0 0 6px; line-height: 1.3;
}
.kb-module-card p {
  margin: 0 0 14px; color: var(--ink-soft); font-size: 14px; line-height: 1.5;
}
.kb-module-card .article-count {
  font-size: 12px; color: var(--ink-muted); margin-top: auto;
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
}

/* ----- Article list rows -------------------------------------------------- */
.kb-article-list {
  display: flex; flex-direction: column; gap: 0;
  border-top: 1px solid var(--line);
}
.kb-article-row {
  display: grid; grid-template-columns: 110px 1fr auto; gap: 20px;
  align-items: center; padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s; text-decoration: none;
}
.kb-article-row:hover {
  background: var(--bg-alt); text-decoration: none;
}
.kb-article-row .badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: var(--radius-sm); display: inline-block;
  text-align: center;
}
.kb-article-row .badge.operator { background: #FFF5DD; color: #8A6500; }
.kb-article-row .badge.leader { background: #DEEBF7; color: #1F4F8E; }
.kb-article-row .badge.team-member { background: var(--red-soft); color: var(--red-deep); }
.kb-article-row .badge.troubleshoot { background: #FBE9E7; color: #B7371E; }
.kb-article-row .badge.reference { background: var(--line-soft); color: var(--ink-soft); }
.kb-article-row .badge.how-to { background: #E6F4EA; color: #1B5E20; }
.kb-article-row h4 {
  font-size: 17px; font-weight: 700; color: var(--ink);
  margin: 0 0 4px; line-height: 1.4;
}
.kb-article-row .meta {
  font-size: 13px; color: var(--ink-muted);
}
.kb-article-row .arrow {
  color: var(--red); font-weight: 800; font-size: 18px;
}

/* ----- Module hub heading row + "at a glance" ----------------------------- */
.kb-glance {
  background: var(--bg-alt); border-left: 3px solid var(--red);
  padding: 20px 24px; border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 0 0 32px;
}
.kb-glance .label {
  font-size: 12px; font-weight: 700; color: var(--red);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px;
}
.kb-glance p { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.6; }

/* ----- Article body ------------------------------------------------------- */
.kb-article-shell {
  display: grid; grid-template-columns: 1fr 240px; gap: 64px;
  max-width: var(--maxw); margin: 0 auto;
}
.kb-article-body { max-width: 740px; }
.kb-article-body h2 {
  font-size: 28px; margin-top: 40px; margin-bottom: 14px;
}
.kb-article-body h3 {
  font-size: 21px; margin-top: 28px; margin-bottom: 10px; color: var(--ink);
}
.kb-article-body p {
  font-size: 17px; color: var(--ink-soft); margin: 0 0 16px;
}
.kb-article-body ul, .kb-article-body ol {
  font-size: 17px; color: var(--ink-soft); padding-left: 22px;
}
.kb-article-body li { margin-bottom: 8px; }
.kb-article-body code {
  background: var(--line-soft); border: 1px solid var(--line);
  padding: 2px 6px; border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 14px;
}
.kb-article-body pre {
  background: var(--navy); color: #E8EEF7; padding: 18px 20px;
  border-radius: var(--radius-md); overflow-x: auto; font-size: 14px;
  margin: 18px 0;
}
.kb-article-body img { border-radius: var(--radius-md); margin: 18px 0; }
.kb-article-body blockquote {
  border-left: 3px solid var(--red); padding: 8px 18px;
  background: var(--bg-alt); margin: 18px 0;
  color: var(--ink); font-style: normal;
}
.kb-article-body table {
  width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px;
}
.kb-article-body th, .kb-article-body td {
  text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.kb-article-body th { background: var(--bg-alt); color: var(--ink); font-weight: 700; }

.kb-article-toc {
  position: sticky; top: 100px; align-self: start;
  font-size: 14px;
}
.kb-article-toc .label {
  font-size: 12px; font-weight: 700; color: var(--ink-muted);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 12px;
}
.kb-article-toc ul { list-style: none; padding: 0; margin: 0; }
.kb-article-toc li { padding: 6px 0; }
.kb-article-toc a {
  color: var(--ink-soft); border-left: 2px solid var(--line);
  padding-left: 12px; display: block;
}
.kb-article-toc a:hover, .kb-article-toc a.active {
  color: var(--red); border-left-color: var(--red); text-decoration: none;
}

/* ----- "Was this helpful?" widget ----------------------------------------- */
.kb-helpful {
  margin: 56px 0 32px; padding: 28px 32px;
  background: var(--bg-alt); border: 1px solid var(--line);
  border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.kb-helpful .prompt {
  font-size: 15px; font-weight: 700; color: var(--ink);
}
.kb-helpful .actions { display: flex; gap: 10px; }
.kb-helpful button {
  background: white; border: 1.5px solid var(--line);
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: inherit; font-weight: 600; font-size: 14px;
  color: var(--ink-soft); cursor: pointer; transition: all 0.15s;
}
.kb-helpful button:hover {
  border-color: var(--red); color: var(--red);
}
.kb-helpful button.is-selected {
  background: var(--red); color: white; border-color: var(--red);
}

/* ----- "Still stuck?" callout --------------------------------------------- */
.kb-stuck {
  margin: 0 0 56px; padding: 28px 32px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: white; border-radius: var(--radius-md);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.kb-stuck h3 { color: white; margin: 0 0 4px; font-size: 19px; }
.kb-stuck p { color: rgba(255,255,255,0.78); margin: 0; font-size: 15px; }
.kb-stuck .actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

/* ----- Recently updated list (landing page) ------------------------------- */
.kb-recent-list {
  border-top: 1px solid var(--line); margin-top: 24px;
}
.kb-recent-row {
  display: grid; grid-template-columns: 80px 1fr auto; gap: 20px;
  align-items: center; padding: 16px 0;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.kb-recent-row:hover { text-decoration: none; }
.kb-recent-row:hover .recent-title { color: var(--red); }
.kb-recent-row .recent-date {
  font-size: 13px; color: var(--ink-muted);
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600;
}
.kb-recent-row .recent-title { font-weight: 700; color: var(--ink); font-size: 16px; transition: color 0.12s; }
.kb-recent-row .recent-changes {
  font-size: 13px; color: var(--ink-muted); display: block; margin-top: 2px;
}
.kb-recent-row .status {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: var(--radius-sm);
}
.kb-recent-row .status.new { background: #E6F4EA; color: #1B5E20; }
.kb-recent-row .status.updated { background: #DEEBF7; color: #1F4F8E; }

/* ----- Section heading for KB pages ---------------------------------------- */
.kb-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 18px;
}
.kb-section-head h2 { margin: 0; font-size: 30px; }
.kb-section-head a {
  font-size: 14px; font-weight: 700; color: var(--red);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* ----- Responsive ---------------------------------------------------------- */
@media (max-width: 980px) {
  .kb-hero { padding: 56px 24px 48px; }
  .kb-hero h1 { font-size: 36px; }
  .kb-audience-grid, .kb-module-grid { grid-template-columns: 1fr; }
  .kb-article-row { grid-template-columns: 90px 1fr; gap: 14px; }
  .kb-article-row .arrow { display: none; }
  .kb-article-shell { grid-template-columns: 1fr; gap: 32px; }
  .kb-article-toc { position: static; order: -1; }
  .kb-stuck { padding: 22px 24px; }
  .kb-stuck .actions { margin-left: 0; }
}
