/* Tabbly API Docs — modern theme */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #007bff;
  --blue-600: #0069d9;
  --blue-700: #0056b3;

  --sidebar-width: 272px;
  --toc-width: 208px;
  --topbar-height: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --bg-sidebar: rgba(248, 250, 252, 0.92);
  --border: #e2e8f0;
  --border-subtle: #eef2f6;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --accent: #007bff;
  --accent-hover: #0056b3;
  --accent-subtle: rgba(0, 123, 255, 0.1);
  --accent-glow: rgba(0, 123, 255, 0.28);
  --code-bg: #0b1220;
  --code-text: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.1);
  --method-get-bg: #eff6ff;
  --method-get-text: #007bff;
  --method-post-bg: #dbeafe;
  --method-post-text: #0056b3;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #08080a;
  --bg-subtle: #0f0f12;
  --bg-muted: #18181c;
  --bg-sidebar: rgba(12, 12, 14, 0.94);
  --border: #27272a;
  --border-subtle: #1f1f24;
  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-faint: #71717a;
  --accent: #4da3ff;
  --accent-hover: #80bdff;
  --accent-subtle: rgba(0, 123, 255, 0.15);
  --accent-glow: rgba(0, 123, 255, 0.35);
  --code-bg: #0a0a0c;
  --code-text: #e4e4e7;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --method-get-bg: rgba(0, 123, 255, 0.18);
  --method-get-text: #66b0ff;
  --method-post-bg: rgba(0, 123, 255, 0.28);
  --method-post-text: #99caff;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 123, 255, 0.07), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 123, 255, 0.04), transparent);
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 123, 255, 0.11), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(0, 123, 255, 0.06), transparent);
}

.docs-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.docs-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid transparent;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

[data-theme="dark"] .docs-topbar {
  background: rgba(8, 8, 10, 0.8);
}

.docs-topbar.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.docs-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}

.docs-menu-toggle:hover {
  background: var(--bg-muted);
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.docs-brand__logo {
  display: block;
  height: 26px;
  width: auto;
  object-fit: contain;
}

[data-theme="light"] .docs-brand__logo {
  filter: brightness(0);
}

.docs-brand__suffix {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  padding-left: 2px;
  border-left: 1px solid var(--border);
  line-height: 1;
  padding-top: 1px;
  padding-bottom: 1px;
  padding-left: 10px;
}

[data-theme="dark"] .docs-brand__suffix {
  color: var(--text-faint);
}

.docs-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.docs-search-icon {
  position: absolute;
  left: 13px;
  color: var(--text-faint);
  pointer-events: none;
}

.docs-search {
  width: 240px;
  height: 38px;
  padding: 0 72px 0 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.docs-search:hover {
  background: var(--bg);
  border-color: rgba(0, 123, 255, 0.35);
}

.docs-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle);
  background: var(--bg);
}

.docs-search-kbd {
  position: absolute;
  right: 10px;
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--bg);
  pointer-events: none;
}

.docs-theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.docs-theme-toggle:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.docs-theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .docs-theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .docs-theme-toggle .icon-moon { display: block; }

.docs-dashboard-link {
  height: 38px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--accent), var(--blue-700));
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 10px var(--accent-glow);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.docs-dashboard-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 18px var(--accent-glow);
}

/* Layout */
.docs-body {
  display: flex;
  flex: 1;
  min-height: 0;
}

.docs-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  backdrop-filter: blur(12px);
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  padding: 24px 14px 40px;
}

.docs-nav__group + .docs-nav__group {
  margin-top: 28px;
}

.docs-nav__label {
  margin: 0 0 10px 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

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

.docs-nav__link {
  display: block;
  position: relative;
  padding: 9px 14px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 450;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.docs-nav__link:hover {
  color: var(--text);
  background: var(--bg-muted);
}

.docs-nav__link.is-active {
  color: var(--accent);
  background: var(--accent-subtle);
  font-weight: 600;
}

.docs-nav__link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.docs-main {
  flex: 1;
  display: flex;
  min-width: 0;
  justify-content: center;
  gap: 0;
}

.docs-article {
  flex: 1;
  max-width: 780px;
  padding: 36px 48px 88px;
  min-width: 0;
}

.docs-toc {
  width: var(--toc-width);
  flex-shrink: 0;
  padding: 36px 24px 40px 0;
  position: sticky;
  top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height));
  overflow-y: auto;
}

.docs-toc__label {
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.docs-toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.docs-toc__item a {
  display: block;
  padding: 5px 0 5px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  line-height: 1.45;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
}

.docs-toc__item--h3 a {
  padding-left: 26px;
  font-size: 12px;
}

.docs-toc__item a:hover,
.docs-toc__item a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* Page header */
.docs-page-header {
  margin-bottom: 32px;
}

.docs-page-header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.docs-page-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid rgba(0, 123, 255, 0.15);
}

.docs-page-method {
  font-size: 11px !important;
  padding: 4px 9px !important;
}

.docs-page-title {
  margin: 0 0 12px;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
}

