/* ═══════════════════════════════════════════════
   NodoWA — Centro de Ayuda  (tema claro, minimalista)
   ═══════════════════════════════════════════════ */

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

:root {
  --font:        'Outfit', system-ui, -apple-system, sans-serif;
  --mono:        'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  --bg:          #ffffff;
  --bg-page:     #f8f9fa;
  --border:      #e5e7eb;
  --border-light:#f0f0f0;
  --text:        #111827;
  --text-muted:  #4b5563;
  --text-dim:    #9ca3af;
  --accent:      #7c3aed;
  --accent-light:#ede9fe;
  --accent-dim:  rgba(124,58,237,0.08);
  --green:       #059669;
  --green-bg:    #ecfdf5;
  --yellow-bg:   #fffbeb;
  --yellow-border:#fcd34d;
  --red-bg:      #fef2f2;
  --red-border:  #fecaca;
  --red:         #dc2626;
  --sidebar-w:   240px;
  --header-h:    56px;
  --radius:      8px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.65;
  font-size: 0.925rem;
}

/* ── HEADER ─────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 24px;
}
.header-logo { display: flex; align-items: center; flex-shrink: 0; }
.header-logo img { height: 22px; }
.header-search {
  flex: 1; max-width: 440px;
  position: relative;
}
.header-search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); pointer-events: none;
}
.header-search input {
  width: 100%;
  padding: 7px 36px 7px 34px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.87rem;
  color: var(--text);
  outline: none;
  transition: border 0.15s, background 0.15s;
}
.header-search input::placeholder { color: var(--text-dim); }
.header-search input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.header-search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-family: var(--font); font-size: 0.62rem; font-weight: 600;
  color: var(--text-dim);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 5px;
}
.header-nav {
  display: flex; gap: 20px; align-items: center; margin-left: auto;
}
.header-nav a {
  font-size: 0.83rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  transition: color 0.15s;
}
.header-nav a:hover { color: var(--text); }
.header-nav .btn-account {
  background: var(--accent); color: #fff;
  padding: 6px 14px; border-radius: 6px;
}
.header-nav .btn-account:hover { background: #6d28d9; color: #fff; }

/* ── LAYOUT ─────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h));
}

/* ── SIDEBAR ────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 24px 0 40px;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-section-label {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
  padding: 16px 20px 6px;
}
.sidebar-section-label:first-child { padding-top: 0; }

.sidebar nav a {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 20px;
  font-size: 0.83rem; font-weight: 500;
  color: var(--text-muted); text-decoration: none;
  border-right: 2px solid transparent;
  transition: color 0.12s, background 0.12s;
}
.sidebar nav a:hover { color: var(--text); background: var(--bg-page); }
.sidebar nav a.active {
  color: var(--accent); font-weight: 600;
  border-right-color: var(--accent);
  background: var(--accent-dim);
}
.sidebar nav a .dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
}

/* ── MAIN CONTENT ───────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 40px 48px 80px;
  max-width: 820px;
}

/* ── SEARCH RESULTS OVERLAY ─────────────────────── */
#search-results-area {
  display: none;
}
#search-results-area.visible {
  display: block;
}

/* ── SECTION ARTICLES ───────────────────────────── */
.doc-section {
  scroll-margin-top: calc(var(--header-h) + 16px);
  margin-bottom: 64px;
  padding-bottom: 48px;
  border-bottom: 1px solid var(--border-light);
}
.doc-section:last-child { border-bottom: none; }

.section-eyebrow {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.section-title {
  font-size: 1.45rem; font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  line-height: 1.25;
}
.section-lead {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.7;
}

/* ── HEADINGS within sections ───────────────────── */
.doc-section h3 {
  font-size: 1rem; font-weight: 700;
  color: var(--text);
  margin: 28px 0 10px;
  padding-top: 8px;
}
.doc-section h4 {
  font-size: 0.875rem; font-weight: 700;
  color: var(--text-muted);
  margin: 20px 0 8px;
  text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem;
}

/* ── PROSE ──────────────────────────────────────── */
.doc-section p { color: var(--text-muted); margin-bottom: 12px; line-height: 1.7; }
.doc-section ul, .doc-section ol {
  color: var(--text-muted);
  padding-left: 20px;
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 12px;
}
.doc-section li { line-height: 1.65; }
.doc-section strong { color: var(--text); }

/* ── CODE ───────────────────────────────────────── */
code {
  font-family: var(--mono);
  font-size: 0.82em;
  background: #f3f4f6;
  color: #4338ca;
  border-radius: 4px;
  padding: 1px 5px;
}
pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.825rem;
  line-height: 1.65;
  margin: 12px 0 20px;
}
pre code {
  background: none; color: inherit; padding: 0; font-size: inherit;
}

