/* ============================================================
   SSM Session Client – Documentation Site
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #a5b4fc;
  --accent:        #818cf8;
  --dark:          #1e293b;
  --dark-deeper:   #0f172a;
  --bg:            #ffffff;
  --bg-alt:        #f8fafc;
  --sidebar-bg:    #f8fafc;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --link:          #4f46e5;
  --header-h:      58px;
  --sidebar-w:     272px;
  --code-bg:       #1e293b;
  --code-text:     #e2e8f0;
  --radius:        8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow-md:     0 4px 16px rgba(0,0,0,.10);
  --content-max:   820px;
}

/* ── Base ─────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin-bottom: 1rem; }
ul, ol { margin: .5rem 0 1rem 1.5rem; }
li { margin-bottom: .25rem; }
strong { font-weight: 600; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.2rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none !important;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background .2s, border-color .2s, color .2s, transform .1s;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn-outline-light:hover { border-color: #fff; background: rgba(255,255,255,.1); }

.btn-outline-dark { background: transparent; color: var(--dark); border-color: var(--dark); }
.btn-outline-dark:hover { background: var(--dark); color: #fff; }

.btn-lg { padding: .65rem 1.6rem; font-size: 1rem; }

/* ── Header ───────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--dark);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none !important;
  flex: 1;
  min-width: 0;
}

.header-brand svg { flex-shrink: 0; }

.brand-accent { color: var(--primary-light); }

.header-nav {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: .25rem .5rem;
  line-height: 1;
}

/* ── Page Layout ──────────────────────────────────────────── */
.page-layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  z-index: 100;
  transition: transform .25s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }

.sidebar-nav > ul > li { margin-bottom: .1rem; }

.sidebar-label {
  display: block;
  padding: .6rem 1.5rem .2rem;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-top: .75rem;
}

.sidebar-nav a {
  display: block;
  padding: .35rem 1.5rem;
  font-size: .88rem;
  color: var(--text);
  text-decoration: none !important;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  line-height: 1.4;
}

.sidebar-nav a:hover { color: var(--primary); background: rgba(99,102,241,.06); }

.sidebar-nav a.active {
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
  background: rgba(99,102,241,.08);
}

/* Nested nav items */
.sidebar-nav ul ul { margin: 0; }
.sidebar-nav ul ul a {
  padding-left: 2.75rem;
  font-size: .83rem;
  color: var(--text-muted);
}
.sidebar-nav ul ul a:hover,
.sidebar-nav ul ul a.active { color: var(--primary); background: rgba(99,102,241,.06); border-left-color: transparent; }

/* ── Main Content ─────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2.5rem 3.5rem 4rem;
  min-width: 0;
  max-width: calc(var(--sidebar-w) + var(--content-max) + 7rem);
}

section { margin-bottom: 4rem; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  padding: 2.5rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--dark);
  margin-bottom: .75rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 620px;
  margin-bottom: 1.75rem;
  line-height: 1.65;
}

.hero-ctas { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── Feature Grid ─────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 2.5rem;
}

.feature-card {
  padding: 1.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: box-shadow .2s, border-color .2s;
}

.feature-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary-light); }

.feature-icon { font-size: 1.9rem; margin-bottom: .6rem; }

.feature-card h3 { font-size: .95rem; font-weight: 700; margin-bottom: .35rem; }

.feature-card p { font-size: .875rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 0; }

/* ── Headings ─────────────────────────────────────────────── */
h1 {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-top: .5rem;
}

h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--dark);
  margin: 2.5rem 0 .9rem;
  padding-bottom: .45rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark);
  margin: 1.75rem 0 .6rem;
}

h4 { font-size: .95rem; font-weight: 600; margin: 1.25rem 0 .4rem; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 2rem; border: 1px solid var(--border); border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }

