/*
 * Panopticlaw Developer Portal — estructura de dev-portal.rappi.com con la identidad de Panopticlaw:
 * navy #0B1220 · índigo #4F6BED / #3F5BD9 / #7A96FF · violeta #8B6EFF.
 */
:root,
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f8f9fd;
  --surface: #ffffff;
  --ink: #141a2e;
  --ink-2: #4a5470;
  --ink-3: #7b849c;
  --line: #e3e7f2;
  --brand: #3f5bd9;
  --brand-strong: #4f6bed;
  --accent: #8b6eff;
  --side-bg: #eef1ff;
  --side-line: #dde3fb;
  --side-active: #ffffff;
  --code-inline-bg: #eef1ff;
  --code-inline-ink: #3346b8;
  --code-bg: #0b1220;
  --code-ink: #e3e8f6;
  --callout-note: #1b2540;
  --callout-tip: #3f5bd9;
  --callout-important: #6d4fe8;
  --callout-warning: #b45309;
  --ok: #2f9e6e;
  --client: #e07a5f;
  --server: #c2414b;
  --shadow: 0 1px 2px rgba(11, 18, 32, 0.05), 0 8px 24px rgba(11, 18, 32, 0.06);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #131f30;
  --ink: #e8ecf6;
  --ink-2: #aab6ce;
  --ink-3: #7a88a6;
  --line: #243252;
  --brand: #7a96ff;
  --brand-strong: #4f6bed;
  --accent: #8b6eff;
  --side-bg: #0d1525;
  --side-line: #1c2843;
  --side-active: #1b2747;
  --code-inline-bg: #1b2747;
  --code-inline-ink: #a8b9ff;
  --code-bg: #070c17;
  --code-ink: #e3e8f6;
  --callout-note: #1b2747;
  --callout-tip: #2f46b8;
  --callout-important: #5b3fd4;
  --callout-warning: #8a4b0f;
  --ok: #2a8a61;
  --client: #b8583f;
  --server: #a8333d;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* ───────── Sidebar ───────── */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--side-bg); border-right: 1px solid var(--side-line);
  padding: 20px 14px 14px;
}
.brand { display: flex; justify-content: center; padding: 4px 0 2px; }
.logo { height: 48px; width: auto; }
.logo-dark { display: none; }
:root[data-theme='dark'] .logo-light { display: none; }
:root[data-theme='dark'] .logo-dark { display: block; }
.brand-sub { margin: 4px 0 16px; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--brand); }

