/* ============================================================
   SCMA Docs – Splunk Docs-inspired stylesheet
   ============================================================ */

/* ---- CSS variables ---------------------------------------- */
:root {
  --color-bg:          #ffffff;
  --color-surface:     #f7f8f9;
  --color-border:      #dde1e5;
  --color-text:        #1a1a1a;
  --color-text-muted:  #5a6270;
  --color-link:        #0070d2;
  --color-link-hover:  #005fb2;
  --color-accent:      #65a637;
  --color-accent-dark: #4c7d28;
  --color-warn-bg:     #fff8e1;
  --color-warn-border: #f0a500;
  --color-note-bg:     #e8f4fd;
  --color-note-border: #0070d2;
  --color-tip-bg:      #edfaed;
  --color-tip-border:  #65a637;
  --color-code-bg:     #1e2227;
  --color-code-text:   #c9d1d9;

  --nav-width:         260px;
  --toc-width:         220px;
  --topbar-height:     56px;
  --content-max:       820px;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius: 4px;
}

/* ---- Reset / base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
}
a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ---- Top bar ---------------------------------------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: #1a1a1a;
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
  gap: 0;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  padding: 4px 8px 4px 0;
  line-height: 0;
}
.hamburger svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; }

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar__brand:hover { text-decoration: none; }

.topbar__logo {
  width: 30px; height: 30px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.topbar__product {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.topbar__sep { color: #444; margin: 0 4px; font-size: 1.1rem; }
.topbar__doc { font-size: 0.85rem; color: #999; font-weight: 400; }

.topbar__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__version {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  background: rgba(101, 166, 55, 0.25);
  border: 1px solid rgba(101, 166, 55, 0.55);
  border-radius: 3px;
  padding: 3px 9px;
  letter-spacing: 0.02em;
}

.topbar__splunkbase {
  font-size: 0.8rem;
  color: #bbb;
  border: 1px solid #444;
  border-radius: 3px;
  padding: 4px 10px;
  transition: border-color .15s, color .15s;
}
.topbar__splunkbase:hover { color: #fff; border-color: #777; text-decoration: none; }

/* ---- Layout ----------------------------------------------- */
.layout {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}

/* ---- Sidebar ---------------------------------------------- */
.sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  background: #1e2227;
  color: #c0c8d4;
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #3a3f47; border-radius: 2px; }

.sidebar__inner { padding-bottom: 32px; }

.sidebar__header {
  padding: 16px 18px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: #555e6a;
  border-bottom: 1px solid #2a2f38;
}

.nav-section { }
.nav-section__title {
  display: block;
  padding: 14px 18px 4px;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4e5a68;
}

.nav-link {
  display: block;
  padding: 7px 18px 7px 22px;
  font-size: 0.855rem;
  color: #a8b4c2;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
  line-height: 1.35;
}
.nav-link:hover { background: #262c35; color: #dde4ee; text-decoration: none; }
.nav-link.active {
  color: #fff;
  background: #262c35;
  border-left-color: var(--color-accent);
  font-weight: 500;
}

.nav-link--sub {
  padding-left: 34px;
  font-size: 0.815rem;
  color: #7a8898;
}
.nav-link--sub:hover { color: #b8c4d4; }
.nav-link--sub.active { color: #c8e0b0; border-left-color: var(--color-accent); }

/* ---- Main ------------------------------------------------- */
.main {
  margin-left: var(--nav-width);
  flex: 1;
  display: flex;
  min-width: 0;
}

.content-wrap {
  flex: 1;
  min-width: 0;
  padding: 40px 40px 80px;
}

.content { max-width: var(--content-max); }

/* ---- Breadcrumb ------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-link); text-decoration: underline; }
.breadcrumb__sep { color: #bbb; }
.breadcrumb__current { color: var(--color-text); }

/* ---- Page header ------------------------------------------ */
.page-header {
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 20px;
  margin-bottom: 32px;
}
.page-header__label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-accent);
  margin-bottom: 6px;
}
.page-header h1 {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 10px;
}
.page-header__desc {
  font-size: 0.97rem;
  color: var(--color-text-muted);
  max-width: 640px;
  line-height: 1.55;
}

/* ---- Typography ------------------------------------------- */
h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-top: 4px;
  color: var(--color-text);
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 8px;
}
h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 18px 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
p { margin-bottom: 14px; }
ul, ol { margin: 0 0 14px 22px; }
li { margin-bottom: 4px; }
li ul, li ol { margin-top: 4px; margin-bottom: 6px; }
strong { font-weight: 600; }

h2[id], h3[id], h4[id] {
  scroll-margin-top: calc(var(--topbar-height) + 14px);
}

