/* ======================================================
   InvCompu API — Documentación
   ====================================================== */

:root {
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #38bdf8;
  --sidebar-hover: #1e293b;
  --sidebar-section: #475569;
  --content-bg: #f8fafc;
  --content-text: #1e293b;
  --surface: #ffffff;
  --border: #e2e8f0;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;

  --get: #16a34a;
  --get-bg: #dcfce7;
  --post: #2563eb;
  --post-bg: #dbeafe;
  --put: #d97706;
  --put-bg: #fef3c7;
  --delete: #dc2626;
  --delete-bg: #fee2e2;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
  --radius: 8px;
  --sidebar-width: 270px;
  --header-height: 60px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--content-bg);
  color: var(--content-text);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform .3s;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.sidebar-logo {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #1e293b;
}

.sidebar-logo a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo .logo-title {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.sidebar-logo .logo-version {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-section {
  padding: 8px 24px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-section);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-nav a.active {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
}

.sidebar-nav a .nav-icon {
  font-size: 15px;
  opacity: .75;
  flex-shrink: 0;
}

.sidebar-nav .sub-link {
  padding-left: 40px;
  font-size: 13px;
  font-weight: 400;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid #1e293b;
  font-size: 12px;
  color: #475569;
  text-align: center;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ── Mobile menu button ── */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--content-text);
  border-radius: 6px;
}
.mobile-menu-btn:hover { background: #f1f5f9; }

/* ── Main layout ── */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top header ── */
.top-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 40px;
  position: sticky;
  top: 0;
  z-index: 90;
  gap: 16px;
}

.top-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--content-text);
  flex: 1;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ── Page content ── */
.page-content {
  padding: 40px;
  max-width: 960px;
}

/* ── Section blocks ── */
.section {
  margin-bottom: 56px;
}

.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--content-text);
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.section-subtitle {
  font-size: 16px;
  color: #64748b;
  margin-bottom: 24px;
}

/* ── Info cards on index ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
}

.card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}

.card-icon.blue  { background: #eff6ff; }
.card-icon.green { background: #f0fdf4; }
.card-icon.purple{ background: #faf5ff; }

.card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.card p  { font-size: 13.5px; color: #64748b; line-height: 1.5; margin-bottom: 16px; }

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.card-link:hover { text-decoration: underline; }

/* ── Endpoint block ── */
.endpoint-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.endpoint-header:hover { background: #f8fafc; }

.method-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .05em;
  min-width: 60px;
  text-align: center;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.method-badge.GET    { background: var(--get-bg);    color: var(--get);    }
.method-badge.POST   { background: var(--post-bg);   color: var(--post);   }
.method-badge.PUT    { background: var(--put-bg);    color: var(--put);    }
.method-badge.DELETE { background: var(--delete-bg); color: var(--delete); }

.endpoint-path {
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--content-text);
  flex: 1;
}

.endpoint-desc {
  font-size: 13px;
  color: #64748b;
}

.endpoint-body {
  border-top: 1px solid var(--border);
  padding: 20px;
  display: none;
  background: #fafbfc;
}

.endpoint-body.open { display: block; }

/* ── Auth badge ── */
.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.auth-badge.login { background: #fef3c7; color: #92400e; }
.auth-badge.admin { background: #fee2e2; color: #b91c1c; }
.auth-badge.public { background: #dcfce7; color: #15803d; }

/* ── Params / fields table ── */
.params-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  margin-bottom: 8px;
  margin-top: 16px;
}

.params-title:first-child { margin-top: 0; }

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.params-table th {
  text-align: left;
  padding: 8px 12px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.params-table td {
  padding: 9px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  background: var(--surface);
}

.params-table tr:nth-child(even) td { background: #f8fafc; }

.field-name {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
}

.field-type {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  color: #0891b2;
  background: #ecfeff;
  padding: 1px 6px;
  border-radius: 4px;
}

.badge-required {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #fee2e2;
  color: #b91c1c;
}

.badge-optional {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
}

.badge-readonly {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: #fef9c3;
  color: #854d0e;
}

/* ── Code blocks ── */
.code-block {
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 16px;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #0f172a;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.code-body {
  background: var(--code-bg);
  padding: 16px;
  overflow-x: auto;
}

.code-body pre {
  margin: 0;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--code-text);
  white-space: pre;
}

/* JSON syntax */
.json-key    { color: #93c5fd; }
.json-str    { color: #86efac; }
.json-num    { color: #fda4af; }
.json-bool   { color: #fdba74; }
.json-null   { color: #94a3b8; }
.json-punc   { color: #e2e8f0; }
.json-url    { color: #67e8f9; }

/* ── Response codes ── */
.response-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 16px;
}

.response-code {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
}

.response-code.r200, .response-code.r201 { background: #dcfce7; color: #15803d; }
.response-code.r400, .response-code.r404 { background: #fee2e2; color: #b91c1c; }
.response-code.r401 { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.response-code.r403 { background: #fce7f3; color: #9d174d; border: 1px solid #f9a8d4; }
.response-code.r409 { background: #ffedd5; color: #c2410c; border: 1px solid #fdba74; }
.response-code.r500 { background: #f1f5f9; color: #475569; }

/* ── Callouts ── */
.callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 1.6;
}

.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.callout.info    { background: #eff6ff; border-left: 4px solid #3b82f6; color: #1e3a5f; }
.callout.warning { background: #fffbeb; border-left: 4px solid #f59e0b; color: #78350f; }
.callout.success { background: #f0fdf4; border-left: 4px solid #22c55e; color: #14532d; }

/* ── Model schema block ── */
.model-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.model-header {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-header h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--content-text);
}

.model-header .db-table {
  font-size: 12px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.model-body { padding: 0; }

/* ── Pagination info ── */
.pagination-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}

.pagination-info h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

/* ── Stats row ── */
.stats-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  box-shadow: var(--shadow-sm);
  text-align: center;
  min-width: 120px;
}

.stat-box .stat-num {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-box .stat-label {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat-box.blue   .stat-num { color: #2563eb; }
.stat-box.green  .stat-num { color: #16a34a; }
.stat-box.purple .stat-num { color: #7c3aed; }
.stat-box.orange .stat-num { color: #d97706; }

/* ── Expand toggle ── */
.toggle-arrow {
  margin-left: auto;
  font-size: 12px;
  color: #94a3b8;
  transition: transform .2s;
}

.endpoint-header.open .toggle-arrow { transform: rotate(90deg); }

/* ── Anchor offset for sticky header ── */
[id] { scroll-margin-top: calc(var(--header-height) + 16px); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 24px 20px; }
  .top-header { padding: 0 20px; }
  .mobile-menu-btn { display: block; }
  .endpoint-header { flex-wrap: wrap; }
  .endpoint-desc { width: 100%; margin-top: 4px; }
}
