/* Variáveis - tema escuro RP Soluções Digitais */
:root {
  --bg-primary: #1a1a24;
  --bg-secondary: #22222e;
  --bg-sidebar: #1e1e28;
  --bg-header: #16161f;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #6b6b7b;
  --accent: #7c6cf7;
  --accent-hover: #9388f8;
  --accent-bg: rgba(124, 108, 247, 0.15);
  --border: #2d2d3a;
  --tag-bg: #2d2d3a;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Header fixo */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrapper {
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 220px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  max-height: 320px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.search-results.is-open {
  display: block;
}

.search-results:empty {
  display: none !important;
}

.search-result-item {
  display: block;
  padding: 10px 14px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.is-focused {
  background: var(--accent-bg);
  color: var(--accent);
}

.search-result-item small {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.search-results-empty {
  padding: 14px;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.search-box .search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.search-box input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-box input::placeholder {
  color: var(--text-muted);
}

.search-box input:focus {
  outline: none;
}

.search-box kbd {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: 4px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.lang-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
}

/* Layout três colunas */
.layout {
  display: flex;
  padding-top: 56px;
  min-height: 100vh;
}

/* Sidebar esquerda */
.sidebar {
  width: 280px;
  min-width: 280px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9375rem;
  border-left: 3px solid transparent;
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-icon {
  flex-shrink: 0;
}

.nav-group {
  margin: 0;
}

.nav-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.nav-group-title:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.nav-group-icon {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.nav-group-title .nav-group-text {
  flex: 1;
  min-width: 0;
}

.nav-group-title .chevron {
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.nav-group.expanded .nav-group-title .chevron {
  transform: rotate(90deg);
}

.nav-sublist {
  list-style: none;
  margin: 0;
  padding: 0 0 8px 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  border-left: 2px solid var(--accent);
  margin-left: 28px;
  padding-left: 0;
}

.nav-group.expanded .nav-sublist {
  max-height: 800px;
}

.nav-sublist li {
  margin: 0;
}

.nav-sublist a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 44px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1.4;
}

.nav-sublist-icon {
  flex-shrink: 0;
  color: var(--text-muted);
}

.nav-sublist a:hover .nav-sublist-icon,
.nav-sublist a.active .nav-sublist-icon {
  color: var(--accent);
}

.nav-sublist a:hover {
  color: var(--accent);
}

.nav-sublist a.active {
  color: var(--accent);
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px 20px;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* Conteúdo principal */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 48px 64px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.main-content article {
  max-width: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.page-header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.btn-copy {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-copy:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.lead {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.brand-logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent) 0%, #5b4fd6 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-letter {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
}

.brand-name {
  display: block;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.brand-tagline {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.main-content p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.main-content p a,
.main-content .lead a {
  color: var(--accent);
  text-decoration: none;
}

.main-content p a:hover,
.main-content .lead a:hover {
  text-decoration: underline;
}

.section {
  margin: 40px 0 32px;
}

.section h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section h3 {
  margin: 28px 0 10px;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section p {
  margin: 0 0 12px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  background: var(--tag-bg);
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Cards de tópicos */
.topics {
  margin-top: 40px;
}

.topic-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  margin-bottom: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
}

.topic-card:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.topic-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topic-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.topic-arrow {
  font-size: 1.25rem;
  color: var(--accent);
  flex-shrink: 0;
}

.content-footer {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.next-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 8px;
}

.next-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.updated {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

/* Sumário direito (TOC) */
.toc {
  width: 220px;
  min-width: 220px;
  padding: 32px 24px 32px 24px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
}

.toc-title {
  margin: 0 0 16px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list li {
  margin: 0 0 8px;
}

.toc-list a {
  display: block;
  padding: 4px 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -12px;
}

.toc-list a:hover {
  color: var(--accent);
}

.toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* Banner de cookies */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 380px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 200;
}

/* Esconde o banner antes do paint se o usuário já tiver escolhido (evita flash) */
html.cookie-consent-saved .cookie-banner {
  display: none !important;
}

.cookie-banner.hidden {
  display: none !important;
}

.cookie-banner a {
  color: var(--accent);
  text-decoration: none;
}

.cookie-banner a:hover {
  text-decoration: underline;
}

.cookie-banner p {
  margin: 0 0 16px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cookie-buttons {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Páginas de documentação (termos, etc.) */
.doc-meta {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.notice-block {
  margin: 20px 0;
  padding: 16px 20px;
  background: var(--accent-bg);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.doc-index {
  margin: 28px 0 32px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.doc-index p {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.doc-index ul {
  margin: 0;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.8;
}

.doc-index a {
  color: var(--accent);
  text-decoration: none;
}

.doc-index a:hover {
  text-decoration: underline;
}

.doc-section {
  margin: 32px 0 24px;
}

.doc-section h2 {
  margin: 0 0 16px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.doc-section h3 {
  margin: 20px 0 10px;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
}

.doc-section ul {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.doc-section li {
  margin: 0 0 6px;
}

/* Atalho Ctrl+K foco na busca */
@media (max-width: 1200px) {
  .toc {
    display: none;
  }
}

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 56px;
    z-index: 90;
    transition: left 0.25s;
  }
  .sidebar.open {
    left: 0;
  }
  .main-content {
    padding: 24px 20px 48px;
  }
  .nav-links {
    display: none;
  }
  .search-box {
    min-width: 160px;
  }
}
