/* =============================================================
   YSUITE Docs — docs.css
   3-column layout: sidebar | content | TOC
   Consistent with YSUITE brand colours + Inter font
   ============================================================= */

/* ─── CSS Custom Properties ─────────────────────────────────── */
:root {
  --docs-sidebar-width:    260px;
  --docs-toc-width:        220px;
  --docs-navbar-height:    56px;
  --docs-content-max:      760px;

  /* Brand */
  --docs-blue:             #2563eb;
  --docs-blue-light:       #eff6ff;
  --docs-blue-mid:         #bfdbfe;

  /* Text */
  --docs-text:             #111827;
  --docs-text-muted:       #6b7280;
  --docs-text-subtle:      #9ca3af;

  /* Surfaces */
  --docs-bg:               #ffffff;
  --docs-surface:          #f9fafb;
  --docs-border:           #e5e7eb;
  --docs-border-hover:     #d1d5db;

  /* Code */
  --docs-code-bg:          #f3f4f6;
  --docs-code-border:      #e5e7eb;
  --docs-code-block-bg:    #1e1e2e;
  --docs-code-block-text:  #cdd6f4;

  /* Nav active */
  --docs-nav-active-bg:    var(--docs-blue-light);
  --docs-nav-active-text:  var(--docs-blue);

  /* Badges */
  --badge-new:             #059669;
  --badge-beta:            #7c3aed;
  --badge-updated:         #d97706;
  --badge-deprecated:      #dc2626;
  --badge-interactive:     #0891b2;
}

/* ─── Reset / Base ──────────────────────────────────────────── */
.docs-body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--docs-text);
  background: var(--docs-bg);
  -webkit-font-smoothing: antialiased;
}

/* ─── Navbar ────────────────────────────────────────────────── */
.docs-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--docs-navbar-height);
  background: var(--docs-bg);
  border-bottom: 1px solid var(--docs-border);
  display: flex;
  align-items: center;
}

.docs-navbar__inner {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.docs-navbar__logo img {
  display: block;
}

.docs-navbar__divider {
  color: var(--docs-border);
  font-size: 20px;
  font-weight: 300;
  flex-shrink: 0;
}

.docs-navbar__sections {
  display: flex;
  gap: 4px;
}

.docs-navbar__section {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--docs-text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.docs-navbar__section:hover {
  background: var(--docs-surface);
  color: var(--docs-text);
}

.docs-navbar__section--active {
  background: var(--docs-blue-light);
  color: var(--docs-blue);
}

.docs-navbar__spacer { flex: 1; }

.docs-navbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  background: var(--docs-surface);
  color: var(--docs-text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 200px;
  text-align: left;
}

.docs-navbar__search:hover {
  border-color: var(--docs-blue);
  box-shadow: 0 0 0 3px var(--docs-blue-light);
}

.docs-navbar__search-label { flex: 1; }

.docs-navbar__kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  background: var(--docs-bg);
  border: 1px solid var(--docs-border);
  border-radius: 4px;
  font-size: 11px;
  color: var(--docs-text-subtle);
}

.docs-navbar__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--docs-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.docs-navbar__cta:hover { background: #1d4ed8; }

.docs-navbar__menu-btn {
  display: none;
  padding: 6px;
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: var(--docs-text);
  flex-shrink: 0;
}

/* ─── Layout ────────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar-width) 1fr var(--docs-toc-width);
  grid-template-areas: "sidebar content toc";
  min-height: calc(100vh - var(--docs-navbar-height));
  max-width: 1600px;
  margin: 0 auto;
}

/* Swagger layout — no TOC */
.docs-layout--swagger {
  grid-template-columns: var(--docs-sidebar-width) 1fr;
  grid-template-areas: "sidebar content";
}

/* ─── Sidebar ───────────────────────────────────────────────── */
.docs-sidebar {
  grid-area: sidebar;
  position: sticky;
  top: var(--docs-navbar-height);
  height: calc(100vh - var(--docs-navbar-height));
  overflow-y: auto;
  border-right: 1px solid var(--docs-border);
  background: var(--docs-bg);
  flex-shrink: 0;
}

.docs-sidebar-inner {
  padding: 24px 0 48px;
}

/* Sidebar nav */
.docs-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-nav__group {
  margin-bottom: 4px;
}

.docs-nav__group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 20px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--docs-text-muted);
  font-family: inherit;
  transition: color 0.15s;
}

