/* ============================================================
   PROVIGIS API DOCS — Theme
   Layout uses .app-* classes to avoid fighting base.css.
   ============================================================ */

:root {
  --sidebar-bg: #f7f8fa;
  --sidebar-text: #5a6178;
  --sidebar-text-hover: #1e2340;
  --sidebar-active-bg: rgba(109, 40, 217, 0.08);
  --sidebar-active-text: #6d28d9;
  --sidebar-active-border: #6d28d9;
  --sidebar-group-text: #8891a8;
  --sidebar-width: 260px;

  --content-bg: #ffffff;
  --content-text: #374151;
  --content-heading: #111827;
  --content-border: #e5e7eb;

  --code-bg: #1e2235;
  --code-panel-bg: #1e2235;

  --accent: #6d28d9;
  --accent-hover: #7c3aed;

  --header-height: 56px;
  --header-bg: #ffffff;

  --get-color: #16a34a;
  --post-color: #2563eb;
  --put-color: #d97706;
  --delete-color: #dc2626;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 6px;
}

/* ---- Global ---- */
html, body {
  font-family: var(--font-body) !important;
  font-size: 14px;
  line-height: 1.6;
  color: var(--content-text);
  -webkit-font-smoothing: antialiased;
}

code, pre, .code, .hljs, .endpoint-url, .endpoint-method {
  font-family: var(--font-mono) !important;
}

/* ============================================================
   LAYOUT — .app-* classes
   ============================================================ */

/* Fixed header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  z-index: 200;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--content-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.header-logo { height: 26px; margin-right: 14px; }

.header-title {
  color: var(--content-heading);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.header-spacer { flex: 1; }

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---- Pill toggle buttons (version / language) ---- */
.pill-group {
  display: inline-flex;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--content-border);
}
.pill {
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--sidebar-text);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s;
}
.pill:not(:last-child) {
  border-right: 1px solid var(--content-border);
}
.pill:hover {
  color: var(--content-heading);
  background: rgba(0,0,0,0.04);
}
.pill.active {
  color: #fff;
  background: var(--accent);
}

/* Sidebar */
.app-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  padding: 16px 14px 40px;
  border-right: 1px solid var(--content-border);
}

/* Main content — pushed below header and right of sidebar */
.app-main {
  margin-top: var(--header-height);
  margin-left: var(--sidebar-width);
}

/* Code tabs bar — fixed top-right, ABOVE content, BELOW header */
.app-code-bar {
  position: fixed;
  top: var(--header-height);
  right: 0;
  width: calc(50% - 130px);
  z-index: 150;
}

/* Right panel dark background */
.app-code-bg {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: calc(50% - 130px);
  background: var(--code-panel-bg);
  z-index: -1;
}

/* Tablet header */
.app-tablet-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--sidebar-bg);
  color: var(--content-heading);
  z-index: 200;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--content-border);
}

/* Tablet nav drawer */
.app-tablet-nav {
  position: fixed;
  left: 0;
  right: 0;
  top: 50px;
  bottom: 0;
  background: var(--sidebar-bg);
  padding: 16px;
  overflow-y: auto;
  z-index: 199;
}

/* Right panel content area */
.app-right-panel {
  background: var(--code-panel-bg);
  color: #c8d3e0;
}

/* ---- Search bar ---- */
.search-bar { position: relative; margin: 0 0 14px; }
.search-bar input {
  width: 100%; padding: 7px 12px 7px 30px;
  border: 1px solid var(--content-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--content-text); font-size: 13px; font-family: var(--font-body);
  outline: none; box-sizing: border-box;
  background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z' stroke='%238891a8' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 9px center;
}
.search-bar input::placeholder { color: var(--sidebar-group-text); }
.search-bar input:focus { border-color: var(--accent); background-color: #fff; box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1); }

.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--content-border);
  border-radius: var(--radius); max-height: 260px; overflow-y: auto; z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}
.search-results a {
  display: block; padding: 7px 12px; color: var(--sidebar-text);
  font-size: 13px; cursor: pointer; text-decoration: none;
}
.search-results a:hover, .search-results a.active {
  background: var(--sidebar-active-bg); color: var(--sidebar-active-text);
}