.docs-page-desc {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 640px;
}

/* API playground */
.api-playground {
  margin-bottom: 36px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--bg-subtle), var(--bg));
  box-shadow: var(--shadow-sm);
}

.api-playground__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.api-playground__url-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.api-method {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
}

.method-get { background: var(--method-get-bg); color: var(--method-get-text); }
.method-post { background: var(--method-post-bg); color: var(--method-post-text); }
.method-put, .method-patch { background: #fef3c7; color: #b45309; }
.method-delete { background: #fee2e2; color: #b91c1c; }
.method-default { background: var(--bg-muted); color: var(--text-muted); }

.api-endpoint {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
}

.api-endpoint-copy,
.code-block__copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s var(--ease), border-color 0.15s var(--ease), background 0.15s var(--ease);
  flex-shrink: 0;
}

.api-endpoint-copy:hover,
.code-block__copy:hover {
  color: var(--accent);
  border-color: rgba(0, 123, 255, 0.35);
  background: var(--accent-subtle);
}

.api-endpoint-copy.copied,
.code-block__copy.copied {
  color: var(--accent);
  border-color: var(--accent);
}

/* Prose — hide duplicate markdown h1 */
.prose > h1:first-child {
  display: none;
}

.prose h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin: 0 0 16px;
}

.prose h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 44px 0 16px;
  padding-top: 4px;
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}

.prose h3 {
  font-size: 1.1rem;
  font-weight: 650;
  margin: 28px 0 12px;
  scroll-margin-top: calc(var(--topbar-height) + 20px);
}

.prose h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 20px 0 8px;
}

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

.prose strong {
  font-weight: 650;
  color: var(--text);
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(0, 123, 255, 0.25);
  transition: border-color 0.15s var(--ease);
}

.prose a:hover {
  border-bottom-color: var(--accent);
}

.prose ul, .prose ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.prose li {
  margin-bottom: 8px;
}

.prose li code,
.prose p code,
.prose td code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-subtle);
  color: var(--accent-hover);
  border: 1px solid rgba(0, 123, 255, 0.12);
}

[data-theme="dark"] .prose li code,
[data-theme="dark"] .prose p code,
[data-theme="dark"] .prose td code {
  color: var(--accent);
}

/* Tables */
.prose .table-wrap {
  margin: 0 0 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 14px;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.prose thead {
  background: var(--bg-subtle);
}

.prose th {
  text-align: left;
  padding: 11px 16px;
  font-weight: 650;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.prose td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.prose tr:last-child td {
  border-bottom: none;
}

.prose tbody tr {
  transition: background 0.12s var(--ease);
}

.prose tbody tr:hover {
  background: var(--bg-subtle);
}

/* Code blocks */
.code-block {
  margin: 0 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--code-bg);
  box-shadow: var(--shadow-md);
}

.code-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-block__lang {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.code-block__copy {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
  color: #94a3b8;
}

.code-block__copy:hover {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.code-block pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
}

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

/* Pagination */
.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 56px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.docs-pagination__link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  background: var(--bg);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

.docs-pagination__link:hover {
  border-color: rgba(0, 123, 255, 0.4);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.docs-pagination__link--next {
  text-align: right;
  grid-column: 2;
}

.docs-pagination__label {
  font-size: 11px;
  font-weight: 650;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.docs-pagination__title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* Search modal */
.docs-search-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
}

.docs-search-modal[hidden] {
  display: none !important;
}

.docs-search-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.15s var(--ease);
}

.docs-search-modal__panel {
  position: relative;
  width: 100%;
  max-width: 580px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideUp 0.2s var(--ease);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.docs-search-modal__input {
  width: 100%;
  padding: 18px 20px;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
}

.docs-search-modal__input:focus {
  outline: none;
}

.docs-search-results {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: 380px;
  overflow-y: auto;
}

.docs-search-results li a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s var(--ease);
}

.docs-search-results li a:hover,
.docs-search-results li a:focus {
  background: var(--accent-subtle);
  outline: none;
}

.docs-search-results .result-group {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.docs-search-results .result-title {
  font-weight: 600;
  font-size: 14px;
  margin-top: 2px;
}

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

.docs-sidebar-overlay {
  display: none;
}

/* Responsive */
@media (max-width: 1200px) {
  .docs-toc { display: none; }
  .docs-article { max-width: 780px; }
}

@media (max-width: 900px) {
  .docs-menu-toggle { display: flex; }
  .docs-search-wrap { display: none; }

  .docs-sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-lg);
  }

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

  .docs-sidebar-overlay:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 80;
  }

  .docs-article {
    padding: 28px 20px 72px;
  }

  .docs-page-title {
    font-size: 1.85rem;
  }
}

@media (max-width: 520px) {
  .docs-dashboard-link { font-size: 12px; padding: 0 12px; }
  .api-playground__url-row { flex-direction: column; align-items: stretch; }
  .docs-pagination { grid-template-columns: 1fr; }
  .docs-pagination__link--next { grid-column: 1; text-align: left; }
}