.docs-nav__group-toggle:hover { color: var(--docs-text); }

.docs-nav__chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}

.docs-nav__group--open .docs-nav__chevron {
  transform: rotate(180deg);
}

.docs-nav__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}

.docs-nav__items--open { display: block; }

.docs-nav__item a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 20px 6px 24px;
  font-size: 13.5px;
  color: var(--docs-text-muted);
  text-decoration: none;
  border-right: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.docs-nav__item a:hover {
  color: var(--docs-text);
  background: var(--docs-surface);
}

.docs-nav__item--active a {
  color: var(--docs-nav-active-text);
  background: var(--docs-nav-active-bg);
  border-right-color: var(--docs-blue);
  font-weight: 500;
}

/* Sidebar badges */
.docs-nav__badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.4;
  color: #fff;
  background: var(--docs-text-subtle);
  margin-left: auto;
  flex-shrink: 0;
}

.docs-nav__badge--new         { background: var(--badge-new); }
.docs-nav__badge--beta        { background: var(--badge-beta); }
.docs-nav__badge--updated     { background: var(--badge-updated); }
.docs-nav__badge--deprecated  { background: var(--badge-deprecated); }
.docs-nav__badge--interactive { background: var(--badge-interactive); }

/* ─── Content ───────────────────────────────────────────────── */
.docs-content {
  grid-area: content;
  min-width: 0;
  padding: 40px 48px 80px;
}

.docs-content--swagger {
  padding: 0;
}

/* ─── Article Typography ────────────────────────────────────── */
.docs-article {
  max-width: var(--docs-content-max);
}

.docs-article h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 16px;
  color: var(--docs-text);
}

.docs-article h2 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin: 40px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--docs-border);
  color: var(--docs-text);
}

.docs-article h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 28px 0 8px;
  color: var(--docs-text);
}

.docs-article h2:first-child,
.docs-article h3:first-child { border-top: none; }

.docs-article p {
  margin: 0 0 16px;
  color: var(--docs-text);
}

.docs-article a {
  color: var(--docs-blue);
  text-decoration: none;
  border-bottom: 1px solid var(--docs-blue-mid);
  transition: border-color 0.15s;
}

.docs-article a:hover { border-bottom-color: var(--docs-blue); }

.docs-article ul,
.docs-article ol {
  margin: 0 0 16px 20px;
  padding: 0;
}

.docs-article li { margin-bottom: 6px; }

.docs-article blockquote {
  margin: 20px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--docs-blue);
  background: var(--docs-blue-light);
  border-radius: 0 6px 6px 0;
  color: var(--docs-text-muted);
}

.docs-article blockquote p { margin: 0; }

/* Inline code */
.docs-article code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.875em;
  background: var(--docs-code-bg);
  border: 1px solid var(--docs-code-border);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--docs-text);
}

/* Code block */
.docs-article pre {
  background: var(--docs-code-block-bg);
  border-radius: 8px;
  padding: 20px 24px;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid rgba(255,255,255,0.06);
}

.docs-article pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--docs-code-block-text);
  font-size: 13px;
  line-height: 1.6;
}

/* Tables */
.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
}

.docs-article thead th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--docs-border);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--docs-text-muted);
}

.docs-article tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--docs-border);
  vertical-align: top;
}

.docs-article tbody tr:last-child td { border-bottom: none; }
.docs-article tbody tr:hover td { background: var(--docs-surface); }

/* ─── Breadcrumbs ───────────────────────────────────────────── */
.docs-breadcrumbs {
  margin-bottom: 24px;
}

.docs-breadcrumbs ol {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12.5px;
  color: var(--docs-text-subtle);
}

.docs-breadcrumbs li + li::before {
  content: "/";
  color: var(--docs-border-hover);
}

.docs-breadcrumbs a {
  color: var(--docs-text-muted);
  text-decoration: none;
}

.docs-breadcrumbs a:hover { color: var(--docs-text); }

/* ─── TOC ───────────────────────────────────────────────────── */
.docs-toc {
  grid-area: toc;
  position: sticky;
  top: calc(var(--docs-navbar-height) + 40px);
  height: fit-content;
  max-height: calc(100vh - var(--docs-navbar-height) - 80px);
  overflow-y: auto;
  padding: 40px 20px 40px 24px;
  border-left: 1px solid var(--docs-border);
}

