/* ============================================================
   TopoApp — Manual de usuario
   Estilo: Supabase docs inspirado, paleta TopoApp
   ============================================================ */

:root {
  --man-orange:      #d9692b;
  --man-orange-dk:   #bf5820;
  --man-orange-lt:   #fff7ed;
  --man-bg:          #fafaf9;
  --man-surface:     #ffffff;
  --man-sidebar-w:   268px;
  --man-topbar-h:    60px;
  --man-text:        #1c1917;
  --man-muted:       #78716c;
  --man-border:      #e7e5e4;
  --man-code-bg:     #f5f4f3;
  --man-tip-bg:      #f0fdf4;
  --man-tip-border:  #22c55e;
  --man-warn-bg:     #fffbeb;
  --man-warn-border: #f59e0b;
  --man-info-bg:     #fff7ed;
  --man-info-border: #d9692b;
  --man-radius:      10px;
}

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

body.manual-body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--man-bg);
  color: var(--man-text);
  font-size: 15px;
  line-height: 1.7;
}

/* ── TOP BAR ──────────────────────────────────────────────── */
.man-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--man-topbar-h);
  background: var(--man-surface);
  border-bottom: 1px solid var(--man-border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: .75rem;
  z-index: 200;
}

.man-topbar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  color: var(--man-text);
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
  letter-spacing: -.015em;
}

.man-topbar-brand:hover { color: var(--man-text); text-decoration: none; }

.man-topbar-brand img {
  height: 28px;
  width: auto;
  border-radius: 6px;
}

.man-topbar-badge {
  font-size: .62rem;
  background: var(--man-orange);
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.man-topbar-divider {
  width: 1px;
  height: 22px;
  background: var(--man-border);
  flex-shrink: 0;
}

.man-topbar-title {
  font-size: .85rem;
  color: var(--man-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.man-topbar-spacer { flex: 1; }

.man-topbar-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  text-decoration: none;
  color: var(--man-muted);
  padding: .4rem .85rem;
  border-radius: 7px;
  border: 1px solid var(--man-border);
  transition: all .2s;
  white-space: nowrap;
}

.man-topbar-link:hover {
  color: var(--man-orange);
  border-color: var(--man-orange);
  background: var(--man-orange-lt);
  text-decoration: none;
}

.man-burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--man-text);
  font-size: 1.4rem;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background .15s;
  flex-shrink: 0;
}

.man-burger:hover { background: var(--man-code-bg); }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.man-sidebar {
  position: fixed;
  top: var(--man-topbar-h);
  left: 0;
  bottom: 0;
  width: var(--man-sidebar-w);
  background: var(--man-surface);
  border-right: 1px solid var(--man-border);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.5rem 0 3rem;
  z-index: 100;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.man-sidebar::-webkit-scrollbar { width: 3px; }
.man-sidebar::-webkit-scrollbar-track { background: transparent; }
.man-sidebar::-webkit-scrollbar-thumb { background: var(--man-border); border-radius: 4px; }

.man-nav-section {
  padding: .6rem 1.25rem .3rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--man-muted);
  margin-top: .5rem;
}

.man-nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem 1.25rem;
  text-decoration: none;
  color: #57534e;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: all .15s;
  line-height: 1.4;
  margin: 1px 0;
}

.man-nav-link i {
  font-size: .95rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}

.man-nav-link:hover {
  color: var(--man-text);
  background: #f5f4f3;
  border-left-color: #d6d3d1;
  text-decoration: none;
}

.man-nav-link.active {
  color: var(--man-orange);
  border-left-color: var(--man-orange);
  background: var(--man-orange-lt);
  font-weight: 600;
}

.man-nav-link.active:hover {
  color: var(--man-orange-dk);
  background: #feeddc;
}

.man-nav-divider {
  height: 1px;
  background: var(--man-border);
  margin: 1rem 1.25rem;
}

/* ── SIDEBAR OVERLAY ──────────────────────────────────────── */
.man-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.42);
  z-index: 99;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ── CONTENT AREA ──────────────────────────────────────────── */
.man-content-wrap {
  margin-left: var(--man-sidebar-w);
  margin-top: var(--man-topbar-h);
  min-height: calc(100vh - var(--man-topbar-h));
  padding: 3rem 3rem 5rem;
}

.man-page {
  max-width: 780px;
}

/* ── BREADCRUMB ───────────────────────────────────────────── */
.man-breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  color: var(--man-muted);
  margin-bottom: 1.5rem;
}

