:root {
  --bg-main: #0a0b0d; /* Stripe-style dark */
  --bg-sidebar: #0e0f12;
  --bg-code: #16171d;
  --bg-code-header: #1e1f26;
  --bg-code-inner: #000000;
  --border-color: rgba(255, 255, 255, 0.08);
  --text-main: #ffffff;
  --text-muted: #8898aa;
  --accent: #635bff; /* Stripe Purple */
  --accent-light: #7a73ff;
  --code-string: #4cfaff;
  --code-key: #635bff;
  --code-number: #f2a24d;
  --code-bool: #f2a24d;
  --code-comment: #6b7c93;
  --sidebar-width: 280px;
  --content-max-width: 1600px;
}

body.light-mode {
  --bg-main: #ffffff;
  --bg-sidebar: #f6f9fc;
  --border-color: rgba(0, 0, 0, 0.08);
  --text-main: #1a1b1e;
  --text-muted: #64748b;
  /* Light Code Pane colors */
  --bg-code: #f8fafc;
  --bg-code-header: #e2e8f0;
  --bg-code-inner: #ffffff;
  --code-string: #059669;
  --code-key: #4f46e5;
  --code-number: #d97706;
  --code-bool: #d97706;
  --code-comment: #94a3b8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Inter", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}
.logo img {
  width: 42px;
  height: 42px;
}
/* Layout */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 30px 20px;
  z-index: 100;
}

.logo-area {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo-text {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-main);
  text-transform: uppercase;
}

/* Theme Toggle Button */
.theme-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: var(--text-muted);
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--accent);
}
.light-mode .theme-toggle {
  background: #e2e8f0;
  border-color: rgba(0, 0, 0, 0.1);
  color: #1a1b1e;
}
.light-mode .theme-toggle:hover {
  background: #cbd5e1;
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.theme-toggle .moon-icon {
  display: none;
}
.theme-toggle .sun-icon {
  display: block;
}

.light-mode .theme-toggle .moon-icon {
  display: block;
}
.light-mode .theme-toggle .sun-icon {
  display: none;
}

.search-mock {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 30px;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.search-mock:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
}

.last-updated {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 25px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
  opacity: 0.8;
}
.last-updated svg {
  width: 14px;
  height: 14px;
  opacity: 0.5;
  stroke: currentColor;
}
.last-updated span {
  color: var(--text-main);
  font-weight: 500;
}

.nav-category {
  margin-bottom: 30px;
}
.nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
  letter-spacing: 0.1em;
}
.nav-link {
  display: block;
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: 0.2s;
  position: relative;
}
.nav-link:hover {
  color: var(--text-main);
}
.nav-link.active {
  color: var(--accent);
  font-weight: 600;
}

.nav-group {
  margin-bottom: 20px;
}
.nav-parent {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-children {
  padding-left: 15px;
  border-left: 1px solid var(--border-color);
  margin-left: 4px;
}
.nav-children .nav-link {
  font-size: 0.82rem;
  padding: 4px 0;
}
.nav-children .nav-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 12px;
  background: var(--accent);
}

/* Main Grid */
.main-container {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 820px; /* Base 2-column doc: info | code */
  max-width: calc(100% - var(--sidebar-width));
}

/* Documentation Column */
.doc-section {
  padding: 80px 60px;
  border-bottom: 1px solid var(--border-color);
  min-height: 80vh;
}
.doc-section h1 {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 24px;
}
.doc-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 16px;
  margin-top: 40px;
}
.doc-section p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

/* Attributes List */
.attribute-item {
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
}
.attribute-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.attribute-name {
  font-family: "Fira Code", monospace;
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}
.attribute-type {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  color: #a1a1aa;
  text-transform: lowercase;
}
.attribute-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.attribute-required {
  color: red;
  font-size: 0.75rem;
}

/* Code Pane Column (Right) */
.code-pane {
  background: var(--bg-code);
  padding: 10px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-left: 1px solid var(--border-color);
  overflow: auto;
}

.sticky-code-container {
  position: sticky;
  top: 80px;
}

/* Code Header V2 (Stripe Style) */
.code-block-header-v2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-code-header);
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px 8px 0 0;
  font-family: "JetBrains Mono", "Monaco", "Courier New", monospace;
  font-size: 0.85rem;
  position: relative;
  z-index: 2;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: all;
}

.method-tag {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 0;
  letter-spacing: 0.5px;
}

.method-tag.get {
  color: #5294ff;
}
.method-tag.post {
  color: #00d46a;
}

.path-text {
  color: var(--text-main);
  opacity: 0.8;
}

.header-right {
  display: flex;
  align-items: center;
}

/* Custom Select Styling */
.lang-select-wrapper {
  position: relative;
  display: inline-block;
}

.lang-select {
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 4px 28px 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  font-family: inherit;
}