/* ---- Nav groups ---- */
.nav-group-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 4px; cursor: pointer;
  color: var(--sidebar-group-text);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; user-select: none;
}
.nav-group-header:hover { color: var(--sidebar-text); }
.nav-group-chevron { font-size: 8px; transition: transform 0.15s; }
.nav-group-chevron.expanded { transform: rotate(90deg); }

/* ---- Nav items ---- */
.app-sidebar .pad0x.small .line-height15.pad0x.pad00y.block {
  padding: 5px 10px; margin: 1px 0;
  border-radius: 4px; border-left: 2px solid transparent;
  color: var(--sidebar-text); font-size: 13px; line-height: 1.4;
  text-decoration: none; opacity: 1 !important; display: block;
}
.app-sidebar .pad0x.small .line-height15.pad0x.pad00y.block:hover {
  color: var(--sidebar-text-hover); background: rgba(0,0,0,0.04);
}
.app-sidebar .pad0x.small .line-height15.pad0x.pad00y.block.fill-lighten2 {
  color: var(--sidebar-active-text) !important;
  background: var(--sidebar-active-bg) !important;
  border-left-color: var(--sidebar-active-border) !important;
  padding-left: 8px !important;
}
.app-sidebar .fill-lighten2 { background: var(--sidebar-active-bg) !important; }

/* Also style nav items in tablet drawer */
.app-tablet-nav .pad0x.small .line-height15.pad0x.pad00y.block {
  padding: 5px 10px; margin: 1px 0;
  border-radius: 4px; border-left: 2px solid transparent;
  color: var(--sidebar-text); font-size: 13px; line-height: 1.4;
  text-decoration: none; opacity: 1 !important; display: block;
}
.app-tablet-nav .pad0x.small .line-height15.pad0x.pad00y.block:hover {
  color: var(--sidebar-text-hover); background: rgba(0,0,0,0.04);
}
.app-tablet-nav .pad0x.small .line-height15.pad0x.pad00y.block.fill-lighten2 {
  color: var(--sidebar-active-text) !important;
  background: var(--sidebar-active-bg) !important;
  border-left-color: var(--sidebar-active-border) !important;
  padding-left: 8px !important;
}
.app-tablet-nav .fill-lighten2 { background: var(--sidebar-active-bg) !important; }

/* ---- Section borders ---- */
.keyline-top { border-color: var(--content-border) !important; margin-top: 0 !important; }
.section.contain.clearfix { border-top: 1px solid var(--content-border); }
.section.contain.clearfix:first-child { border-top: none; margin-top: 0; }

/* ---- Prose (left content panel) ---- */
.prose { font-family: var(--font-body); font-size: 14px; line-height: 1.65; color: var(--content-text); }
.prose h2 { font-size: 22px; font-weight: 700; color: var(--content-heading); letter-spacing: -0.02em; margin-bottom: 12px; }
.prose h3 { font-size: 17px; font-weight: 600; color: var(--content-heading); margin-bottom: 8px; }
.prose h4 { font-size: 14px; font-weight: 600; color: var(--content-heading); }
.prose p { margin-bottom: 12px; }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { color: var(--accent-hover); text-decoration: underline; }

.prose code {
  background: #f4f5f7; padding: 2px 5px; border-radius: 3px;
  font-size: 12.5px; color: #e83e8c; font-family: var(--font-mono);
}
.prose pre { border-radius: var(--radius); margin-bottom: 14px; }
.prose pre code { background: none; padding: 0; color: inherit; }

/* Limit logo image in content if any */
.prose img { max-width: 200px; }

/* Blockquotes */
.prose blockquote {
  padding: 10px 14px !important; border-left: 3px solid var(--accent) !important;
  background: #f3f0ff; border-radius: 0 4px 4px 0; margin-bottom: 14px;
}
blockquote p, .prose blockquote p {
  color: #5a5680 !important; font-style: normal !important;
  font-size: 13px; margin-bottom: 0 !important;
}