.man-breadcrumb a {
  color: var(--man-muted);
  text-decoration: none;
}

.man-breadcrumb a:hover { color: var(--man-orange); }

.man-breadcrumb i { font-size: .65rem; }

/* ── TYPOGRAPHY ───────────────────────────────────────────── */
.man-page h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--man-text);
  line-height: 1.2;
  letter-spacing: -.03em;
  margin-bottom: .6rem;
}

.man-lead {
  font-size: 1.05rem;
  color: var(--man-muted);
  margin-bottom: 2.5rem;
  line-height: 1.65;
}

.man-page h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--man-text);
  margin-top: 2.75rem;
  margin-bottom: .8rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--man-border);
  scroll-margin-top: 80px;
  letter-spacing: -.02em;
}

.man-page h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--man-text);
  margin-top: 1.75rem;
  margin-bottom: .5rem;
  scroll-margin-top: 80px;
}

.man-page p { margin-bottom: .9rem; }

.man-page ul,
.man-page ol { padding-left: 1.5rem; margin-bottom: 1rem; }

.man-page li { margin-bottom: .4rem; }

.man-page a { color: var(--man-orange); text-decoration: none; }
.man-page a:hover { text-decoration: underline; }

.man-page strong { color: var(--man-text); }

/* ── CALL-OUT BOXES ───────────────────────────────────────── */
.man-callout {
  border-radius: var(--man-radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
  display: flex;
  gap: .8rem;
}

.man-callout > i {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: .1rem;
}

.man-callout-body { flex: 1; }

.man-callout-title {
  font-weight: 700;
  font-size: .875rem;
  margin-bottom: .3rem;
}

.man-callout-body p { margin: 0; font-size: .9rem; }

.man-callout--tip {
  background: var(--man-tip-bg);
  border-color: var(--man-tip-border);
}
.man-callout--tip > i,
.man-callout--tip .man-callout-title { color: #16a34a; }

.man-callout--warn {
  background: var(--man-warn-bg);
  border-color: var(--man-warn-border);
}
.man-callout--warn > i,
.man-callout--warn .man-callout-title { color: #d97706; }

.man-callout--info {
  background: var(--man-info-bg);
  border-color: var(--man-info-border);
}
.man-callout--info > i,
.man-callout--info .man-callout-title { color: var(--man-orange); }

/* ── STEP LIST ────────────────────────────────────────────── */
.man-steps { list-style: none; padding: 0; margin: 1.75rem 0; }

.man-step {
  display: flex;
  gap: 1.1rem;
  margin-bottom: 1.75rem;
  position: relative;
}

.man-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 17px;
  top: 40px;
  bottom: -1.75rem;
  width: 2px;
  background: var(--man-border);
}

.man-step-num {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--man-orange);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .9rem;
  position: relative;
  z-index: 1;
}

.man-step-body { flex: 1; padding-top: .3rem; }

.man-step-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .35rem;
  color: var(--man-text);
}

.man-step-body p {
  margin: 0;
  font-size: .9rem;
  color: #57534e;
}

.man-step-body p + p { margin-top: .5rem; }

/* ── CODE ─────────────────────────────────────────────────── */
.man-page code {
  background: var(--man-code-bg);
  padding: .17em .45em;
  border-radius: 5px;
  font-size: .84em;
  font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  color: var(--man-orange-dk);
  border: 1px solid var(--man-border);
}

.man-page pre {
  background: #1c1917;
  border-radius: var(--man-radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid #292524;
}

.man-page pre code {
  background: none;
  padding: 0;
  color: #e7e5e4;
  font-size: .85rem;
  line-height: 1.6;
  border: none;
}

/* ── FEATURE / SECTION CARDS ──────────────────────────────── */
.man-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.man-card {
  background: var(--man-surface);
  border: 1.5px solid var(--man-border);
  border-radius: var(--man-radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--man-text);
  transition: all .22s;
  display: block;
}

.man-card:hover {
  border-color: var(--man-orange);
  box-shadow: 0 6px 24px rgba(217,105,43,.14);
  transform: translateY(-2px);
  color: var(--man-text);
  text-decoration: none;
}

.man-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--man-orange-lt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--man-orange);
  margin-bottom: .85rem;
}

.man-card h4 {
  font-size: .95rem;
  font-weight: 700;
  margin-bottom: .3rem;
  letter-spacing: -.01em;
}

.man-card p {
  font-size: .8rem;
  color: var(--man-muted);
  margin: 0;
  line-height: 1.5;
}

