/* ============================================================================
   Centro Técnico SYSCOM — hoja de estilos complementaria
   Tailwind cubre el 95% del diseño. Aquí viven: variables, componentes
   reutilizables (@layer no está disponible con el CDN, así que se usan
   clases utilitarias en JS + estas reglas planas) y detalles finos.
   ========================================================================= */

:root {
  --brand: #1d4ed8;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --ring: rgba(29, 78, 216, 0.25);
}

html { scroll-behavior: smooth; }
body { font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif; }

/* Scrollbar discreta */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ── Navegación lateral ─────────────────────────────────────────────────── */
.nav-item {
  display: flex; align-items: center; gap: .625rem;
  padding: .5rem .75rem; border-radius: .5rem;
  font-size: .875rem; font-weight: 500; color: #334155;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: #f1f5f9; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -8px var(--brand); }
.nav-item.active .nav-count { background: rgba(255,255,255,.22); color: #fff; }
.nav-count {
  margin-left: auto; border-radius: 9999px; background: #f1f5f9;
  padding: .0625rem .4375rem; font-size: .6875rem; font-weight: 600; color: #64748b;
}
.nav-count:empty { display: none; }

/* ── Tarjetas ───────────────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem;
  box-shadow: 0 1px 2px 0 rgba(15,23,42,.04), 0 1px 3px 0 rgba(15,23,42,.06);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-hover:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px rgba(15,23,42,.25); border-color: #cbd5e1; }

/* ── Badges de disponibilidad ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: 9999px; padding: .1875rem .5rem;
  font-size: .6875rem; font-weight: 600; line-height: 1.25;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.badge-ok     { background: #ecfdf5; color: var(--ok);     border-color: #a7f3d0; }
.badge-warn   { background: #fffbeb; color: var(--warn);   border-color: #fde68a; }
.badge-danger { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.badge-info   { background: #eff6ff; color: var(--brand);  border-color: #bfdbfe; }
.badge-muted  { background: #f8fafc; color: #64748b;       border-color: #e2e8f0; }
.badge::before { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

/* ── Métodos HTTP ───────────────────────────────────────────────────────── */
.method {
  display: inline-block; min-width: 3.5rem; text-align: center;
  border-radius: .375rem; padding: .125rem .5rem;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: .6875rem; font-weight: 700; letter-spacing: .02em; color: #fff;
}
.method-GET    { background: #0284c7; }
.method-POST   { background: #059669; }
.method-PUT    { background: #d97706; }
.method-PATCH  { background: #7c3aed; }
.method-DELETE { background: #dc2626; }

/* ── Salud de fuentes ───────────────────────────────────────────────────── */
.health { font-size: .6875rem; font-weight: 600; }
.health-ok     { color: var(--ok); }
.health-warn   { color: var(--warn); }
.health-danger { color: var(--danger); }
.health-idle   { color: #94a3b8; }

/* ── Código / pre ───────────────────────────────────────────────────────── */
pre.code {
  background: #0f172a; color: #e2e8f0; border-radius: .625rem;
  padding: 1rem; overflow: auto; font-size: .78rem; line-height: 1.6;
  font-family: "JetBrains Mono", Consolas, monospace;
}
pre.code .k { color: #93c5fd; }
pre.code .s { color: #86efac; }

/* ── Formularios ────────────────────────────────────────────────────────── */
.field {
  width: 100%; border: 1px solid #e2e8f0; border-radius: .5rem;
  padding: .5rem .625rem; font-size: .8125rem; background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.field-mono { font-family: "JetBrains Mono", Consolas, monospace; font-size: .78rem; }
.label { display: block; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #64748b; margin-bottom: .25rem; }

/* ── Botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  border-radius: .5rem; padding: .5rem .875rem; font-size: .8125rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-ghost   { background: #fff; color: #334155; border-color: #e2e8f0; }
.btn-ghost:hover { border-color: #94a3b8; background: #f8fafc; }
.btn-danger  { background: #fef2f2; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Contenido de una guía (HTML de terceros, ya sanitizado) ────────────── */
.doc-html { font-size: .9375rem; line-height: 1.75; color: #334155; }
.doc-html > :first-child { margin-top: 0; }
.doc-html h1, .doc-html h2, .doc-html h3, .doc-html h4 {
  color: #0f172a; font-weight: 600; line-height: 1.3; margin: 1.4em 0 .5em;
}
.doc-html h1 { font-size: 1.25rem; }
.doc-html h2 { font-size: 1.0625rem; }
.doc-html h3, .doc-html h4 { font-size: .9375rem; }
.doc-html p { margin: .8em 0; }
.doc-html ul, .doc-html ol { margin: .8em 0; padding-left: 1.35rem; }
.doc-html ul { list-style: disc; }
.doc-html ol { list-style: decimal; }
.doc-html li { margin: .3em 0; }
.doc-html a { color: #1d4ed8; text-decoration: underline; text-underline-offset: 2px; }
.doc-html a:hover { color: #1e40af; }
.doc-html strong, .doc-html b { color: #0f172a; font-weight: 600; }
.doc-html img { max-width: 100%; height: auto; border-radius: .5rem; margin: .9em 0; border: 1px solid #e2e8f0; }
.doc-img { cursor: zoom-in; transition: opacity .15s; }
.doc-img:hover { opacity: .9; }
.doc-html code {
  background: #f1f5f9; color: #0f172a; padding: .1em .35em; border-radius: .375rem;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: .85em;
}
.doc-html pre { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: .625rem; overflow: auto; margin: .9em 0; }
.doc-html pre code { background: transparent; color: inherit; padding: 0; font-size: .8rem; }
.doc-html table { width: 100%; border-collapse: collapse; margin: .9em 0; font-size: .85rem; }
.doc-html th, .doc-html td { border: 1px solid #e2e8f0; padding: .45rem .6rem; text-align: left; vertical-align: top; }
.doc-html th { background: #f8fafc; font-weight: 600; color: #0f172a; }
.doc-html blockquote { border-left: 3px solid #cbd5e1; padding-left: .875rem; color: #475569; margin: .9em 0; }
.doc-html hr { border: 0; border-top: 1px solid #e2e8f0; margin: 1.25em 0; }

/* ── Utilidades ─────────────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 37%,#f1f5f9 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: .5rem; }
@keyframes sk { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

.fade-in { animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }

/* Tabla responsiva en móvil: se convierte en tarjetas */
@media (max-width: 768px) {
  table.responsive thead { display: none; }
  table.responsive tr { display: block; border: 1px solid #e2e8f0; border-radius: .75rem; margin-bottom: .625rem; background: #fff; }
  table.responsive td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .5rem .875rem; }
  table.responsive td::before { content: attr(data-label); font-weight: 600; color: #64748b; font-size: .75rem; }
}

@media print { header, aside, #toasts { display: none !important; } }