th {
  background: var(--bg-alt);
  font-weight: 600;
  text-align: left;
  padding: .6rem .9rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

td {
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: var(--bg-alt); }
tr:nth-child(even):last-child td { border-bottom: none; }

td code { white-space: nowrap; }

/* check / cross */
.yes { color: #16a34a; font-weight: 700; }
.no  { color: #dc2626; }

/* ── Inline Code ──────────────────────────────────────────── */
code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: .85em;
  background: var(--bg-alt);
  padding: .15em .4em;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text);
}

/* ── Code Blocks ──────────────────────────────────────────── */
pre {
  position: relative;
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0 1.5rem;
}

pre code {
  display: block;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  background: none;
  border: none;
  color: var(--code-text);
  font-size: .875rem;
  line-height: 1.75;
}

.copy-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.65);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 4px;
  padding: .2rem .6rem;
  font-size: .75rem;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.copy-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.copy-btn.copied { color: #6ee7b7; border-color: rgba(110,231,183,.4); }

/* ── Callouts ─────────────────────────────────────────────── */
.callout {
  padding: .9rem 1.1rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin: 1.25rem 0 1.75rem;
  font-size: .9rem;
  line-height: 1.6;
}

.callout p:last-child { margin-bottom: 0; }

.callout-info    { background: #eef2ff; border-color: var(--primary); color: #312e81; }
.callout-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.callout-tip     { background: #f0fdf4; border-color: #22c55e; color: #14532d; }

.callout strong { font-weight: 700; }
.callout code { background: rgba(0,0,0,.07); border-color: rgba(0,0,0,.1); }

/* ── Tabs ─────────────────────────────────────────────────── */
.tab-group-wrapper { margin: 1.25rem 0; }

.tab-group {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 0;
}

.tab-btn {
  padding: .45rem 1rem;
  font-size: .875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
  border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Steps ────────────────────────────────────────────────── */
ol.steps {
  counter-reset: step-counter;
  list-style: none;
  margin: 1rem 0 1.5rem;
  padding: 0;
}

ol.steps li {
  counter-increment: step-counter;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

ol.steps li::before {
  content: counter(step-counter);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: .1rem;
}

ol.steps li > .step-body { flex: 1; min-width: 0; }
ol.steps li > .step-body p:last-child { margin-bottom: 0; }

/* ── Log Path Table ───────────────────────────────────────── */
.log-path { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: .85em; }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  background: var(--dark);
  color: rgba(255,255,255,.65);
  text-align: center;
  padding: 2rem 1.5rem;
  margin-left: var(--sidebar-w);
  font-size: .85rem;
  line-height: 1.8;
}

footer a { color: var(--primary-light); }

/* ── Responsive ───────────────────────────────────────────── */

/* Large screens – widen content area */
@media (min-width: 1440px) {
  :root { --content-max: 900px; }
  .content { padding: 2.5rem 4.5rem 4rem; }
}

/* Medium screens – reduce padding */
@media (max-width: 1100px) {
  .content { padding: 2rem 2.5rem 3rem; }
}

@media (max-width: 900px) {
  .content { padding: 2rem 2rem 3rem; }
  .feature-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* Tablet and below – collapse sidebar */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: min(272px, 85vw);
    box-shadow: var(--shadow-md);
  }

  .sidebar.open { transform: translateX(0); }

  .content {
    margin-left: 0;
    padding: 1.5rem 1.25rem 3rem;
    max-width: 100%;
  }

  footer { margin-left: 0; }

  .menu-btn { display: block; }

  .header-nav .btn-outline-light { display: none; }

  .hero h1 { font-size: 1.75rem; }
  .hero-subtitle { font-size: 1.05rem; }

  .feature-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }

  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }

  /* Better table readability on tablets */
  table { font-size: .82rem; }
  th, td { padding: .45rem .65rem; }

  /* Callout padding */
  .callout { padding: .75rem 1rem; }
}

/* Small phones */
@media (max-width: 500px) {
  .header { padding: 0 1rem; }

  .content { padding: 1.25rem 1rem 2.5rem; }

  .feature-grid { grid-template-columns: 1fr; gap: .75rem; }
  .feature-card { padding: 1.1rem; }

  .hero { padding: 1.5rem 0; margin-bottom: 2rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero-subtitle { font-size: 1rem; }
  .hero-ctas { flex-direction: column; }
  .hero-ctas .btn { justify-content: center; }

  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.15rem; }
  h3 { font-size: 1rem; }

  pre code { padding: .9rem 1rem; font-size: .8rem; }

  ol.steps li { gap: .75rem; }
  ol.steps li::before { min-width: 1.75rem; height: 1.75rem; font-size: .8rem; }

  /* Stack table cells on very small screens */
  .config-table thead { display: none; }
  .config-table tr {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: .5rem 0;
  }
  .config-table td {
    display: block;
    border-bottom: none;
    padding: .2rem .65rem;
    text-align: left;
  }
  .config-table td:first-child { font-weight: 600; padding-top: .5rem; }
  .config-table td:last-child { padding-bottom: .5rem; }
  .config-table tr:nth-child(even) td { background: none; }
}

/* ── Overlay (mobile sidebar) ─────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ── Version Badge ────────────────────────────────────────── */
#versionBadge {
  font-size: .8em;
  font-weight: 700;
  opacity: .85;
}

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

.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
