/* ═══════════════════════════════════════════
   tutorial.css — Página de Tutorial DataWarp
═══════════════════════════════════════════ */

/* ── Page root: corrige o flex-row do .content pai ── */
.tut-page {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* ── Hero ── */
.tut-hero {
  background: linear-gradient(150deg, var(--accent-bg) 0%, var(--bg) 70%);
  border-bottom: 1px solid var(--border);
  padding: 60px 40px 52px;
  text-align: center;
}

.tut-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: 100px;
  padding: 5px 14px;
  margin-bottom: 22px;
}

.tut-hero-eyebrow .material-symbols-outlined {
  font-size: 14px;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
}

.tut-hero-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -.01em;
}

.tut-hero-sub {
  font-size: 1rem;
  color: var(--ink-mid);
  margin: 0 auto 40px;
  max-width: 520px;
  line-height: 1.65;
}

/* ── Module flow indicator ── */
.tut-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  row-gap: 10px;
}

.tut-flow-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 18px 8px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-mid);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.tut-flow-item:hover {
  border-color: var(--accent-light);
  color: var(--accent);
  background: var(--accent-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tut-flow-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tut-flow-arrow {
  color: var(--ink-faint);
  font-size: 16px;
  user-select: none;
  flex-shrink: 0;
}

/* Suprime scroll externo quando tutorial está ativo */
.dw-page-inner:has(.tut-layout),
.dw-page-outer:has(.tut-layout),
.content:has(.tut-layout) {
  overflow: hidden;
}

/* ── Page layout ── */
.tut-layout {
  display: flex;
  height: calc(100dvh - 72px);
  overflow: hidden;
}

/* ── Sidebar ── */
.tut-sidebar {
  width: 230px;
  flex-shrink: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

.tut-toc {
  height: 100%;
  background: var(--bg-card);
  overflow-y: auto;
  scrollbar-width: none;
}

.tut-toc::-webkit-scrollbar { display: none; }

.tut-toc-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.tut-toc-group {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.tut-toc-group:last-child {
  border-bottom: none;
}

.tut-toc-section {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 18px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-mid);
  text-decoration: none;
  transition: var(--transition);
  border-left: 2.5px solid transparent;
}

.tut-toc-section:hover {
  color: var(--ink);
  background: var(--bg-hover);
}

.tut-toc-section.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--accent-bg);
}

.tut-toc-num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--border);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.tut-toc-section.active .tut-toc-num {
  background: var(--accent);
  color: #fff;
}

.tut-toc-sub {
  display: block;
  padding: 5px 18px 5px 46px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: var(--transition);
  border-left: 2.5px solid transparent;
  line-height: 1.45;
}

.tut-toc-sub:hover {
  color: var(--ink-mid);
  background: var(--bg-hover);
}

.tut-toc-sub.active {
  color: var(--accent);
  background: var(--accent-bg);
  border-left-color: var(--accent);
}

/* ── Main content ── */
.tut-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 52px 28px 96px;
}

/* ── Section ── */
.tut-section {
  margin-bottom: 80px;
  scroll-margin-top: 32px;
}

.tut-section-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.tut-section-badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Instrument Serif', serif;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(114, 59, 240, .28);
}

.tut-section-meta {
  flex: 1;
}

.tut-section-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.tut-section-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.85rem;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -.01em;
}

/* ── Subsection ── */
.tut-subsection {
  margin-bottom: 44px;
  scroll-margin-top: 32px;
}

.tut-subsection-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tut-subsection-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: 100px;
  padding: 2px 9px;
  flex-shrink: 0;
  letter-spacing: .02em;
}

/* ── Steps ── */
.tut-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.tut-step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
}

.tut-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-bg);
  border: 1.5px solid var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.tut-step-text {
  font-size: 0.9375rem;
  color: var(--ink-mid);
  line-height: 1.65;
  padding-top: 3px;
  flex: 1;
}

.tut-step-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Image placeholder ── */
.tut-img-slot {
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 24px;
  margin: 20px 0;
  min-height: 200px;
  transition: var(--transition);
  cursor: default;
}

.tut-img-slot:hover {
  border-color: var(--accent-light);
  background: var(--accent-bg);
}

.tut-img-slot .material-symbols-outlined {
  font-size: 40px;
  color: var(--ink-faint);
  font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 40;
  transition: var(--transition);
}

.tut-img-slot:hover .material-symbols-outlined {
  color: var(--accent-light);
}

.tut-img-slot-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  max-width: 360px;
  line-height: 1.5;
}

