/* ==========================================================================
   Sunize API Docs — design system compartilhado (index.html + v2.html)
   ========================================================================== */

:root {
  /* ---- Light (default) ---- */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f7f9;
  --bg-tertiary: #ebedf1;
  --bg-hover: #eef0f4;
  --bg-card: #ffffff;
  --bg-code: #0d1117;
  --bg-code-header: #161b22;

  --text-primary: #0f1420;
  --text-secondary: #4b5565;
  --text-tertiary: #8791a1;
  --text-code: #e6edf3;
  --text-on-accent: #ffffff;

  --accent-primary: #2f5fdb;
  --accent-secondary: #4d78e8;
  --accent-tertiary: #7f9df0;
  --accent-soft: rgba(47, 95, 219, 0.1);
  --accent-soft-strong: rgba(47, 95, 219, 0.16);

  --success: #0f9d58;
  --success-soft: rgba(15, 157, 88, 0.12);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --error: #d92d20;
  --error-soft: rgba(217, 45, 32, 0.1);
  --info: #0e7490;
  --info-soft: rgba(14, 116, 144, 0.12);

  --border-color: #e3e6eb;
  --border-color-strong: #d1d5db;
  --divider-color: #e3e6eb;

  --json-key: #7c3aed;
  --json-string: #0e7490;
  --json-number: #15803d;
  --json-boolean: #b45309;
  --json-null: #be185d;
  --json-bracket: #6b7280;
  --json-comment: #9aa4b2;

  --method-get: #0f9d58;
  --method-post: #4d78e8;
  --method-delete: #d92d20;
  --method-put: #b45309;

  --header-height: 64px;
  --sidebar-width: 288px;
  --content-max-width: 820px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(15, 20, 32, 0.04), 0 8px 24px rgba(15, 20, 32, 0.06);
  --shadow-popover: 0 12px 40px rgba(15, 20, 32, 0.16);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);

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

  color-scheme: light;
}