.docs-toc-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--docs-text-muted);
  margin: 0 0 12px;
}

.docs-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-toc__item {
  margin-bottom: 4px;
}

.docs-toc__item--sub {
  padding-left: 12px;
}

.docs-toc__link {
  display: block;
  font-size: 12.5px;
  color: var(--docs-text-muted);
  text-decoration: none;
  padding: 2px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  margin-left: -8px;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.4;
}

.docs-toc__link:hover { color: var(--docs-text); }

.docs-toc__link--active {
  color: var(--docs-blue);
  border-left-color: var(--docs-blue);
  font-weight: 500;
}

/* ─── Prev / Next ───────────────────────────────────────────── */
.docs-prevnext {
  display: flex;
  gap: 16px;
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--docs-border);
  max-width: var(--docs-content-max);
}

.docs-prevnext__prev,
.docs-prevnext__next {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  padding: 16px 20px;
  border: 1px solid var(--docs-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--docs-text);
}

.docs-prevnext__next { align-items: flex-end; }

.docs-prevnext__prev:hover,
.docs-prevnext__next:hover {
  border-color: var(--docs-blue);
  box-shadow: 0 0 0 3px var(--docs-blue-light);
}

.docs-prevnext__dir {
  font-size: 12px;
  color: var(--docs-text-subtle);
}

.docs-prevnext__title {
  font-size: 14px;
  font-weight: 500;
  color: var(--docs-blue);
}

/* ─── Sidebar Backdrop (mobile) ─────────────────────────────── */
.docs-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 89;
}

/* ─── Search Modal ──────────────────────────────────────────── */
.docs-search-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.docs-search-modal[open],
.docs-search-modal:not([hidden]) {
  display: block;
}

.docs-search-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
}

.docs-search-modal__panel {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  background: var(--docs-bg);
  border: 1px solid var(--docs-border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  overflow: hidden;
}

.docs-search-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--docs-border);
  color: var(--docs-text-muted);
}

.docs-search-modal__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--docs-text);
  background: transparent;
}

.docs-search-modal__esc {
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--docs-border);
  border-radius: 4px;
  color: var(--docs-text-subtle);
  flex-shrink: 0;
}

.docs-search-modal__results {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  max-height: 400px;
  overflow-y: auto;
}

.docs-search-modal__results li a {
  display: block;
  padding: 10px 20px;
  text-decoration: none;
  color: var(--docs-text);
  transition: background 0.1s;
}

.docs-search-modal__results li a:hover,
.docs-search-modal__results li.is-active a {
  background: var(--docs-blue-light);
}

.docs-search-modal__results .result-title {
  font-size: 14px;
  font-weight: 500;
}

.docs-search-modal__results .result-desc {
  font-size: 12px;
  color: var(--docs-text-muted);
  margin-top: 2px;
}

.docs-search-modal__empty {
  padding: 24px 20px;
  text-align: center;
  color: var(--docs-text-muted);
  font-size: 14px;
}

/* ─── 404 ───────────────────────────────────────────────────── */
.docs-404 h1 { font-size: 24px; }

/* ─── Swagger overrides inside docs layout ──────────────────── */
.docs-body--swagger .swagger-ui .topbar { display: none; }
.docs-body--swagger .swagger-ui { font-family: inherit; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .docs-layout {
    grid-template-columns: var(--docs-sidebar-width) 1fr;
    grid-template-areas: "sidebar content";
  }
  .docs-toc { display: none; }
}

@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
    grid-template-areas: "content";
  }

  .docs-navbar__search { min-width: 40px; }
  .docs-navbar__search-label,
  .docs-navbar__kbd { display: none; }
  .docs-navbar__menu-btn { display: flex; align-items: center; }

  .docs-sidebar {
    position: fixed;
    top: var(--docs-navbar-height);
    left: -280px;
    width: 260px;
    height: calc(100vh - var(--docs-navbar-height));
    z-index: 90;
    border-right: 1px solid var(--docs-border);
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    transition: left 0.25s ease;
  }

  .docs-sidebar--open { left: 0; }
  .docs-sidebar-backdrop { display: block; }

  .docs-content { padding: 24px 20px 60px; }

  .docs-prevnext { flex-direction: column; }

  .docs-search-modal__panel {
    top: 60px;
    left: 16px;
    right: 16px;
    width: auto;
    transform: none;
  }
}
