/* ============================================================
   ControleNaMão — Central de Ajuda
   style.css — Folha de estilos principal
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cnm-orange:       #ff9d01;
  --cnm-orange-dark:  #e08800;
  --cnm-orange-light: #fff8ec;
  --cnm-orange-mid:   #fff0cc;

  --navbar-h:      48px;
  --sidebar-width: 268px;
  --content-max:   760px;
  --topbar-h:      52px;

  --text-primary:   #1a1a1a;
  --text-secondary: #555;
  --text-muted:     #888;
  --border:         #e8e8e8;
  --bg-page:        #f7f7f5;
  --bg-card:        #fff;
  --bg-sidebar:     #fafaf8;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cnm-orange-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout Shell --- */
.shell {
  display: flex;
  min-height: 100vh;
  padding-top: var(--navbar-h);
}

/* ============================================================
   NAVBAR
   ============================================================ */
.cnm-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 200;
  display: flex;
  align-items: center;
}

.cnm-navbar-inner {
  width: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cnm-navbar-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.cnm-navbar-brand img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

.cnm-navbar-brand:hover { text-decoration: none; color: var(--text-primary); }

.cnm-navbar-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

.cnm-navbar-section {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.cnm-navbar-back {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: color .15s, border-color .15s, background .15s;
  flex-shrink: 0;
}

.cnm-navbar-back svg {
  width: 13px;
  height: 13px;
}

.cnm-navbar-back:hover {
  color: var(--cnm-orange-dark);
  border-color: var(--cnm-orange);
  background: var(--cnm-orange-light);
  text-decoration: none;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  height: calc(100vh - var(--navbar-h));
  overflow: hidden;
  z-index: 100;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
}

.sidebar-logo-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

.sidebar-logo-text {
  display: flex;
  flex-direction: column;
}

.sidebar-logo-text strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-logo-text span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Search in sidebar */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  transition: border-color .15s;
}

.sidebar-search:focus-within {
  border-color: var(--cnm-orange);
}

.sidebar-search svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  color: var(--text-primary);
  font-family: var(--font-body);
  width: 100%;
}

.sidebar-search input::placeholder { color: var(--text-muted); }

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-home {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color .15s, background .15s;
  text-decoration: none;
  border-radius: 0;
}

.nav-home:hover { background: var(--cnm-orange-light); color: var(--cnm-orange-dark); text-decoration: none; }
.nav-home.active { color: var(--cnm-orange-dark); font-weight: 500; }

.nav-home svg { width: 15px; height: 15px; flex-shrink: 0; }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Category toggle */
.nav-cat-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  transition: color .15s, background .15s;
  font-family: var(--font-body);
}

.nav-cat-btn:hover { color: var(--text-primary); background: var(--cnm-orange-light); }
.nav-cat-btn.open { color: var(--text-primary); }
.nav-cat-btn.active { color: var(--cnm-orange-dark); }

.nav-cat-icon { font-size: 15px; flex-shrink: 0; width: 18px; text-align: center; }
.nav-cat-label { flex: 1; }

.nav-cat-chevron {
  width: 12px;
  height: 12px;
  transition: transform .2s;
  flex-shrink: 0;
  margin-left: auto;
  color: var(--text-muted);
}

.nav-cat-btn.open .nav-cat-chevron { transform: rotate(90deg); }

/* Article links inside category */
.nav-articles {
  display: none;
  padding: 0 0 4px 0;
}

.nav-articles.open { display: block; }

.nav-art-link {
  display: block;
  padding: 5px 16px 5px 40px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color .1s, background .1s;
  border-right: 2px solid transparent;
}

.nav-art-link:hover { color: var(--text-primary); background: var(--cnm-orange-light); text-decoration: none; }
.nav-art-link.active { color: var(--cnm-orange-dark); font-weight: 500; background: var(--cnm-orange-light); border-right-color: var(--cnm-orange); }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  line-height: 1.5;
}

.sidebar-footer a { color: var(--cnm-orange-dark); }

/* --- Main content area --- */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

/* --- Top bar (mobile / breadcrumb) --- */
.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* --- Page wrapper --- */
.page {
  padding: 48px 52px 80px;
  max-width: calc(var(--content-max) + 104px);
}

/* ============================================================
   HOME PAGE
   ============================================================ */

.home-hero {
  margin-bottom: 40px;
}

.home-hero h1 {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}

.home-hero p {
  font-size: 15px;
  color: var(--text-secondary);
}

/* Big search on home */
.home-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-top: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}

.home-search:focus-within {
  border-color: var(--cnm-orange);
  box-shadow: 0 0 0 3px rgba(255,157,1,.12);
}

.home-search svg { width: 18px; height: 18px; color: var(--text-muted); flex-shrink: 0; }

.home-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--text-primary);
  font-family: var(--font-body);
  width: 100%;
}

.home-search input::placeholder { color: var(--text-muted); }

/* Category cards grid */
.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 40px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  box-shadow: var(--shadow-sm);
}

.cat-card:hover {
  border-color: var(--cnm-orange);
  box-shadow: 0 4px 16px rgba(255,157,1,.15);
  transform: translateY(-1px);
  text-decoration: none;
}

.cat-card-icon { font-size: 22px; }
.cat-card-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cat-card-count { font-size: 11px; color: var(--text-muted); }

/* Popular articles */
.popular-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 40px;
}

.popular-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: background .1s;
  font-size: 13.5px;
  color: var(--text-primary);
}

.popular-item:hover { background: var(--cnm-orange-light); text-decoration: none; }

.popular-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

