/* ============================================================
   LegalsOne Developer Docs — Stylesheet
   ============================================================ */

/* === CUSTOM PROPERTIES === */
:root {
  /* Brand */
  --blue:       #072f56;
  --blue-dark:  #051e38;
  --blue-mid:   #0d4a80;
  --gold:       #e6ae4b;
  --gold-light: #f5d280;
  --ink:        #0a1f33;
  --white:      #ffffff;
  --mist:       #f6f7f9;

  /* Sidebar */
  --sidebar-bg:       #0d1520;
  --sidebar-border:   rgba(255,255,255,0.07);
  --sidebar-text:     #a8b8cb;
  --sidebar-heading:  #4e6a82;
  --sidebar-active:   #e6ae4b;
  --sidebar-hover:    rgba(255,255,255,0.06);
  --sidebar-width:    268px;

  /* Header */
  --header-height: 58px;
  --header-bg:     rgba(255,255,255,0.96);
  --header-border: rgba(7,47,86,0.1);

  /* Content */
  --content-max:  800px;
  --text-primary: #0a1f33;
  --text-muted:   #5a6a7a;
  --border:       #e2e8f0;

  /* Code */
  --code-bg:      #1a2332;
  --code-inline-bg: #edf1f7;
  --code-inline-color: #2d5986;

  /* Methods */
  --get:     #16a34a;
  --post:    #2563eb;
  --put:     #d97706;
  --patch:   #7c3aed;
  --delete:  #dc2626;

  /* Status */
  --success: #15803d;
  --warning: #b45309;
  --danger:  #b91c1c;
  --info:    #1d4ed8;

  /* Misc */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --transition: 150ms ease;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--mist);
}

img { display: block; max-width: 100%; }
a { color: var(--blue-mid); text-decoration: none; }
a:hover { color: var(--blue); text-decoration: underline; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0 0 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.875em;
  background: var(--code-inline-bg);
  color: var(--code-inline-color);
  padding: 0.15em 0.45em;
  border-radius: var(--radius-sm);
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

/* === HEADER === */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--header-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--blue);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-toggle:hover { background: var(--mist); }

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.header-logo img {
  height: 34px;
  width: auto;
}

.logo-divider {
  width: 1px;
  height: 20px;
  background: rgba(7,47,86,0.2);
}

.logo-badge {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.api-version-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: rgba(7,47,86,0.08);
  color: var(--blue);
  padding: 3px 8px;
  border-radius: 100px;
}

.header-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.header-link:hover { color: var(--blue); text-decoration: none; }

.header-cta {
  font-size: 0.875rem;
  font-weight: 700;
  background: var(--blue);
  color: var(--white);
  padding: 7px 18px;
  border-radius: 100px;
  text-decoration: none;
  transition: background var(--transition);
}
.header-cta:hover { background: var(--blue-mid); text-decoration: none; color: var(--white); }

/* === LAYOUT === */
.docs-layout {
  display: flex;
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-inner {
  padding: 16px 0 40px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
  backdrop-filter: blur(2px);
}

/* === SEARCH === */
.search-wrap {
  position: relative;
  margin: 0 12px 16px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sidebar-heading);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: #d0dbe8;
  font-size: 0.875rem;
  font-family: inherit;
  padding: 8px 12px 8px 34px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-input::placeholder { color: var(--sidebar-heading); }
.search-input:focus {
  border-color: rgba(230,174,75,0.4);
  background: rgba(255,255,255,0.08);
}

/* === SIDEBAR NAV === */
.sidebar-nav {
  padding: 0 0 8px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-heading);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}
.nav-section-header:hover { color: var(--sidebar-text); }

.nav-section-chevron {
  transition: transform var(--transition);
  opacity: 0.5;
}

.nav-section.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section-items {
  overflow: hidden;
}

.nav-section.collapsed .nav-section-items {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--sidebar-text);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
  text-decoration: none;
  user-select: none;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #d8e8f5;
  text-decoration: none;
}

.nav-item.active {
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
  background: rgba(230,174,75,0.08);
  font-weight: 600;
}

.nav-item-title { flex: 1; line-height: 1.3; }

/* hidden by search */
.nav-item.hidden { display: none; }
.nav-section.all-hidden .nav-section-header { display: none; }

/* === METHOD BADGES (sidebar) === */
.method-badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  line-height: 1.4;
  flex-shrink: 0;
  min-width: 42px;
  text-align: center;
}