/* ── STATE FLOW ───────────────────────────────────────────── */
.man-state-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  background: var(--man-code-bg);
  border-radius: var(--man-radius);
  border: 1px solid var(--man-border);
}

.man-state {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}

.man-state--orange { background: #fff7ed; color: #c2410c; border: 1.5px solid #fdba74; }
.man-state--blue   { background: #eff6ff; color: #1d4ed8; border: 1.5px solid #93c5fd; }
.man-state--green  { background: #f0fdf4; color: #15803d; border: 1.5px solid #86efac; }
.man-state--gray   { background: #f5f5f4; color: #57534e; border: 1.5px solid #d6d3d1; }
.man-state--red    { background: #fef2f2; color: #b91c1c; border: 1.5px solid #fca5a5; }
.man-state--purple { background: #faf5ff; color: #7c3aed; border: 1.5px solid #c4b5fd; }

.man-state-arrow { color: var(--man-muted); font-size: .8rem; }

/* ── TABLE ────────────────────────────────────────────────── */
.man-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--man-radius);
  border: 1px solid var(--man-border);
}

.man-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.man-table th {
  background: var(--man-code-bg);
  padding: .65rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--man-muted);
  border-bottom: 1px solid var(--man-border);
}

.man-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--man-border);
  vertical-align: top;
}

.man-table tr:last-child td { border-bottom: none; }

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

/* ── SCREENSHOT / MEDIA ───────────────────────────────────── */
.man-screenshot {
  border-radius: var(--man-radius);
  border: 2px solid var(--man-border);
  overflow: hidden;
  margin: 1.5rem 0;
  box-shadow: 0 4px 20px rgba(0,0,0,.07);
}

.man-screenshot img { width: 100%; display: block; }

.man-screenshot-ph {
  background: var(--man-code-bg);
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--man-muted);
  font-size: .85rem;
  gap: .5rem;
}

.man-screenshot-ph i { font-size: 2rem; }

/* ── NAVIGATION FOOTER ────────────────────────────────────── */
.man-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--man-border);
}

.man-nav-btn {
  padding: .9rem 1.25rem;
  border: 1.5px solid var(--man-border);
  border-radius: var(--man-radius);
  text-decoration: none;
  color: var(--man-text);
  transition: all .2s;
  display: flex;
  flex-direction: column;
}

.man-nav-btn:hover {
  border-color: var(--man-orange);
  color: var(--man-orange-dk);
  background: var(--man-orange-lt);
  text-decoration: none;
}

.man-nav-btn--next {
  text-align: right;
  grid-column: 2;
}

.man-nav-btn-label {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--man-muted);
  margin-bottom: .2rem;
}

.man-nav-btn-title {
  font-size: .95rem;
  font-weight: 600;
}

/* ── INLINE BADGES ────────────────────────────────────────── */
.man-badge {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  line-height: 1.4;
}

.man-badge--orange { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.man-badge--green  { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.man-badge--blue   { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.man-badge--gray   { background: #f5f5f4; color: #57534e; border: 1px solid #d6d3d1; }
.man-badge--red    { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ── DIVIDER ──────────────────────────────────────────────── */
.man-divider {
  height: 1px;
  background: var(--man-border);
  margin: 2rem 0;
}

/* ── MOBILE RESPONSIVE ────────────────────────────────────── */
@media (max-width: 900px) {
  .man-burger { display: block; }

  .man-sidebar {
    transform: translateX(-100%);
    z-index: 101;
    box-shadow: 4px 0 30px rgba(0,0,0,.15);
  }

  .man-sidebar.open { transform: translateX(0); }

  .man-sidebar-overlay.open { display: block; }

  .man-content-wrap {
    margin-left: 0;
    padding: 2rem 1.25rem 4rem;
  }

  .man-topbar-divider,
  .man-topbar-title { display: none; }

  .man-topbar-link span { display: none; }

  .man-topbar-link {
    padding: .4rem .6rem;
    border-radius: 7px;
  }

  .man-cards { grid-template-columns: 1fr 1fr; }

  .man-page h1 { font-size: 1.7rem; }
}

@media (max-width: 520px) {
  .man-cards { grid-template-columns: 1fr; }
  .man-nav-footer { grid-template-columns: 1fr; }
  .man-nav-btn--next { grid-column: 1; text-align: left; }
  .man-step:not(:last-child)::before { display: none; }
  .man-state-flow { gap: .4rem; }
}