/* ---- Callouts --------------------------------------------- */
.callout {
  border-left: 4px solid var(--color-note-border);
  background: var(--color-note-bg);
  padding: 11px 15px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 16px 0;
  font-size: 0.9rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout__label {
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.callout--note  { border-color: var(--color-note-border);  background: var(--color-note-bg); }
.callout--note  .callout__label { color: var(--color-note-border); }
.callout--warn  { border-color: var(--color-warn-border);  background: var(--color-warn-bg); }
.callout--warn  .callout__label { color: #b07700; }
.callout--tip   { border-color: var(--color-tip-border);   background: var(--color-tip-bg); }
.callout--tip   .callout__label { color: var(--color-accent-dark); }
.callout--important { border-color: #e53e3e; background: #fff5f5; }
.callout--important .callout__label { color: #c53030; }

/* ---- Code ------------------------------------------------- */
pre {
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 14px 18px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.835rem;
  line-height: 1.6;
  margin: 14px 0;
}
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: #eef1f5;
  padding: 1px 5px;
  border-radius: 3px;
  color: #24292e;
}
pre code { background: none; padding: 0; color: inherit; font-size: inherit; }

/* ---- Tables ----------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: #f0f2f5; }
th {
  text-align: left;
  padding: 9px 11px;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
td {
  padding: 8px 11px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
tr:hover td { background: #f8f9fa; }

/* ---- FAQ accordion ---------------------------------------- */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}
.faq-item__trigger {
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: none;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
  transition: background .12s;
}
.faq-item__trigger:hover { background: #edf0f3; }
.faq-item__trigger.open { background: #e8f4fd; }

.faq-item__left { display: flex; align-items: center; gap: 10px; }
.faq-item__id {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-accent-dark);
  background: rgba(101,166,55,.12);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}
.faq-item__chevron {
  flex-shrink: 0;
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform .2s;
  opacity: .5;
}
.faq-item__trigger.open .faq-item__chevron { transform: rotate(180deg); opacity: 1; }

.faq-item__body {
  display: none;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.faq-item__body.open { display: block; }
.faq-item__body p:last-child,
.faq-item__body ul:last-child { margin-bottom: 0; }

/* ---- Check cards ------------------------------------------ */
.check-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.check-filter-btn {
  font-size: 0.78rem;
  font-family: var(--font-body);
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all .12s;
}
.check-filter-btn:hover, .check-filter-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.check-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  overflow: hidden;
}
.check-card__trigger {
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: none;
  padding: 9px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--color-text);
  transition: background .12s;
}
.check-card__trigger:hover { background: #edf0f3; }
.check-card__trigger.open { background: var(--color-tip-bg); }

.check-card__num {
  font-size: 0.72rem;
  font-weight: 700;
  color: #999;
  flex-shrink: 0;
  width: 22px;
  text-align: right;
}
.check-card__id {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-accent-dark);
  background: rgba(101,166,55,.1);
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 72px;
}
.check-card__title { flex: 1; font-weight: 500; }
.check-card__cat {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  background: #eee;
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.check-card__chevron {
  flex-shrink: 0;
  width: 14px; height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform .18s;
  opacity: .4;
}
.check-card__trigger.open .check-card__chevron { transform: rotate(180deg); opacity: .8; }
.check-card__body {
  display: none;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--color-border);
  font-size: 0.875rem;
  background: #fff;
}
.check-card__body.open { display: block; }
.check-card__body p:last-child { margin-bottom: 0; }

/* ---- Search bar ------------------------------------------- */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}
.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--color-border);
  border-radius: 20px;
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  background: var(--color-surface);
  transition: border-color .15s, background .15s;
}
.search-bar input:focus { border-color: var(--color-accent); background: #fff; }
.search-bar svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  stroke: #999; fill: none; stroke-width: 2;
  pointer-events: none;
}

/* ---- On-page TOC ------------------------------------------ */
.toc-sidebar {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 40px 16px 40px 4px;
  position: sticky;
  top: var(--topbar-height);
  align-self: flex-start;
  max-height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}
.toc-sidebar__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}
.toc-sidebar__list {
  list-style: none;
  padding: 0;
  border-left: 2px solid var(--color-border);
}
.toc-sidebar__list li { margin: 0; }
.toc-link {
  display: block;
  padding: 4px 0 4px 12px;
  font-size: 0.79rem;
  color: var(--color-text-muted);
  border-left: 2px solid transparent;
  margin-left: -2px;
  transition: color .12s, border-color .12s;
  line-height: 1.4;
}
.toc-link:hover { color: var(--color-link); text-decoration: none; }
.toc-link.active { color: var(--color-accent-dark); border-left-color: var(--color-accent); font-weight: 500; }
.toc-link--sub { padding-left: 20px; font-size: 0.75rem; }

/* ---- Page nav --------------------------------------------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}
.page-nav__btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  min-width: 150px;
  transition: border-color .15s, background .15s;
  text-decoration: none;
}
.page-nav__btn:hover { border-color: var(--color-accent); background: var(--color-tip-bg); text-decoration: none; }
.page-nav__btn--next { text-align: right; margin-left: auto; }
.page-nav__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}
.page-nav__title { font-size: 0.86rem; font-weight: 600; color: var(--color-link); }

/* ---- Appendix items --------------------------------------- */
.appendix-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}
.appendix-item__trigger {
  width: 100%;
  text-align: left;
  background: var(--color-surface);
  border: none;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-text);
  transition: background .12s;
}
.appendix-item__trigger:hover { background: #edf0f3; }
.appendix-item__trigger.open { background: #e8f4fd; }
.appendix-item__chevron {
  flex-shrink: 0;
  width: 16px; height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  transition: transform .2s;
  opacity: .4;
}
.appendix-item__trigger.open .appendix-item__chevron { transform: rotate(180deg); opacity: 1; }
.appendix-item__body {
  display: none;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--color-border);
  font-size: 0.9rem;
}
.appendix-item__body.open { display: block; }
.appendix-item__body p:last-child { margin-bottom: 0; }

/* ---- Footer ----------------------------------------------- */
.footer {
  background: #1a1a1a;
  color: #777;
  text-align: center;
  padding: 18px 24px;
  font-size: 0.78rem;
}
.footer a { color: #999; }
.footer a:hover { color: #ddd; }

/* ---- Responsive ------------------------------------------- */
@media (max-width: 1100px) {
  .toc-sidebar { display: none; }
}

@media (max-width: 768px) {
  .hamburger { display: block; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.4); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
  }
  .sidebar-overlay.open { display: block; }
  .main { margin-left: 0; }
  .content-wrap { padding: 22px 18px 60px; }
  .topbar__doc { display: none; }
  .page-nav { flex-direction: column; }
  .page-nav__btn--next { text-align: left; margin-left: 0; }
}