.method-get    { background: rgba(22,163,74,0.18);  color: #4ade80; }
.method-post   { background: rgba(37,99,235,0.2);   color: #7ab4f8; }
.method-put    { background: rgba(217,119,6,0.2);   color: #fbbf24; }
.method-patch  { background: rgba(124,58,237,0.2);  color: #c4b5fd; }
.method-delete { background: rgba(220,38,38,0.2);   color: #f87171; }

/* === MAIN CONTENT === */
.docs-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.docs-content {
  flex: 1;
  max-width: calc(var(--content-max) + 80px);
  padding: 48px 40px;
  background: var(--white);
  min-height: calc(100vh - var(--header-height));
}

/* === LOADING STATE === */
.page-loading {
  display: flex;
  gap: 6px;
  padding: 48px 0;
  justify-content: center;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: blink 1.2s infinite ease-in-out;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* === CONTENT TYPOGRAPHY === */
.docs-content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 0.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 2.5rem 0 0.75rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.docs-content h2:first-of-type { margin-top: 1.5rem; }

.docs-content h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 1.75rem 0 0.5rem;
  letter-spacing: 0;
}

.page-intro {
  font-size: 1.0625rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 640px;
}

.page-header {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

/* === ENDPOINT BLOCK === */
.endpoint-block {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--sidebar-bg);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 0 0 2rem;
  overflow-x: auto;
}

.endpoint-method {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.endpoint-method.get    { background: rgba(22,163,74,0.2);  color: #4ade80; }
.endpoint-method.post   { background: rgba(37,99,235,0.22); color: #93c5fd; }
.endpoint-method.put    { background: rgba(217,119,6,0.22); color: #fcd34d; }
.endpoint-method.patch  { background: rgba(124,58,237,0.2); color: #c4b5fd; }
.endpoint-method.delete { background: rgba(220,38,38,0.2);  color: #fca5a5; }

.endpoint-path {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9375rem;
  color: #d0e8ff;
  white-space: nowrap;
}

/* === FIELD PARAMETER TABLE === */
.field-table-wrap {
  overflow-x: auto;
  margin: 0 0 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.field-table thead tr {
  background: var(--mist);
  border-bottom: 1px solid var(--border);
}

.field-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}

.field-table td {
  padding: 12px 14px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.field-table tr:last-child td { border-bottom: none; }

.field-table tr:hover td { background: #fafcff; }

.field-name {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
}

/* === INLINE BADGES === */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 100px;
  white-space: nowrap;
  line-height: 1.5;
}

.badge-required {
  background: rgba(185,28,28,0.1);
  color: var(--danger);
}

.badge-optional {
  background: rgba(90,106,122,0.1);
  color: var(--text-muted);
}

.badge-deprecated {
  background: rgba(180,83,9,0.1);
  color: var(--warning);
}

.type-badge {
  display: inline-block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--code-inline-color);
  background: var(--code-inline-bg);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  line-height: 1.5;
}

/* === CODE BLOCKS === */
.code-example {
  margin: 0 0 2rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: var(--shadow-sm);
}

.code-tabs {
  display: flex;
  gap: 2px;
  background: #141f2d;
  padding: 8px 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.code-tab {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b8399;
  padding: 6px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: color var(--transition), background var(--transition);
}

.code-tab:hover { color: #a8bdd0; }

.code-tab.active {
  color: #d0e8ff;
  background: var(--code-bg);
}

.code-pane { display: none; position: relative; }
.code-pane.active { display: block; }

.code-example pre[class*="language-"],
.code-block pre[class*="language-"],
pre.code-block {
  margin: 0 !important;
  border-radius: 0 !important;
  font-size: 0.875rem !important;
  background: var(--code-bg) !important;
  padding: 20px 20px !important;
}

.code-block {
  position: relative;
  margin: 0 0 2rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.04);
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: #8ba3ba;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  z-index: 2;
}

.copy-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #d0e8ff;
}

.copy-btn.copied {
  color: #4ade80;
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.08);
}

/* === RESPONSE BLOCK === */
.response-block {
  margin: 0 0 2rem;
}

.response-status-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
}

.status-2xx { background: rgba(21,128,61,0.12); color: var(--success); }
.status-4xx { background: rgba(185,28,28,0.1);  color: var(--danger); }
.status-5xx { background: rgba(185,28,28,0.1);  color: var(--danger); }

.status-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* === CALLOUT BLOCKS === */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin: 0 0 1.5rem;
  border-left: 3px solid;
  font-size: 0.9375rem;
}

.callout-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.callout-body { flex: 1; }

.callout strong {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.callout-info {
  background: rgba(29,78,216,0.06);
  border-color: var(--info);
  color: #1e3a70;
}

.callout-warning {
  background: rgba(180,83,9,0.06);
  border-color: var(--warning);
  color: #7a3f00;
}

.callout-danger {
  background: rgba(185,28,28,0.06);
  border-color: var(--danger);
  color: #7a1515;
}

.callout-tip {
  background: rgba(21,128,61,0.06);
  border-color: var(--success);
  color: #145028;
}

/* === PAGE NAVIGATION (prev / next) === */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex: 1;
  max-width: 260px;
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: inherit;
}

.page-nav-link:hover {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(13,74,128,0.08);
  text-decoration: none;
  color: inherit;
}

.page-nav-link.next { margin-left: auto; text-align: right; }

.page-nav-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.page-nav-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--blue-mid);
}

/* === FOOTER === */
.docs-footer {
  background: var(--mist);
  border-top: 1px solid var(--border);
  padding: 20px 40px;
  margin-left: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.docs-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}
.docs-footer a:hover { color: var(--blue); }

/* === BASE URL BLOCK === */
.base-url-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--mist);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin: 0 0 2rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9375rem;
  color: var(--ink);
  overflow-x: auto;
}

.base-url-label {
  font-family: "Source Sans 3", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* === SCOPE TABLE (for OAuth) === */
.scope-table-wrap {
  overflow-x: auto;
  margin: 0 0 2rem;
}

/* === ERROR CODE TABLE === */
.error-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--danger);
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 250ms ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .sidebar-overlay.open { display: block; }

  .docs-main { margin-left: 0; }

  .docs-content { padding: 32px 24px; }

  .docs-footer { padding: 20px 24px; }

  .header-right .header-link { display: none; }
}

@media (max-width: 600px) {
  .docs-content { padding: 24px 16px; }

  .docs-content h1 { font-size: 1.625rem; }

  .page-nav { flex-direction: column; }
  .page-nav-link { max-width: 100%; }
  .page-nav-link.next { margin-left: 0; text-align: left; }

  .endpoint-block { padding: 12px 14px; }

  .header-right .api-version-badge { display: none; }
}