/* Dark: segue o sistema por padrão... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg-primary: #0a0e16;
    --bg-secondary: #10151f;
    --bg-tertiary: #1a212f;
    --bg-hover: #1e2635;
    --bg-card: #10151f;
    --bg-code: #080b11;
    --bg-code-header: #0d1119;

    --text-primary: #f2f4f8;
    --text-secondary: #aab2c2;
    --text-tertiary: #6d7688;
    --text-code: #e6edf3;

    --accent-primary: #5b8bf0;
    --accent-secondary: #7ea2f4;
    --accent-tertiary: #a9c1f7;
    --accent-soft: rgba(91, 139, 240, 0.14);
    --accent-soft-strong: rgba(91, 139, 240, 0.22);

    --success: #34c07f;
    --success-soft: rgba(52, 192, 127, 0.14);
    --warning: #f0a83c;
    --warning-soft: rgba(240, 168, 60, 0.14);
    --error: #f16a63;
    --error-soft: rgba(241, 106, 99, 0.14);
    --info: #4fc4dd;
    --info-soft: rgba(79, 196, 221, 0.14);

    --border-color: #232b3a;
    --border-color-strong: #313c4f;
    --divider-color: #232b3a;

    --json-key: #b39ef3;
    --json-string: #6fd3e8;
    --json-number: #6fdd9a;
    --json-boolean: #f0c168;
    --json-null: #f28fb8;
    --json-bracket: #8b93a5;
    --json-comment: #6d7688;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.32);
    --shadow-popover: 0 16px 48px rgba(0, 0, 0, 0.45);

    color-scheme: dark;
  }
}

/* ...e uma escolha manual (persistida) sempre vence, nos dois sentidos */
:root[data-theme='dark'] {
  --bg-primary: #0a0e16;
  --bg-secondary: #10151f;
  --bg-tertiary: #1a212f;
  --bg-hover: #1e2635;
  --bg-card: #10151f;
  --bg-code: #080b11;
  --bg-code-header: #0d1119;

  --text-primary: #f2f4f8;
  --text-secondary: #aab2c2;
  --text-tertiary: #6d7688;
  --text-code: #e6edf3;

  --accent-primary: #5b8bf0;
  --accent-secondary: #7ea2f4;
  --accent-tertiary: #a9c1f7;
  --accent-soft: rgba(91, 139, 240, 0.14);
  --accent-soft-strong: rgba(91, 139, 240, 0.22);

  --success: #34c07f;
  --success-soft: rgba(52, 192, 127, 0.14);
  --warning: #f0a83c;
  --warning-soft: rgba(240, 168, 60, 0.14);
  --error: #f16a63;
  --error-soft: rgba(241, 106, 99, 0.14);
  --info: #4fc4dd;
  --info-soft: rgba(79, 196, 221, 0.14);

  --border-color: #232b3a;
  --border-color-strong: #313c4f;
  --divider-color: #232b3a;

  --json-key: #b39ef3;
  --json-string: #6fd3e8;
  --json-number: #6fdd9a;
  --json-boolean: #f0c168;
  --json-null: #f28fb8;
  --json-bracket: #8b93a5;
  --json-comment: #6d7688;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.32);
  --shadow-popover: 0 16px 48px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

/* ---------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition), color var(--transition);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}
h1 {
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.5rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
h2 .icon {
  color: var(--accent-primary);
  font-size: 1.3rem;
}
h3 {
  font-size: 1.1rem;
  margin-top: 1.75rem;
}
p {
  color: var(--text-secondary);
  margin: 0 0 1.1rem;
}
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--text-primary);
}

ul,
ol {
  color: var(--text-secondary);
  margin: 0 0 1.1rem 1.3rem;
  padding: 0;
}
li {
  margin-bottom: 0.4rem;
}

/* ---------------------------- Header ---------------------------- */
.header {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
}
.header-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  flex-shrink: 0;
}
.header-logo svg {
  flex-shrink: 0;
}
.header-search {
  flex: 1;
  max-width: 380px;
  position: relative;
  display: none;
}
.header-search input {
  width: 100%;
  height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0 0.75rem 0 2.25rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.header-search input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-primary);
}
.header-search .icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}
.header-search kbd {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border-radius: 4px;
  padding: 0.15rem 0.35rem;
  pointer-events: none;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.version-switcher {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  background: var(--bg-tertiary);
  border-radius: 999px;
  padding: 0.2rem;
}
.version-switcher a {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-decoration: none;
}
.version-switcher a:hover {
  color: var(--text-primary);
}
.version-switcher a.active {
  background: var(--accent-primary);
  color: var(--text-on-accent);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.theme-toggle .ri-sun-line,
.theme-toggle .ri-moon-line {
  display: none;
}
:root:not([data-theme='dark']) .theme-toggle .ri-sun-line {
  display: block;
}
:root[data-theme='dark'] .theme-toggle .ri-moon-line {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .ri-sun-line {
    display: none;
  }
  :root:not([data-theme]) .theme-toggle .ri-moon-line {
    display: block;
  }
}

.mobile-menu-toggle {
  display: none;
}

/* ---------------------------- Layout ---------------------------- */
.layout {
  display: flex;
  padding-top: var(--header-height);
  max-width: 1400px;
  margin: 0 auto;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: fixed;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  overflow-y: auto;
  padding: 1.5rem 1rem 3rem;
  scrollbar-width: thin;
}
.sidebar-group {
  margin-bottom: 1.5rem;
}
.sidebar-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 0 0.75rem;
  margin-bottom: 0.4rem;
}
.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-nav li {
  margin: 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.44rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.sidebar-nav a .icon {
  font-size: 0.95rem;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  text-decoration: none;
}
.sidebar-nav a.active {
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-weight: 650;
}
.sidebar-nav a.active .icon {
  color: var(--accent-primary);
}
.sidebar-nav .badge-new {
  margin-left: auto;
}
.sidebar-hidden {
  display: none !important;
}

.content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 2.5rem 3rem 6rem;
  max-width: calc(var(--content-max-width) + 6rem);
}

.section {
  margin-bottom: 4rem;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}
.section-intro {
  max-width: var(--content-max-width);
}

.divider {
  height: 1px;
  background: var(--divider-color);
  border: none;
  margin: 3rem 0;
}

/* ---------------------------- Hero ---------------------------- */
.hero {
  padding: 0.5rem 0 1rem;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--accent-primary);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.hero h1 {
  max-width: 640px;
}
.hero-lead {
  font-size: 1.05rem;
  max-width: 620px;
}
.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 0.5rem;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: var(--accent-primary);
  color: var(--text-on-accent);
}
.btn-primary:hover {
  background: var(--accent-secondary);
}
.btn-outline {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-color-strong);
}

/* ---------------------------- Cards ---------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-card);
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}
.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}
.card-title {
  font-size: 1rem;
  font-weight: 650;
  margin: 0;
  color: var(--text-primary);
}
.card p:last-child {
  margin-bottom: 0;
}
.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* --------------------------- Changelog list --------------------------- */
.changelog {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.changelog li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin: 0;
}
.changelog .icon {
  color: var(--success);
  font-size: 1.1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}
