:root {
  --bg-body: #ffffff;
  --text-color: #263238;
  --sidebar-bg: #1f2937;
  --sidebar-header: #111827;
  --sidebar-text: #d1d5db;
  --sidebar-muted: #9ca3af;
  --sidebar-hover: #374151;
  --sidebar-active: #f97316;
  --header-bg: #111827;
  --link-color: #2563eb;
  --content-bg: #ffffff;
  --border-color: #e5e7eb;
}

body.dark-mode {
  --bg-body: #0f172a;
  --text-color: #e5e7eb;
  --sidebar-bg: #020617;
  --sidebar-header: #020617;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #94a3b8;
  --sidebar-hover: #1e293b;
  --sidebar-active: #fb923c;
  --header-bg: #020617;
  --link-color: #38bdf8;
  --content-bg: #0f172a;
  --border-color: #334155;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  display: flex;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg-body);
  color: var(--text-color);
}

header {
  display: none;
  width: 100%;
  height: 58px;
  background: var(--header-bg);
  color: #ffffff;
  padding: 0 16px;
  position: fixed;
  top: 0;
  z-index: 1000;
  align-items: center;
  gap: 12px;
}

.menu-button {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}

.sidebar {
  width: 300px;
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1001;
  transition: 0.3s;
}

.sidebar-title {
  padding: 20px;
  background: var(--sidebar-header);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: bold;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.controls {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-wrapper {
  display: flex;
  align-items: center;
  background: #ffffff;
  border-radius: 8px;
  padding: 0 8px;
}

.search-wrapper input {
  flex: 1;
  padding: 10px 4px;
  border: none;
  outline: none;
  background: transparent;
  color: #111827;
  font-size: 0.9rem;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: #374151;
  display: flex;
  align-items: center;
}

#clearBtn {
  display: none;
}

.menu-container {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 20px;
}

.product-toggle {
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  color: var(--sidebar-muted);
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 0.78rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-toggle:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.product-toggle .arrow {
  transition: transform 0.2s;
}

.product-toggle.collapsed .arrow {
  transform: rotate(-90deg);
}

.product-menu {
  display: block;
}

.product-menu.collapsed {
  display: none;
}

.product-menu a {
  padding-left: 36px;
}

.sidebar a {
  display: block;
  padding: 11px 20px 11px 32px;
  color: var(--sidebar-text);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
  border-left: 4px solid transparent;
  transition: 0.2s;
}

.sidebar a:hover {
  background: var(--sidebar-hover);
  color: #ffffff;
}

.sidebar a.active {
  background: var(--sidebar-hover);
  color: #ffffff;
  border-left-color: var(--sidebar-active);
  font-weight: bold;
}

.main-wrapper {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  background: var(--content-bg);
  padding: 42px 56px;
  position: relative;
}

.content {
  max-width: 960px;
  line-height: 1.75;
  font-size: 1rem;
}

.content h1,
.content h2,
.content h3 {
  line-height: 1.3;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.content h1 {
  font-size: 2rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.content h2 {
  font-size: 1.5rem;
}

.content h3 {
  font-size: 1.2rem;
}

.content a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 1px solid var(--link-color);
}

.content code {
  background: rgba(148, 163, 184, 0.2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.9rem;
}

.content pre {
  background: #111827;
  color: #e5e7eb;
  padding: 16px;
  border-radius: 10px;
  overflow-x: auto;
}

.content img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.loading,
.error-message {
  padding: 20px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.15);
}

#backToTop {
  display: none;
  position: fixed;
  right: 28px;
  bottom: 28px;
  background: #f97316;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 1002;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  font-weight: bold;
}

#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1000;
}

.doc-toolbar {
  max-width: 960px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb {
  font-size: 0.88rem;
  color: var(--text-color);
  opacity: 0.75;
}

.copy-link-btn {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.copy-link-btn:hover {
  background: rgba(148, 163, 184, 0.15);
}

.copy-link-btn.copied {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.search-results {
  display: none;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
}

.search-result-title {
  padding: 10px 12px;
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--sidebar-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.search-result-item:hover {
  background: var(--sidebar-hover);
}

.search-result-product {
  font-size: 0.72rem;
  color: var(--sidebar-muted);
  margin-bottom: 3px;
}

.search-result-text {
  font-size: 0.9rem;
  color: var(--sidebar-text);
}

.search-empty {
  padding: 12px;
  font-size: 0.85rem;
  color: var(--sidebar-muted);
}

.content figure {
  margin: 24px 0;
}

.content figure img,
.content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: rgba(148, 163, 184, 0.12);
  cursor: zoom-in;
}

.content figcaption {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--text-color);
  opacity: 0.7;
  text-align: center;
}

body.dark-mode .content img {
  filter: brightness(0.92);
}

.image-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.86);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.image-modal.active {
  display: flex;
}

.image-modal img {
  max-width: 96vw;
  max-height: 90vh;
  border-radius: 12px;
  background: #ffffff;
}

.image-modal-close {
  position: fixed;
  top: 20px;
  right: 24px;
  color: #ffffff;
  font-size: 32px;
  cursor: pointer;
  z-index: 3001;
}

.doc-navigation {
  max-width: 960px;
  margin-top: 48px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.doc-nav-item {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: 0.2s;
  background: rgba(148, 163, 184, 0.06);
}

.doc-nav-item:hover {
  background: rgba(148, 163, 184, 0.14);
  transform: translateY(-2px);
}

.doc-nav-item.next {
  text-align: right;
}

.doc-nav-label {
  font-size: 0.74rem;
  opacity: 0.7;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.doc-nav-title {
  font-weight: bold;
  font-size: 0.95rem;
}

/* .redoc-container {
  background: #ffffff;
  color: #111827;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

body.dark-mode .redoc-container {
  background: #ffffff;
  color: #111827;
}

.redoc-container h1,
.redoc-container h2,
.redoc-container h3,
.redoc-container p {
  color: inherit;
} */

.main-wrapper.api-mode {
  padding: 24px;
}

.main-wrapper.api-mode .content {
  max-width: none;
  width: 100%;
}

.main-wrapper.api-mode .doc-toolbar {
  max-width: none;
}

.main-wrapper.api-mode .doc-navigation {
  max-width: none;
}

/* .redoc-container {
  width: 100%;
  min-height: calc(100vh - 170px);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
}

.redoc-container > div {
  min-height: calc(100vh - 170px);
} */

.main-wrapper.api-mode {
  padding: 24px 32px;
}

.main-wrapper.api-mode .content {
  max-width: none;
  width: 100%;
}

.main-wrapper.api-mode .doc-toolbar {
  max-width: none;
}

.main-wrapper.api-mode .doc-navigation {
  max-width: none;
}

.swagger-ui-wrapper {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  min-height: calc(100vh - 170px);
  padding: 0;
}

.swagger-ui .topbar {
  display: none;
}

.swagger-ui {
  font-family: Arial, Helvetica, sans-serif;
}

.swagger-ui .info {
  margin: 32px 0;
}

.swagger-ui .scheme-container {
  box-shadow: none;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

body.dark-mode .swagger-ui-wrapper {
  background: #ffffff;
  color: #111827;
}

@media (max-width: 768px) {
  .main-wrapper.api-mode {
    padding: 86px 14px 24px;
  }

  .swagger-ui .info .title {
    font-size: 28px;
  }
}

/* ================================
   MARKDOWN CONTENT STYLE
================================ */

.content {
  color: var(--text-color);
}

.content h1 {
  font-size: 2.2rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.content h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin-top: 42px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.content h3 {
  font-size: 1.22rem;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 10px;
}

.content h4 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 22px;
  margin-bottom: 8px;
}

.content p {
  margin: 12px 0;
  line-height: 1.8;
}

.content ul,
.content ol {
  padding-left: 24px;
  margin: 12px 0 18px;
}

.content li {
  margin: 7px 0;
  line-height: 1.7;
}

.content strong {
  font-weight: 700;
}

.content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 32px 0;
}

/* Link */
.content a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
}

.content a:hover {
  border-bottom-color: var(--link-color);
}

/* Table */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  overflow: hidden;
  border-radius: 10px;
  font-size: 0.95rem;
}

.content table th {
  background: rgba(148, 163, 184, 0.18);
  font-weight: 700;
  text-align: left;
}

.content table th,
.content table td {
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  vertical-align: top;
}

.content table tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.06);
}