.lang-select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.lang-select-wrapper::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid var(--text-main);
  pointer-events: none;
  opacity: 0.6;
}

.light-mode .code-block-header-v2 {
  background: #f1f5f9;
}
.light-mode .lang-select {
  background: #ffffff;
  border-color: #e2e8f0;
  color: #1a1b1e;
}

/* Language wrappers */
.code-lang-wrapper {
  display: none;
}

.code-lang-wrapper.active {
  display: block;
}

.code-area pre {
  margin: 0;
  padding: 15px 0;
  width: 100%;
}
.code-area code {
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}

.code-block-header {
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 15px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.endpoint-pill {
  background: var(--bg-sidebar);
  border-radius: 4px;
  padding: 4px 8px;
  font-family: "Fira Code", monospace;
  color: var(--text-main);
  font-size: 0.8rem;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
}
.method {
  color: var(--accent);
  font-weight: 700;
  margin-right: 8px;
}

.json-view {
  background: transparent;
  margin: 0;
  color: var(--text-main);
  font-family: "Fira Code", monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  padding: 20px 0;
  overflow-x: auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  max-height: 55vh;
}
.json-view p {
  margin-left: 0;
  margin-bottom: 0;
  display: flex;
  align-items: baseline;
}
.json-view p span:last-child {
  margin-left: 4px;
  white-space: nowrap;
}
.json-level {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  margin-left: 5px; /* Offset from the opening brace */
  padding-left: 5px;
}
.brace {
  color: var(--text-main);
  font-weight: 600;
}
.code-line {
  display: flex;
  align-items: baseline;
  min-height: 1.5em;
}
.code-area {
  background: var(--bg-code-inner);
  padding: 0 20px;
  border-radius: 0 0 8px 8px;
  margin-bottom: 40px;
  border: 1px solid var(--border-color);
  border-top: none;
}
.border-left {
  border-left: 1px solid var(--code-string);
}

/* Token Highlighting */
.key {
  color: var(--code-key);
}
.string {
  color: var(--code-string);
}
.number {
  color: var(--code-number);
}
.bool {
  color: var(--code-bool);
}
.comment {
  color: var(--code-comment);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive Header */
.mobile-header {
  display: none;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 200;
  align-items: center;
  justify-content: space-between;
}
.mobile-menu-toggle {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 5px;
}
.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}
.mobile-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-logo img {
  width: 32px;
  height: 32px;
}
.mobile-logo span {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-main);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 150;
}

/* View Response Button (Mobile) */
.view-response-btn {
  display: none;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 20px;
  margin-top: -10px;
  transition: all 0.2s;
}
.view-response-btn:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}
.view-response-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

/* Close Code Pane Button (Mobile) */
.close-code-pane {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-sidebar);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  cursor: pointer;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 10;
}
.close-code-pane svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

@media (max-width: 1200px) {
  .view-response-btn {
    display: inline-flex;
  }
  .close-code-pane {
    display: flex;
  }

  body.code-pane-visible {
    overflow: hidden;
  }

  .code-pane {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 300;
    background: var(--bg-code);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: none;
    display: none;
  }

  .main-container {
    grid-template-columns: 1fr;
  }
  .doc-section {
    padding: 60px 40px;
    min-height: auto;
  }
  .sticky-code-container {
    position: static;
  }
  .json-view {
    max-height: calc(100vh - 100px);
  }
}
body.code-pane-visible .page-wrapper {
  height: 100vh;
  overflow: hidden;
}
body.code-pane-visible .code-pane {
  transform: translateY(0);
  display: block;
}
@media (max-width: 991px) {
  .mobile-header {
    display: flex;
  }
  .sidebar {
    left: -280px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 20px 0 50px rgba(0, 0, 0, 0.3);
  }
  .main-container {
    margin-left: 0;
    max-width: 100%;
  }
  body.show-menu .sidebar {
    left: 0;
    position: fixed;
    z-index: 999;
  }
  body.show-menu .sidebar-overlay {
    display: block;
  }
}

@media (max-width: 768px) {
  .doc-section {
    padding: 40px 20px;
  }
  .doc-section h1 {
    font-size: 1.75rem;
  }
  .doc-section h2 {
    font-size: 1.4rem;
  }
  .code-pane {
    padding: 15px;
  }
  .endpoint-pill {
    font-size: 0.75rem;
    overflow-x: auto;
    white-space: nowrap;
  }
}
@media (max-width: 532px) {
  .attribute-name {
    overflow: auto;
    max-width: 230px;
  }
  .endpoint-pill {
    overflow: auto;
    max-width: 300px;
  }

  ::-webkit-scrollbar-thumb {
    background: #045bfd9d;
  }
  ::-webkit-scrollbar-thumb:hover {
    background: #96b4ece8;
  }
}