.popular-badge {
  margin-left: auto;
  font-size: 10px;
  background: var(--cnm-orange-light);
  color: var(--cnm-orange-dark);
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Whatsapp CTA box */
.cta-box {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.cta-box-icon {
  width: 40px;
  height: 40px;
  background: #25D366;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cta-box-icon svg { width: 20px; height: 20px; fill: #fff; }

.cta-box-text strong { font-size: 13.5px; font-weight: 600; color: var(--text-primary); display: block; }
.cta-box-text span { font-size: 12px; color: var(--text-secondary); }

.cta-box-btn {
  margin-left: auto;
  padding: 8px 16px;
  background: #25D366;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-body);
  transition: background .15s;
  flex-shrink: 0;
}

.cta-box-btn:hover { background: #1ebe5d; text-decoration: none; color: #fff; }

/* ============================================================
   CATEGORY PAGE
   ============================================================ */

.cat-page-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.cat-page-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.cat-page-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.cat-page-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

.articles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.article-row:hover {
  border-color: var(--cnm-orange);
  box-shadow: 0 2px 10px rgba(255,157,1,.12);
  text-decoration: none;
}

.article-row svg { width: 16px; height: 16px; color: var(--cnm-orange); flex-shrink: 0; }

.article-row-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.article-row-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.article-row-chevron { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }

/* ============================================================
   ARTICLE PAGE
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.breadcrumb a { color: var(--text-muted); transition: color .1s; }
.breadcrumb a:hover { color: var(--cnm-orange-dark); text-decoration: none; }
.breadcrumb svg { width: 12px; height: 12px; flex-shrink: 0; }
.breadcrumb span { color: var(--text-secondary); }

.article-header {
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.article-header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 10px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.article-meta svg { width: 13px; height: 13px; }
.article-meta span { display: flex; align-items: center; gap: 4px; }

/* Article body */
.article-body {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
}

.article-body h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 30px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article-body h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 22px 0 8px;
}

.article-body p { margin-bottom: 14px; }

.article-body ul,
.article-body ol {
  padding-left: 22px;
  margin-bottom: 14px;
}

.article-body li { margin-bottom: 6px; }

.article-body strong { color: var(--text-primary); font-weight: 600; }

.article-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: #f0f0ee;
  color: var(--text-primary);
  padding: 1px 6px;
  border-radius: 4px;
}

.article-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 16px 0;
  font-size: 13px;
  font-family: var(--font-mono);
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Callout boxes */
.callout {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  margin: 18px 0;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

.callout svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.callout-info {
  background: var(--cnm-orange-light);
  border-left: 3px solid var(--cnm-orange);
  color: #7a4e00;
}

.callout-info svg { color: var(--cnm-orange-dark); }

.callout-warning {
  background: #fff8f0;
  border-left: 3px solid #f97316;
  color: #7c3a0a;
}

.callout-warning svg { color: #f97316; }

.callout-success {
  background: #f0fdf4;
  border-left: 3px solid #22c55e;
  color: #166534;
}

.callout-success svg { color: #22c55e; }

.callout-danger {
  background: #fff5f5;
  border-left: 3px solid #ef4444;
  color: #7f1d1d;
}

.callout-danger svg { color: #ef4444; }

/* Numbered steps */
.steps { margin: 18px 0; }

.step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin-bottom: 13px;
}

.step-num {
  min-width: 26px;
  height: 26px;
  background: var(--cnm-orange);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.step-body {
  flex: 1;
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-top: 3px;
}

.step-body strong { color: var(--text-primary); }

/* Related articles */
.related {
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.related h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.related-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.related-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  text-decoration: none;
  transition: background .1s;
}

.related-link:hover { background: var(--cnm-orange-light); text-decoration: none; color: var(--cnm-orange-dark); }
.related-link svg { width: 14px; height: 14px; color: var(--text-muted); }

/* Helpful feedback */
.helpful {
  margin-top: 36px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.helpful p { font-size: 13.5px; color: var(--text-secondary); flex: 1; }

.helpful-btns { display: flex; gap: 8px; }

.helpful-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text-secondary);
  transition: all .15s;
}

.helpful-btn:hover {
  border-color: var(--cnm-orange);
  background: var(--cnm-orange-light);
  color: var(--cnm-orange-dark);
}

/* ============================================================
   SEARCH RESULTS PAGE
   ============================================================ */

.search-header {
  margin-bottom: 24px;
}

.search-header h1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.search-header p { font-size: 14px; color: var(--text-secondary); }

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}

.search-result-item:hover {
  border-color: var(--cnm-orange);
  box-shadow: 0 2px 10px rgba(255,157,1,.12);
  text-decoration: none;
}

.result-cat-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--cnm-orange-dark);
  background: var(--cnm-orange-light);
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}

.result-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
}

.result-excerpt {
  font-size: 13px;
  color: var(--text-muted);
}

.result-excerpt mark {
  background: var(--cnm-orange-mid);
  color: var(--cnm-orange-dark);
  border-radius: 2px;
  padding: 0 2px;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results svg {
  width: 40px;
  height: 40px;
  color: var(--border);
  margin-bottom: 12px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.no-results p { font-size: 14px; margin-bottom: 4px; }
.no-results small { font-size: 13px; }

/* ============================================================
   MOBILE
   ============================================================ */

.hamburger {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hamburger svg { width: 18px; height: 18px; color: var(--text-primary); }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,.3);
  z-index: 99;
}

@media (max-width: 800px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay.open { display: block; }

  .main { margin-left: 0; }

  .topbar {
    display: flex;
    position: sticky;
    top: var(--navbar-h);
  }

  .page { padding: 24px 20px 60px; }

  .hamburger { display: flex; }

  .cats-grid { grid-template-columns: repeat(2, 1fr); }

  .cta-box { flex-wrap: wrap; }
  .cta-box-btn { margin-left: 0; }

  .article-header h1 { font-size: 19px; }

  .cnm-navbar-section { display: none; }
}