/* ── CALLOUT BOXES ──────────────────────────────── */
.callout {
  display: flex; gap: 12px;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.875rem;
  line-height: 1.6;
}
.callout svg { flex-shrink: 0; margin-top: 1px; }
.callout-info  { background: var(--accent-light); border: 1px solid rgba(124,58,237,0.2); }
.callout-info  svg { color: var(--accent); }
.callout-warn  { background: var(--yellow-bg); border: 1px solid var(--yellow-border); }
.callout-warn  svg { color: #d97706; }
.callout-good  { background: var(--green-bg); border: 1px solid #a7f3d0; }
.callout-good  svg { color: var(--green); }
.callout p { margin: 0; color: var(--text-muted); }
.callout strong { color: var(--text); }

/* ── STEP LIST ──────────────────────────────────── */
.steps { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.step  { display: flex; gap: 14px; }
.step-num {
  flex-shrink: 0;
  width: 24px; height: 24px;
  background: var(--accent); color: #fff;
  border-radius: 50%;
  font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
}
.step-body { flex: 1; color: var(--text-muted); line-height: 1.6; }
.step-body strong { color: var(--text); }

/* ── API REFERENCE TABLE ────────────────────────── */
.api-table { width: 100%; border-collapse: collapse; margin: 12px 0 24px; font-size: 0.84rem; }
.api-table th {
  text-align: left;
  padding: 8px 12px;
  background: #f3f4f6;
  border: 1px solid var(--border);
  font-weight: 700; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
}
.api-table td {
  padding: 9px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}
.api-table tr:hover td { background: var(--bg-page); }
.api-table td:first-child code { color: var(--accent); font-size: 0.82rem; }
.type-badge {
  font-family: var(--mono); font-size: 0.75rem;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid #a7f3d0;
  border-radius: 4px; padding: 1px 6px;
}

/* ── PERMISSION CARDS ───────────────────────────── */
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 20px; }
.perm-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.perm-card code { font-size: 0.82rem; color: var(--accent); background: var(--accent-dim); }
.perm-card p { font-size: 0.8rem; color: var(--text-muted); margin: 6px 0 0; }

/* ── SPEC TABLE ─────────────────────────────────── */
.spec-row {
  display: flex; align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}
.spec-row:last-child { border-bottom: none; }
.spec-label { font-weight: 600; color: var(--text); min-width: 180px; flex-shrink: 0; }
.spec-val   { color: var(--text-muted); }

/* ── ERROR GRID ─────────────────────────────────── */
.error-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.error-item {
  background: var(--red-bg); border: 1px solid var(--red-border);
  border-radius: var(--radius); padding: 12px 14px;
}
.error-item code { color: var(--red); background: transparent; padding: 0; }
.error-item p { font-size: 0.8rem; margin: 4px 0 0; }

/* ── NO RESULTS ─────────────────────────────────── */
.no-results {
  display: none;
  flex-direction: column; align-items: center; gap: 12px;
  padding: 60px 24px; color: var(--text-muted);
  font-size: 0.9rem; text-align: center;
}
.no-results.visible { display: flex; }

/* ── CONTACT BOX ────────────────────────────────── */
.contact-box {
  background: var(--accent-dim);
  border: 1px solid rgba(124,58,237,0.18);
  border-radius: 12px;
  padding: 32px 36px;
  text-align: center;
  margin: 64px 0 0;
}
.contact-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.contact-box p  { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 20px; }
.contact-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: 6px;
  font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  text-decoration: none; transition: all 0.12s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6d28d9; }
.btn-ghost {
  background: #fff; color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); }

/* ── FOOTER ─────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 20px 48px;
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
}
.footer-logo img { height: 18px; opacity: 0.5; }
.footer-copy { font-size: 0.78rem; color: var(--text-dim); }
.footer-links { display: flex; gap: 18px; margin-left: auto; }
.footer-links a { font-size: 0.78rem; color: var(--text-dim); text-decoration: none; }
.footer-links a:hover { color: var(--text-muted); }

/* ── SEARCH RESULT ITEMS ────────────────────────── */
.search-result-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
}
.search-result-item:hover .sr-title { color: var(--accent); }
.sr-section { font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 3px; }
.sr-title { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.sr-snippet { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.sr-snippet mark { background: #fef9c3; color: var(--text); border-radius: 2px; padding: 0 2px; }

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 24px 20px 60px; }
  .perm-grid { grid-template-columns: 1fr; }
  .header-nav .btn-account { display: none; }
  footer { padding: 20px; }
  footer .footer-links { margin-left: 0; }
}
@media (max-width: 500px) {
  .section-title { font-size: 1.2rem; }
  pre { padding: 12px 14px; font-size: 0.78rem; }
}