.search { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 0 10px; height: 38px; border-radius: 10px; background: var(--surface); border: 1px solid var(--side-line); box-shadow: var(--shadow); color: var(--ink-3); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { font: 11px ui-monospace, monospace; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink-3); }
.search-results { position: absolute; top: 44px; left: 0; width: min(460px, 86vw); max-height: 60vh; overflow: auto; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.search-results a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.search-results a.sel, .search-results a:hover { background: var(--side-bg); }
.search-results .r-title { font-weight: 600; font-size: 14px; }
.search-results .r-meta { font-size: 11px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; }
.search-results .r-snip { font-size: 12px; color: var(--ink-3); }
.search-results mark { background: color-mix(in srgb, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; }
.search-results .empty { padding: 10px; font-size: 13px; color: var(--ink-3); }

.nav-section { margin: 0 8px 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.sidebar nav { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.nav-list, .nav-subs { list-style: none; margin: 0; padding: 0; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink); text-decoration: none; }
.nav-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.nav-item.active { background: var(--side-active); color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.nav-subs { margin: 4px 0 8px 10px; padding-left: 8px; border-left: 2px solid var(--side-line); }
.nav-sub { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 7px; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.nav-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub:hover, .nav-sub.current { color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }

.sidebar-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--side-line); font-size: 13px; color: var(--ink-3); }
.switch { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: linear-gradient(135deg, #4f6bed, #8b6eff); color: #fff; font-weight: 600; font-size: 14px; text-decoration: none; box-shadow: 0 8px 22px -8px #4f6bed; }
.switch:hover { filter: brightness(1.08); }
.swagger { font-size: 12px; color: var(--ink-2); text-decoration: none; }
.swagger:hover { color: var(--brand); }

/* ───────── Contenido ───────── */
.main { margin-left: 272px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 clamp(16px, 5vw, 64px); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.crumb { font-size: 13px; color: var(--ink-3); }
.crumb span { margin: 0 8px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme, .menu { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.theme:hover, .menu:hover { color: var(--brand); border-color: var(--brand); }
.theme .moon { display: none; }
:root[data-theme='dark'] .theme .sun { display: none; }
:root[data-theme='dark'] .theme .moon { display: block; }
.menu { display: none; }

.content { width: 100%; max-width: 1040px; margin: 0 auto; padding: 28px clamp(16px, 5vw, 64px) 40px; flex: 1; }
.content h1, .content h2, .content h3, .content h4 { color: var(--ink); text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.3; position: relative; }
.content h1 { font-size: 22px; margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content h2 { font-size: 16px; margin: 34px 0 6px; }
.content h3 { font-size: 13px; margin: 24px 0 4px; color: var(--ink-2); }
.content h4 { font-size: 12px; margin: 18px 0 4px; }
.content p, .content li { color: var(--ink-2); }
.content p.lead { font-size: 15px; }
.content strong { color: var(--ink); }
.anchor { position: absolute; left: -18px; color: var(--ink-3); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.content ul, .content ol { padding-left: 22px; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

code { font: 0.86em ui-monospace, SFMono-Regular, Menlo, monospace; }
:not(pre) > code { background: var(--code-inline-bg); color: var(--code-inline-ink); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
code.url { white-space: normal; word-break: break-all; font-size: 0.9em; }
a > code { text-decoration: underline; text-underline-offset: 2px; }

.table-wrap { overflow-x: auto; margin: 12px 0 18px; }
table { border-collapse: collapse; min-width: min(560px, 100%); font-size: 14px; }
th { text-align: left; font-weight: 700; color: var(--ink); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
table.params td:first-child, table.resources td:first-child { white-space: nowrap; }
table.props td:first-child { color: var(--ink); width: 210px; }
.req { color: var(--brand); font-weight: 600; }

/* Callouts (Rappi: bloques sólidos con título) */
.callout { margin: 18px 0; padding: 14px 18px; border-radius: 10px; color: #f2f4fb; }
.callout p, .callout li { color: #e6e9f5; margin: 6px 0; }
.callout a { color: #fff; }
.callout :not(pre) > code { background: rgba(255, 255, 255, 0.14); color: #fff; }
.callout .callout-title { margin: 0 0 4px; font-weight: 800; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.callout-note { background: var(--callout-note); }
.callout-tip { background: var(--callout-tip); }
.callout-important { background: var(--callout-important); }
.callout-warning { background: var(--callout-warning); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1.6; }
.badge-new { background: #0b1220; color: #fff; }
:root[data-theme='dark'] .badge-new { background: #e8ecf6; color: #0b1220; }
.badge-stable { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge-deprecated { background: color-mix(in srgb, var(--server) 18%, transparent); color: var(--server); }
.method { display: inline-flex; justify-content: center; min-width: 38px; padding: 1px 6px; border-radius: 5px; font: 700 10px/1.7 ui-monospace, monospace; color: #fff; letter-spacing: 0.02em; }
.method-get { background: #2f9e6e; }
.method-post { background: #4f6bed; }
.method-put, .method-patch { background: #8b6eff; }
.method-delete { background: #c2414b; }
.content h2 .method { font-size: 12px; padding: 3px 8px; vertical-align: 2px; }

/* Endpoints */
.endpoint { margin-top: 44px; padding-top: 8px; border-top: 1px solid var(--line); }
.endpoint h2 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.endpoint-title { text-transform: uppercase; }
.endpoint-link { text-decoration: none; }

.status-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 18px; }
.status { display: flex; align-items: center; gap: 16px; padding: 11px 16px; border-radius: 9px; color: #fff; font-size: 14px; }
.status-code { font: 700 13px ui-monospace, monospace; min-width: 32px; opacity: 0.95; }
.status-ok { background: var(--ok); }
.status-client { background: var(--client); }
.status-server { background: var(--server); }

/* Código */
.code { position: relative; margin: 12px 0 18px; }
.code pre { margin: 0; padding: 16px 18px; background: var(--code-bg); color: var(--code-ink); border-radius: 10px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; border: 1px solid #1c2843; }
.copy { position: absolute; top: 8px; right: 8px; z-index: 2; padding: 4px 10px; border-radius: 7px; border: 1px solid #2a3a63; background: #131f30; color: #aab6ce; font-size: 12px; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy.done { color: #7ee2b0; border-color: #2f9e6e; }
.code-tabs { margin: 12px 0 18px; }
.code-tabs .code { margin: 0; }
.code-tabs .code pre { border-top-left-radius: 0; }
.tab-list { display: inline-flex; border: 1px solid var(--line); border-bottom: 0; border-radius: 9px 9px 0 0; overflow: hidden; background: var(--surface); }
.tab { padding: 7px 14px; border: 0; background: transparent; color: var(--brand); font: 600 13px Inter, ui-sans-serif, system-ui, sans-serif; cursor: pointer; }
.tab + .tab { border-left: 1px solid var(--line); }
.tab.active { background: linear-gradient(135deg, #4f6bed, #8b6eff); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* highlight.js con la paleta de la marca */
.hljs-keyword, .hljs-built_in, .hljs-selector-tag { color: #b49bff; }
.hljs-string, .hljs-attr-value { color: #8fd6b3; }
.hljs-attr, .hljs-property { color: #8fb1ff; }
.hljs-number, .hljs-literal { color: #f7b267; }
.hljs-comment { color: #6c7a99; font-style: italic; }
.hljs-title, .hljs-title.function_, .hljs-function { color: #7ad3ff; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: #e3e8f6; }
.hljs-meta { color: #a8b9ff; }

/* Paginación y pie */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }
.pager a span { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.pager .next { text-align: right; }
.pager a:hover { border-color: var(--brand); }
.footer { padding: 18px clamp(16px, 5vw, 64px); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); text-align: center; }
.footer a { color: var(--ink-2); }

/* ───────── Mobile ───────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(11, 18, 32, 0.45); }
  .main { margin-left: 0; }
  .menu { display: grid; }
  .lang { display: none; }
  .crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .anchor { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Link de un solo uso (credenciales) */
.reveal { margin: 18px 0; padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.reveal .switch { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.reveal .switch:disabled { opacity: 0.6; cursor: wait; }
.reveal-result p { margin: 14px 0 4px; }
.reveal-secret { color: #ffb4b4; }
