/*
 * sshs3 Enterprise Documentation Portal Stylesheet
 * Harmonized with sshs3.com design DNA & Pointsharp Antora layout
 */

:root {
  /* Default: Dark Slate Theme (aligned with sshs3.com) */
  --bg-app: #0b0f19;
  --bg-page: #0b0f19;
  --bg-surface: #111726;
  --bg-surface-subtle: #161e31;
  --bg-subtle: #161e31;
  --bg-card: #141b2d;
  --bg-code: #070a10;
  --bg-toolbar: #111726;
  --bg-sidebar: #0e1320;

  --border-subtle: #1e283d;
  --border-strong: #2e3c59;
  --border-active: #38bdf8;

  --text-main: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #7c8aa0;
  --text-inverse: #0f172a;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-text: #38bdf8;
  --accent-subtle: rgba(2, 132, 199, 0.15);
  --brand: #eab308;

  --ps-blue-primary: #0b1329;
  --ps-blue-hover: #111d3e;
  --ps-accent-blue: #38bdf8;
  --ps-accent-subtle: rgba(56, 189, 248, 0.12);
  --ps-brand-gold: #eab308;
  --ps-brand-gold-hover: #ca8a04;

  --admon-note: #0284c7;
  --admon-tip: #16a34a;
  --admon-important: #eab308;
  --admon-warning: #ea580c;
  --admon-caution: #dc2626;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --sidebar-w: 290px;
  --toc-w: 240px;
  --header-h: 56px;
  --toolbar-h: 46px;
}

[data-theme="light"] {
  --bg-app: #f1f5f9;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-subtle: #f1f5f9;
  --bg-subtle: #f1f5f9;
  --bg-card: #ffffff;
  --bg-code: #0f172a;
  --bg-toolbar: #ffffff;
  --bg-sidebar: #f8fafc;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-active: #0076d6;

  --text-main: #1e293b;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-text: #0369a1;
  --accent-subtle: rgba(2, 132, 199, 0.12);
  --brand: #ca8a04;

  --ps-blue-primary: #002d5b;
  --ps-blue-hover: #001f3f;
  --ps-accent-blue: #0076d6;
  --ps-accent-subtle: #eaf3fb;
  --ps-brand-gold: #ca8a04;
  --ps-brand-gold-hover: #a16207;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg-app);
  color: var(--text-primary);
  font: 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre { font-family: var(--font-mono); }

/* --- Top Header (Frosted Glass matching sshs3.com) --- */
header.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg-app) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-brand a {
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.header-brand a:hover { text-decoration: none; }
.header-brand svg { width: 28px; height: 20px; }
.header-brand .docs-tag {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.header-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-version {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.header-link {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s;
}
.header-link:hover { color: var(--text-primary); text-decoration: none; }
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: border-color 0.15s;
}
.theme-toggle-btn:hover { border-color: var(--accent); }

/* --- Secondary Toolbar (Pointsharp / Antora with blur) --- */
.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  height: var(--toolbar-h);
  background: color-mix(in srgb, var(--bg-surface) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}
.nav-toggle-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
}
.nav-toggle-btn:hover { background: var(--bg-subtle); color: var(--text-main); }
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--ps-accent-blue); text-decoration: none; }
.breadcrumbs .sep { color: var(--border-strong); }
.breadcrumbs .current { color: var(--text-main); font-weight: 600; }

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 5px 32px 5px 10px;
  font-size: 13px;
  color: var(--text-main);
  width: 220px;
  transition: all 0.15s;
}
.search-input:focus {
  outline: none;
  border-color: var(--border-active);
  background: var(--bg-surface);
  box-shadow: 0 0 0 2px var(--ps-accent-subtle);
  width: 280px;
}
.search-kbd {
  position: absolute;
  right: 6px;
  font-size: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--text-muted);
  pointer-events: none;
}
.toolbar-feedback {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.toolbar-feedback:hover { color: var(--ps-accent-blue); }

/* --- Main Layout Wrapper --- */
.layout-body {
  display: flex;
  min-height: calc(100vh - var(--header-h) - var(--toolbar-h));
}

/* --- Left Nav Sidebar --- */
aside.nav-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  height: calc(100vh - var(--header-h) - var(--toolbar-h));
  position: sticky;
  top: calc(var(--header-h) + var(--toolbar-h));
  overflow-y: auto;
  padding: 16px 8px 32px 16px;
}
.nav-menu {
  list-style: none;
}
.nav-component-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 8px 8px 4px 8px;
  margin-top: 12px;
}
.nav-component-title:first-child { margin-top: 0; }
.nav-item {
  list-style: none;
  margin: 1px 0;
}
.nav-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
}
.nav-item-header:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}
.nav-item.is-active > .nav-item-header {
  background: var(--ps-accent-subtle);
  color: var(--ps-accent-blue);
  font-weight: 600;
}
.nav-item-toggle {
  display: inline-block;
  width: 16px;
  height: 16px;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}