/* ---- Tables (parameter tables) ---- */
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 20px; font-size: 13px !important; }
.prose table th {
  text-align: left; font-weight: 600; color: var(--content-heading);
  border-bottom: 2px solid var(--content-border); padding: 8px 10px !important;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
}
.prose table td {
  padding: 8px 10px !important; border-bottom: 1px solid #f0f2f5;
  vertical-align: top; color: var(--content-text);
}
.prose table tr:last-child td { border-bottom: none; }
.prose table code { font-size: 12px; background: #f0f2f5; padding: 1px 4px; border-radius: 3px; color: var(--content-heading); }

/* ---- Right Panel Content ---- */
.app-right-panel h4,
.app-right-panel p { color: #c8d3e0; }

/* Code blocks in right panel */
.app-right-panel .hljs, .app-right-panel pre {
  background: rgba(0,0,0,0.25) !important;
  border-radius: var(--radius); padding: 14px !important;
}

/* Endpoint badges */
.endpoint.dark.fill-dark.round {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius) !important; overflow: hidden; margin: 8px 0;
}
.endpoint-method {
  font-weight: 700; font-size: 11px; padding: 5px 8px !important;
  font-family: var(--font-mono) !important; border-radius: 4px !important;
  margin: 4px !important; min-width: 48px; text-align: center;
}
.endpoint-method.GET { background: var(--get-color) !important; color: #fff !important; }
.endpoint-method.POST { background: var(--post-color) !important; color: #fff !important; }
.endpoint-method.PUT { background: var(--put-color) !important; color: #fff !important; }
.endpoint-method.DELETE { background: var(--delete-color) !important; color: #fff !important; }
.endpoint-url { padding: 5px 8px !important; font-size: 13px; color: #dde4ed !important; }
.endpoint-url .strong { color: var(--accent) !important; }

/* ---- Code Tabs (top-right panel header) ---- */
.code-tabs {
  display: flex; gap: 0; padding: 0 10px;
  background: var(--code-panel-bg); border-bottom: 1px solid rgba(255,255,255,0.08);
  overflow-x: auto;
}
.code-tab {
  padding: 7px 12px; font-size: 12px; font-family: var(--font-body);
  color: #8892b0; cursor: pointer;
  border: none; border-bottom: 2px solid transparent;
  background: none; white-space: nowrap;
}
.code-tab:hover { color: #dde4ed; }
.code-tab.active { color: #fff; border-bottom-color: var(--accent); }

/* Code tabs container */
.app-code-bar .events {
  background: var(--code-panel-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: none; padding: 2px 6px;
}
.app-code-bar .events .small.quiet.inline {
  color: #8892b0 !important; opacity: 1 !important; font-size: 12px;
}

/* Method badges (inline) */
.method-badge {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 4px; margin-right: 6px;
  text-transform: uppercase; font-family: var(--font-mono);
  min-width: 36px; text-align: center;
}
.method-badge.get { background: #dcfce7; color: #166534; }
.method-badge.post { background: #dbeafe; color: #1e40af; }
.method-badge.put { background: #fef3c7; color: #92400e; }
.method-badge.delete { background: #fee2e2; color: #991b1b; }

/* ---- Dark theme text overrides ---- */
.dark { color: #c8d3e0 !important; }
.dark a { color: #c8d3e0 !important; }
.dark a:hover, .dark a.active { color: #fff !important; }

.headline {
  color: #fff !important; font-family: var(--font-body) !important;
  font-size: 15px !important; font-weight: 600 !important;
  font-style: normal !important; padding: 0 !important;
}

/* Override for headline in light header context */
.app-header .headline,
.app-tablet-header .headline {
  color: var(--content-heading) !important;
}

/* ---- Scrollbar ---- */
.scroll-styled::-webkit-scrollbar { width: 5px; }
.scroll-styled::-webkit-scrollbar-track { background: transparent; }
.scroll-styled::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.scroll-styled::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ---- Smooth transitions ---- */
a, button, select, input { transition: color 0.12s, background-color 0.12s, border-color 0.12s; }
::selection { background: rgba(109, 40, 217, 0.2); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .app-header { display: none; }
  .app-main { margin-top: 50px; margin-left: 0; }
  .app-code-bar { top: 50px; width: 50%; }
  .app-code-bg { top: 50px; width: 50%; }
  .app-tablet-header .pill { font-size: 11px; padding: 3px 7px; }
}

@media (max-width: 640px) {
  .app-main { margin-top: 50px; margin-left: 0; }
  .app-code-bar { position: static; width: auto; }
  .app-code-bg { display: none; }
}