.changelog strong {
  color: var(--text-primary);
}

/* ---------------------------- Endpoint header ---------------------------- */
.endpoint {
  background: var(--bg-code);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.85rem 1.2rem;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  overflow-x: auto;
  color: var(--text-code);
}
.method {
  flex-shrink: 0;
  padding: 0.2rem 0.65rem;
  border-radius: 5px;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: #fff;
}
.method.get {
  background: var(--method-get);
}
.method.post {
  background: var(--method-post);
}
.method.delete {
  background: var(--method-delete);
}
.method.put {
  background: var(--method-put);
}

/* ---------------------------- Code blocks + tabs ---------------------------- */
.code-container {
  margin: 1.4rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-code-header);
  padding: 0.15rem 0.6rem 0.15rem 0.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.code-tabs {
  display: flex;
  gap: 0.1rem;
}
.code-tab {
  background: none;
  border: none;
  color: #8b93a5;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast);
}
.code-tab:hover {
  color: #cbd5e1;
}
.code-tab.active {
  color: #f2f4f8;
  border-bottom-color: var(--accent-primary);
}
.copy-button {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  color: #cbd5e1;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.copy-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.code-panel {
  display: none;
}
.code-panel.active {
  display: block;
}
pre {
  background: var(--bg-code);
  color: var(--text-code);
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  margin: 0;
  tab-size: 2;
}
.code-container pre {
  border-radius: 0;
}
pre.standalone {
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin: 1.25rem 0;
}

.json-key {
  color: var(--json-key);
}
.json-string {
  color: var(--json-string);
}
.json-number {
  color: var(--json-number);
}
.json-boolean {
  color: var(--json-boolean);
}
.json-null {
  color: var(--json-null);
}
.json-bracket {
  color: var(--json-bracket);
}
.json-comment {
  color: var(--json-comment);
}

/* ---------------------------- Tables ---------------------------- */
.table-container {
  margin: 1.4rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
th,
td {
  padding: 0.75rem 1.1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}
th {
  background: var(--bg-secondary);
  font-weight: 650;
  color: var(--text-primary);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
tr:last-child td {
  border-bottom: none;
}
td .property {
  display: block;
  margin-bottom: 0.15rem;
}

/* ---------------------------- Notes / badges ---------------------------- */
.note {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent-primary);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.note strong {
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 650;
}
.note.warning {
  background: var(--warning-soft);
  border-left-color: var(--warning);
}
.note.success {
  background: var(--success-soft);
  border-left-color: var(--success);
}

.property {
  font-family: var(--font-mono);
  font-size: 0.84em;
  color: var(--accent-primary);
  font-weight: 600;
}
.type {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  background: var(--bg-tertiary);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 650;
}
.badge-pending {
  background: var(--info-soft);
  color: var(--info);
}
.badge-authorized,
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-failed {
  background: var(--error-soft);
  color: var(--error);
}
.badge-chargeback,
.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge-refunded {
  background: var(--accent-soft);
  color: var(--accent-primary);
}
.badge-new {
  background: var(--success-soft);
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.62rem;
}

/* ---------------------------- Footer nav (prev/next) ---------------------------- */
.page-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
}
.page-nav a {
  flex: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  text-decoration: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.page-nav a:hover {
  border-color: var(--border-color-strong);
  background: var(--bg-hover);
  text-decoration: none;
}
.page-nav-label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-bottom: 0.2rem;
}
.page-nav-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--text-primary);
}
.page-nav-next {
  text-align: right;
}

/* ---------------------------- Responsive ---------------------------- */
@media (min-width: 900px) {
  .header-search {
    display: block;
  }
}

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  .content {
    padding: 2rem 2rem 5rem;
  }
}

@media (max-width: 840px) {
  .mobile-menu-toggle {
    display: inline-flex;
  }
  .sidebar {
    transform: translateX(-100%);
    z-index: 90;
    background: var(--bg-primary);
    width: 280px;
    border-right: 1px solid var(--border-color);
    transition: transform var(--transition);
    box-shadow: var(--shadow-popover);
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: var(--header-height) 0 0 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 80;
  }
  .sidebar-backdrop.active {
    display: block;
  }
  .content {
    margin-left: 0;
    padding: 1.5rem 1.25rem 4rem;
  }
  h1 {
    font-size: 1.8rem;
  }
  .header {
    padding: 0 1rem;
  }
}