.nav-item.is-expanded > .nav-item-header .nav-item-toggle {
  transform: rotate(90deg);
}
.nav-children {
  list-style: none;
  padding-left: 12px;
  margin-left: 8px;
  border-left: 1px solid var(--border-subtle);
  display: none;
}
.nav-item.is-expanded > .nav-children {
  display: block;
}
.nav-link {
  display: block;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: 4px;
}
.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  text-decoration: none;
}
.nav-link.is-current {
  background: var(--ps-accent-subtle);
  color: var(--ps-accent-blue);
  font-weight: 600;
  border-left: 2px solid var(--ps-accent-blue);
  border-radius: 0 4px 4px 0;
}

/* --- Main Content Area --- */
main.article-container {
  flex: 1;
  min-width: 0;
  padding: 32px 48px 64px 48px;
  max-width: 980px;
}
article.doc {
  font-size: 15px;
}
article.doc h1.page-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
  color: var(--text-main);
}
.page-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-badge {
  background: var(--ps-accent-subtle);
  color: var(--ps-accent-blue);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
}
.preamble {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 28px;
  font-weight: 400;
}

/* Headings */
article.doc h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}
article.doc h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 10px 0;
  color: var(--text-main);
}
article.doc h4 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 18px 0 8px 0;
  color: var(--ps-accent-blue);
}
article.doc p {
  margin-bottom: 16px;
}
article.doc ul, article.doc ol {
  margin: 0 0 18px 24px;
}
article.doc li {
  margin-bottom: 6px;
}