/* Blockquote as info box */
.content blockquote {
  margin: 22px 0;
  padding: 14px 18px;
  border-left: 5px solid #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border-radius: 0 10px 10px 0;
}

.content blockquote p {
  margin: 0;
}

/* Code */
.content code {
  background: rgba(148, 163, 184, 0.2);
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.content pre {
  background: #111827;
  color: #e5e7eb;
  padding: 18px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 22px 0;
}

.content pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Image */
.content figure {
  margin: 28px 0;
}

.content figure img,
.content img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: rgba(148, 163, 184, 0.12);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.content figcaption {
  margin-top: 10px;
  font-size: 0.86rem;
  color: var(--text-color);
  opacity: 0.65;
  text-align: center;
}

/* Checklist */
.content input[type="checkbox"] {
  margin-right: 8px;
  transform: translateY(1px);
}

/* Simple badges */
.content .badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

/* Callout Boxes */
.content .callout {
  margin: 22px 0;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.content .callout-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.content .callout.info {
  background: rgba(37, 99, 235, 0.08);
  border-left: 5px solid #2563eb;
}

.content .callout.warning {
  background: rgba(245, 158, 11, 0.1);
  border-left: 5px solid #f59e0b;
}

.content .callout.success {
  background: rgba(22, 163, 74, 0.1);
  border-left: 5px solid #16a34a;
}

.content .callout.danger {
  background: rgba(220, 38, 38, 0.1);
  border-left: 5px solid #dc2626;
}

/* Dark Mode Adjustment */
body.dark-mode .content table tr:nth-child(even) td {
  background: rgba(148, 163, 184, 0.08);
}

body.dark-mode .content blockquote {
  background: rgba(37, 99, 235, 0.14);
}

body.dark-mode .content img {
  filter: brightness(0.94);
  box-shadow: none;
}

.doc-layout {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 36px;
  align-items: flex-start;
}

.doc-layout .content {
  max-width: 860px;
}

.toc-panel {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--border-color);
  font-size: 0.86rem;
}

.toc-title {
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-color);
}