/* ── Callouts ── */
.tut-callout {
  display: flex;
  gap: 11px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  border-left: 3px solid;
}

.tut-callout--tip {
  background: var(--teal-bg, #e8f7f4);
  border-color: var(--teal, #0d8a72);
}

.tut-callout--info {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.tut-callout--warn {
  background: var(--amber-bg, #fef6e4);
  border-color: var(--amber, #9b6b0a);
}

.tut-callout .material-symbols-outlined {
  font-size: 17px;
  flex-shrink: 0;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 20;
  margin-top: 1px;
}

.tut-callout--tip .material-symbols-outlined { color: var(--teal, #0d8a72); }
.tut-callout--info .material-symbols-outlined { color: var(--accent); }
.tut-callout--warn .material-symbols-outlined { color: var(--amber, #9b6b0a); }

.tut-callout-text {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--ink-mid);
}

.tut-callout-text strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Tables ── */
.tut-table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.tut-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tut-table th {
  background: var(--bg);
  color: var(--ink-mid);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .03em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tut-table td {
  padding: 10px 16px;
  color: var(--ink-mid);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
}

.tut-table td:first-child {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

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

.tut-table tr:hover td {
  background: var(--bg);
}

.tut-table code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

/* ── Typography ── */
.tut-main p {
  font-size: 0.9375rem;
  color: var(--ink-mid);
  line-height: 1.72;
  margin: 0 0 14px;
}

.tut-main p strong {
  color: var(--ink);
  font-weight: 600;
}

.tut-main p code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: 'Courier New', monospace;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
}

.tut-main ul, .tut-main ol {
  font-size: 0.9375rem;
  color: var(--ink-mid);
  line-height: 1.72;
  margin: 10px 0 14px;
  padding-left: 22px;
}

.tut-main li {
  margin-bottom: 5px;
}

.tut-main li strong {
  color: var(--ink);
  font-weight: 600;
}

.tut-section > .tut-section-header + p {
  margin-bottom: 28px;
}

/* ── Divider ── */
.tut-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 56px 0 48px;
}

/* ── CTA box ── */
.tut-cta {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 44px 36px;
  text-align: center;
}

.tut-cta h3 {
  font-family: 'Instrument Serif', serif;
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -.01em;
}

.tut-cta > p {
  font-size: 0.9375rem;
  color: var(--ink-mid);
  margin: 0 0 28px;
}

.tut-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 13px 30px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(114, 59, 240, .3);
}

.tut-cta-btn:hover {
  background: var(--accent-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(114, 59, 240, .35);
}

/* ── Workflow strip ── */
.tut-workflow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  row-gap: 8px;
  margin: 18px 0;
}

.tut-workflow-step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px 6px 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mid);
  box-shadow: var(--shadow-sm);
}

.tut-workflow-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.tut-workflow-arrow {
  color: var(--ink-faint);
  font-size: 14px;
  flex-shrink: 0;
  margin: 0 2px;
}

/* ── Images ── */
.tut-img {
  display: block;
  width: 100%;
  height: auto;
  margin: 28px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--bg);
}

/* Texto/callout antes de imagem grande — respira mais */
p + .tut-img,
.tut-callout + .tut-img,
ul + .tut-img,
ol + .tut-img,
.tut-table-wrap + .tut-img {
  margin-top: 32px;
}

/* Texto logo após imagem grande — não cola */
.tut-img + p,
.tut-img + .tut-callout,
.tut-img + .tut-table-wrap,
.tut-img + ul,
.tut-img + ol {
  margin-top: 24px;
}

/* Par de imagens lado a lado */
p + .tut-img-pair,
.tut-callout + .tut-img-pair {
  margin-top: 32px;
}

/* modais e elementos estreitos: tamanho natural (capturados em 2x = metade em CSS) */
.tut-img-pair {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: flex-start;
  margin: 20px 0;
  flex-wrap: wrap;
}

.tut-img-pair .tut-img {
  width: auto;
  max-width: 360px;
  flex: 1 1 300px;
  margin: 0;
}

.tut-img[src*="ai_chat"] {
  width: auto;
  max-width: 320px;
  border-radius: 16px;
  margin: 0;
}

.tut-img[src*="cadastro"],
.tut-img[src*="verificacao"] {
  width: auto;
  max-width: 360px;
  margin: 28px auto;
}

.tut-img[src*="modelagem_inicio"] {
  width: auto;
  max-width: 504px;
  margin: 28px auto;
}

.tut-img[src*="colar_tabela"] {
  width: auto;
  max-width: 480px;
  margin: 28px auto;
}

.tut-img[src*="sidebar"] {
  width: auto;
  max-width: 180px;
  margin: 28px auto;
}

.tut-img[src*="significancia"] {
  width: 54%;
  margin: 28px auto;
}

.tut-img[src*="modal_bairros"] {
  width: auto;
  max-width: 352px;
  margin: 28px auto;
}

.tut-img[src*="toolbar_link"],
.tut-img[src*="totais"] {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* ── Desktop notice (hidden on mobile by default) ── */
.tut-img-desktop-notice {
  display: none;
}

/* ── Responsive — tablet ── */
@media (max-width: 920px) {
  /* Desfaz o layout fixo de viewport */
  .dw-page-inner:has(.tut-layout),
  .dw-page-outer:has(.tut-layout),
  .content:has(.tut-layout) {
    overflow: auto;
  }

  .tut-layout {
    flex-direction: column;
    height: auto;
    overflow: visible;
    gap: 0;
  }

  .tut-sidebar {
    width: 100%;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .tut-toc {
    height: auto;
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 12px;
    gap: 8px;
  }

  .tut-toc-title,
  .tut-toc-group,
  .tut-toc-sub { display: none; }

  .tut-toc-group { display: flex; border-bottom: none; padding: 0; }

  .tut-toc-section {
    white-space: nowrap;
    border-left: none;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--bg);
    padding: 6px 12px 6px 8px;
    flex-shrink: 0;
    font-size: 12px;
  }

  .tut-toc-section .tut-toc-num { display: none; }

  .tut-toc-section.active {
    border-color: var(--accent-light);
    background: var(--accent-bg);
  }

  .tut-main {
    overflow-y: visible;
    padding: 28px 18px 64px;
  }

  .tut-flow-arrow { display: none; }

  /* Imagens: desativa reduções de desktop */
  .tut-img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 20px 0 !important;
  }
}

/* ── Responsive — mobile ── */
@media (max-width: 640px) {

  /* Tudo dentro da tela, sem scroll horizontal */
  .tut-page,
  .tut-layout,
  .tut-main,
  .tut-section,
  .tut-subsection,
  .tut-callout,
  .tut-table-wrap { box-sizing: border-box; max-width: 100%; }

  .tut-layout { height: auto; overflow: visible; padding: 0; gap: 0; }
  .tut-main { min-width: 0; overflow-y: visible; padding: 20px 14px 56px; }
  .tut-sidebar { display: none; }

  /* Hero */
  .tut-hero { padding: 32px 16px 28px; }
  .tut-hero-sub { font-size: 0.9rem; }

  /* Flow indicator */
  .tut-flow { gap: 6px; row-gap: 8px; }
  .tut-flow-item { font-size: 11px; padding: 5px 9px 5px 5px; }
  .tut-flow-badge { width: 18px; height: 18px; font-size: 10px; }

  /* Textos: envolvem naturalmente, nunca transbordam */
  .tut-main p, .tut-main ul, .tut-main ol, .tut-main li,
  .tut-step-text, .tut-callout-text {
    word-break: break-word;
    overflow-wrap: break-word;
  }

  /* Callouts */
  .tut-callout { padding: 10px 11px; gap: 8px; }

  /* Tabelas: sem scroll, comprimidas para caber */
  .tut-table-wrap { overflow: visible; }
  .tut-table {
    width: 100%;
    table-layout: fixed;
  }
  .tut-table th,
  .tut-table td {
    padding: 6px 8px;
    font-size: 11.5px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
  }
  .tut-table td:first-child {
    white-space: normal;
    width: 30%;
  }

  /* Imagens: todas escalam para caber na tela */
  .tut-img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 20px 0;
  }

  /* Pares lado a lado: empilha */
  .tut-img-pair { flex-direction: column; align-items: center; gap: 12px; }
  .tut-img-pair .tut-img { max-width: 100% !important; flex: none; }

  /* Títulos */
  .tut-section-title { font-size: 1.4rem; }
  .tut-section-badge { width: 38px; height: 38px; font-size: 15px; }
  .tut-subsection-title { font-size: 0.95rem; }
  .tut-hero-title { font-size: 1.6rem; }
  .tut-cta { padding: 28px 16px; }
  .tut-step-num { width: 22px; height: 22px; font-size: 11px; }

  /* Imagens com tamanho reduzido só no mobile */
  .tut-img[src*="sidebar"] { max-width: 200px !important; }
  .tut-img[src*="modal_bairros"] { max-width: 211px !important; }
}