/* --- Solution Cards (Pointsharp style) --- */
.card-section {
  margin: 28px 0;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.card-index {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-index:hover {
  border-color: var(--ps-accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  text-decoration: none;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.card-icon {
  font-size: 24px;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}
.card-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.card-tag.sysadmin { background: #e0f2fe; color: #0369a1; }
.card-tag.devops { background: #dcfce7; color: #15803d; }
.card-tag.dev { background: #fef3c7; color: #b45309; }

/* --- Admonitions / Callouts (Pointsharp Antora style) --- */
.admonitionblock {
  margin: 20px 0;
  border-radius: 6px;
  background: var(--bg-subtle);
  border-left: 4px solid var(--border-strong);
  overflow: hidden;
}
.admonitionblock.note { border-left-color: var(--admon-note); background: rgba(2, 132, 199, 0.06); }
.admonitionblock.tip { border-left-color: var(--admon-tip); background: rgba(22, 163, 74, 0.06); }
.admonitionblock.important { border-left-color: var(--admon-important); background: rgba(234, 179, 8, 0.08); }
.admonitionblock.warning { border-left-color: var(--admon-warning); background: rgba(234, 88, 12, 0.08); }
.admonitionblock.caution { border-left-color: var(--admon-caution); background: rgba(220, 38, 38, 0.08); }

.admonition-content {
  padding: 14px 18px;
}
.admonition-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admonitionblock.note .admonition-title { color: var(--admon-note); }
.admonitionblock.tip .admonition-title { color: var(--admon-tip); }
.admonitionblock.important .admonition-title { color: #b45309; }
.admonitionblock.warning .admonition-title { color: var(--admon-warning); }
.admonitionblock.caution .admonition-title { color: var(--admon-caution); }
.admonition-body {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.5;
}

/* --- Code Blocks & Multi-OS Tabs --- */
.code-block-wrapper {
  margin: 18px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-code);
  position: relative;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 6px 14px;
}
.code-lang {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.code-copy-btn {
  background: #334155;
  border: 1px solid #475569;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.code-copy-btn:hover {
  background: #475569;
  color: #ffffff;
}
.code-copy-btn.is-copied {
  background: #0284c7;
  color: #ffffff;
  border-color: #38bdf8;
}

.tab-container {
  margin: 18px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-code);
}
.tab-headers {
  display: flex;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  padding: 0 8px;
  overflow-x: auto;
}
.tab-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tab-btn:hover { color: #f8fafc; }
.tab-btn.is-active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.05);
}
.tab-panel {
  display: none;
}
.tab-panel.is-active {
  display: block;
}
.tab-panel .code-block-wrapper {
  margin: 0;
  border: none;
  border-radius: 0;
}

pre {
  background: var(--bg-code);
  color: #f8fafc;
  padding: 16px 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  margin: 0;
}
code {
  background: var(--bg-surface-subtle);
  color: var(--accent-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}
pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Document Images */
.doc-image-figure {
  margin: 24px 0;
  text-align: center;
}
.doc-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: inline-block;
  background: var(--bg-surface);
}
.doc-image-caption {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 8px;
  font-style: italic;
}

/* Tables */
table.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13.5px;
}
table.doc-table th, table.doc-table td {
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  text-align: left;
}
table.doc-table th {
  background: var(--bg-surface-subtle);
  font-weight: 600;
  color: var(--text-primary);
}
table.doc-table tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

/* --- Right "On this page" TOC --- */
aside.toc-sidebar {
  width: var(--toc-w);
  flex-shrink: 0;
  height: calc(100vh - var(--header-h) - var(--toolbar-h));
  position: sticky;
  top: calc(var(--header-h) + var(--toolbar-h));
  overflow-y: auto;
  padding: 32px 16px 32px 8px;
  font-size: 12.5px;
}
.toc-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.toc-list {
  list-style: none;
}
.toc-item {
  margin: 4px 0;
}
.toc-item.level-3 {
  padding-left: 10px;
}
.toc-link {
  color: var(--text-muted);
  display: block;
  line-height: 1.4;
  padding: 3px 6px;
  border-radius: 4px;
}
.toc-link:hover {
  color: var(--accent-text);
  text-decoration: none;
}
.toc-link.is-active {
  color: var(--accent-text);
  font-weight: 600;
  background: var(--accent-subtle);
}

/* --- Bottom Pagination --- */
nav.pagination {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pagination-link {
  display: flex;
  flex-direction: column;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: all 0.15s;
}
.pagination-link:hover {
  border-color: var(--accent);
  text-decoration: none;
  background: var(--bg-surface-subtle);
}
.pagination-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.pagination-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-text);
}

/* --- Search Modal (Ctrl+K) --- */
.search-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}
.search-modal-backdrop.is-open { display: flex; }
.search-modal {
  background: var(--bg-surface);
  width: 600px;
  max-width: 90vw;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.search-modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}
.search-modal-input {
  flex: 1;
  background: transparent;
  border: none;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
}
.search-modal-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}
.search-result-item {
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  display: block;
}
.search-result-item:hover, .search-result-item.is-selected {
  background: var(--accent-subtle);
  text-decoration: none;
}
.search-result-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
.search-result-snippet {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1080px) {
  aside.toc-sidebar { display: none; }
}
@media (max-width: 768px) {
  aside.nav-sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    z-index: 95;
    background: var(--bg-surface);
    transition: left 0.2s ease;
    box-shadow: 4px 0 12px rgba(0,0,0,0.15);
  }
  aside.nav-sidebar.is-open { left: 0; }
  main.article-container { padding: 20px 16px; }
  .toolbar-right { display: none; }
}

/* --- Mermaid Diagram Visualization --- */
.mermaid-diagram-card {
  margin: 24px 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.mermaid-diagram-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 16px;
}
.mermaid-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.mermaid-viewport {
  padding: 24px 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: auto;
  min-height: 120px;
  background: var(--bg-surface);
}
.mermaid {
  display: flex;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
}
.mermaid svg {
  max-width: 100%;
  height: auto;
}