.toc-list a {
  display: block;
  color: var(--text-color);
  opacity: 0.72;
  text-decoration: none;
  padding: 6px 0;
  border-bottom: none;
  line-height: 1.4;
}

.toc-list a:hover {
  opacity: 1;
  color: var(--link-color);
}

.toc-list a.toc-h2 {
  padding-left: 0;
}

.toc-list a.toc-h3 {
  padding-left: 14px;
  font-size: 0.82rem;
}

.toc-list a.active {
  color: var(--link-color);
  opacity: 1;
  font-weight: 700;
}

.toc-empty {
  color: var(--text-color);
  opacity: 0.55;
  font-size: 0.82rem;
}

.main-wrapper.api-mode .doc-layout {
  max-width: none;
  display: block;
}

.main-wrapper.api-mode .toc-panel {
  display: none;
}

.main-wrapper.api-mode .doc-layout .content {
  max-width: none;
}

@media (max-width: 1100px) {
  .doc-layout {
    display: block;
  }

  .doc-layout .content {
    max-width: 960px;
  }

  .toc-panel {
    display: none;
  }
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-btn {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.toolbar-btn:hover {
  background: rgba(148, 163, 184, 0.15);
}

/* Hide left menu */
body.left-menu-hidden .sidebar {
  display: none;
}

body.left-menu-hidden .main-wrapper {
  width: 100%;
}

body.toc-hidden .toc-panel {
  display: none;
}

body.toc-hidden .doc-layout {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1180px;
}

body.toc-hidden .doc-layout .content {
  max-width: 1180px;
}

body.left-menu-hidden.toc-hidden .doc-layout {
  max-width: 1280px;
}

body.left-menu-hidden.toc-hidden .doc-layout .content {
  max-width: 1280px;
}

body.left-menu-hidden.toc-hidden .doc-toolbar,
body.left-menu-hidden.toc-hidden .doc-navigation {
  max-width: 1280px;
}

@media (max-width: 768px) {
  .doc-toolbar {
    display: flex;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap !important;
  }

  .breadcrumb {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toolbar-actions {
    width: auto !important;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    flex-wrap: nowrap !important;
  }

  .toolbar-actions .desktop-only {
    display: none !important;
  }

  .copy-link-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    padding: 7px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  body.left-menu-hidden .sidebar {
    display: flex;
  }
}

@media (max-width: 768px) {
  .doc-navigation {
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    align-items: stretch;
  }

  .doc-nav-item {
    flex: 1 1 0;
    min-width: 0;
    padding: 12px;
  }

  .doc-nav-item.next {
    text-align: right;
  }

  .doc-nav-label {
    font-size: 0.68rem;
    margin-bottom: 4px;
  }

  .doc-nav-title {
    font-size: 0.8rem;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

/* baru */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }

  body.left-menu-hidden .sidebar {
    display: flex;
  }

  body.toc-hidden .toc-panel {
    display: none;
  }

  body.toc-hidden .doc-layout,
  body.left-menu-hidden.toc-hidden .doc-layout {
    max-width: 100%;
    display: block;
  }

  body.toc-hidden .doc-layout .content,
  body.left-menu-hidden.toc-hidden .doc-layout .content {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .doc-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
  }

  .breadcrumb {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .copy-link-btn {
    padding: 7px 12px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  /* hide desktop buttons */
  .desktop-only {
    display: none !important;
  }
}

@media (max-width: 768px) {
  header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -300px;
  }

  .sidebar.active {
    left: 0;
  }

  .main-wrapper {
    padding: 86px 22px 32px;
  }

  .content {
    font-size: 0.98rem;
  }

  .content h1 {
    font-size: 1.6rem;
  }
}
