/* Reset básico e configurações globais */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #2d3748;
  background-color: #f7fafc;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* Headers */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  margin-bottom: 1rem;
  color: #1a202c;
}

h1 {
  font-size: 2.25rem;
  border-bottom: 3px solid #4299e1;
  padding-bottom: 0.5rem;
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.75rem;
  color: #2b6cb0;
  margin-top: 2rem;
}

h3 {
  font-size: 1.5rem;
  color: #3182ce;
  margin-top: 1.5rem;
}

/* Links */
a {
  color: #3182ce;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #2c5282;
  text-decoration: underline;
}

a:focus {
  outline: 2px solid #4299e1;
  outline-offset: 2px;
  border-radius: 2px;
}

/* Listas e checkboxes */
ul {
  list-style: none;
  margin-left: 0;
}

li {
  position: relative;
  margin-bottom: 0.75rem;
  padding-left: 2rem;
  line-height: 1.5;
}

/* Checkboxes personalizados */
li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.125rem;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #cbd5e0;
  border-radius: 4px;
  background-color: #ffffff;
  transition: all 0.2s ease;
}

/* Estados dos checkboxes */
li.done0::before {
  border-color: #e53e3e;
  background-color: #fed7d7;
}

li.done0::after {
  content: '✗';
  position: absolute;
  left: 0.1875rem;
  top: -0.0625rem;
  color: #e53e3e;
  font-weight: bold;
  font-size: 0.875rem;
}

li.done1::before {
  border-color: #f6ad55;
  background-color: #feebc8;
}

li.done1::after {
  content: '◐';
  position: absolute;
  left: 0.1875rem;
  top: -0.0625rem;
  color: #dd6b20;
  font-weight: bold;
  font-size: 0.875rem;
}

li.done2::before {
  border-color: #38a169;
  background-color: #c6f6d5;
}

li.done2::after {
  content: '✓';
  position: absolute;
  left: 0.1875rem;
  top: -0.0625rem;
  color: #38a169;
  font-weight: bold;
  font-size: 0.875rem;
}

li.done3::before {
  border-color: #3182ce;
  background-color: #bee3f8;
}

li.done3::after {
  content: '○';
  position: absolute;
  left: 0.25rem;
  top: -0.0625rem;
  color: #3182ce;
  font-weight: bold;
  font-size: 0.875rem;
}

li.done4::before {
  border-color: #805ad5;
  background-color: #e9d8fd;
}

li.done4::after {
  content: '●';
  position: absolute;
  left: 0.25rem;
  top: -0.0625rem;
  color: #805ad5;
  font-weight: bold;
  font-size: 0.875rem;
}

/* Listas aninhadas */
ul ul {
  margin-top: 0.5rem;
  margin-left: 1rem;
  border-left: 2px solid #e2e8f0;
  padding-left: 1rem;
}

/* Parágrafos */
p {
  margin-bottom: 1rem;
  text-align: justify;
}

/* Link de voltar */
p:last-child {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}

p:last-child a {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: #4299e1;
  color: white;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

p:last-child a:hover {
  background-color: #3182ce;
  text-decoration: none;
}

p:last-child a:focus {
  outline: 2px solid #63b3ed;
  outline-offset: 2px;
}

/* Tabelas - Estilo unificado com o design geral */
table {
  width: 100%;
  margin: 1.5rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Oculta todas as linhas pares (descrições) por padrão */
table tr:nth-child(even) {
  display: none;
}

/* Estiliza as linhas ímpares (conceitos) como clicáveis */
table tr:nth-child(odd) td {
  cursor: pointer;
  background-color: #ffffff;
  color: #2d3748;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-bottom: none;
  user-select: none;
  position: relative;
  outline: none;
  tabindex: 0;
  font-weight: 500;
  transition: all 0.2s ease;
}

/* Hover state para linhas clicáveis */
table tr:nth-child(odd) td:hover {
  background-color: #edf2f7;
  border-color: #cbd5e0;
}

/* Focus state para linhas clicáveis */
table tr:nth-child(odd) td:focus {
  background-color: #bee3f8;
  border-color: #4299e1;
  box-shadow: 0 0 0 2px rgba(66, 153, 225, 0.2);
}

/* Adiciona um símbolo de seta para indicar expansibilidade */
table tr:nth-child(odd) td:before {
  content: "▶";
  color: #4299e1;
  font-size: 0.875rem;
  margin-right: 0.75rem;
  display: inline-block;
  transition: transform 0.2s ease;
  font-weight: normal;
}

/* Rotaciona a seta quando o elemento está focado */
table tr:nth-child(odd):focus td:before,
table tr:nth-child(odd):active td:before {
  transform: rotate(90deg);
}

/* Quando uma linha ímpar está em foco, mostra a próxima linha par */
table tr:nth-child(odd):focus + tr:nth-child(even),
table tr:nth-child(odd):active + tr:nth-child(even) {
  display: table-row;
}

/* Estiliza as linhas pares (descrições) quando visíveis */
table tr:nth-child(even) td {
  background-color: #f7fafc;
  color: #4a5568;
  padding: 1rem;
  border: 1px solid #e2e8f0;
  border-top: none;
  line-height: 1.6;
  transition: all 0.2s ease;
}

/* Primeira linha da tabela */
table tr:first-child td {
  border-top: 1px solid #e2e8f0;
}

/* Última linha visível da tabela */
table tr:last-child td,
table tr:nth-child(even):last-child td {
  border-bottom: 1px solid #e2e8f0;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
  body {
      padding: 1rem 0.75rem;
      font-size: 0.9rem;
  }

  h1 {
      font-size: 1.875rem;
  }

  h2 {
      font-size: 1.5rem;
  }

  h3 {
      font-size: 1.25rem;
  }

  li {
      padding-left: 1.75rem;
  }

  ul ul {
      margin-left: 0.75rem;
      padding-left: 0.75rem;
  }

  /* Tabelas responsivas */
  table tr:nth-child(odd) td,
  table tr:nth-child(even) td {
      padding: 0.75rem;
      font-size: 0.9rem;
  }

  table tr:nth-child(odd) td:before {
      font-size: 0.75rem;
      margin-right: 0.5rem;
  }
}

@media (max-width: 480px) {
  body {
      padding: 0.75rem 0.5rem;
  }

  h1 {
      font-size: 1.625rem;
  }

  li {
      padding-left: 1.5rem;
  }

  li::before {
      width: 1rem;
      height: 1rem;
  }

  li.done0::after,
  li.done1::after,
  li.done2::after,
  li.done3::after,
  li.done4::after {
      left: 0.125rem;
      font-size: 0.75rem;
  }

  /* Tabelas em telas muito pequenas */
  table tr:nth-child(odd) td,
  table tr:nth-child(even) td {
      padding: 0.5rem;
      font-size: 0.875rem;
  }
}

/* Melhorias de acessibilidade */
@media (prefers-reduced-motion: reduce) {
  * {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
  }
}

/* Modo escuro */
@media (prefers-color-scheme: dark) {
  body {
      background-color: #1a202c;
      color: #e2e8f0;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
      color: #f7fafc;
  }

  h1 {
      border-bottom-color: #63b3ed;
  }

  h2 {
      color: #90cdf4;
  }

  h3 {
      color: #63b3ed;
  }

  a {
      color: #63b3ed;
  }

  a:hover {
      color: #90cdf4;
  }

  li::before {
      border-color: #4a5568;
      background-color: #2d3748;
  }

  ul ul {
      border-left-color: #4a5568;
  }

  p:last-child {
      border-top-color: #4a5568;
  }

  /* Tabelas no modo escuro */
  table tr:nth-child(odd) td {
      background-color: #2d3748;
      color: #e2e8f0;
      border-color: #4a5568;
  }

  table tr:nth-child(odd) td:hover {
      background-color: #4a5568;
      border-color: #718096;
  }

  table tr:nth-child(odd) td:focus {
      background-color: #2a4365;
      border-color: #63b3ed;
      box-shadow: 0 0 0 2px rgba(99, 179, 237, 0.2);
  }

  table tr:nth-child(odd) td:before {
      color: #63b3ed;
  }

  table tr:nth-child(even) td {
      background-color: #1a202c;
      color: #cbd5e0;
      border-color: #4a5568;
  }

  table tr:first-child td,
  table tr:last-child td,
  table tr:nth-child(even):last-child td {
      border-color: #4a5568;
  }
}

/* Print styles */
@media print {
  body {
      background-color: white;
      color: black;
      max-width: none;
      margin: 0;
      padding: 1rem;
  }

  a {
      color: black;
      text-decoration: underline;
  }

  h1 {
      border-bottom: 2px solid black;
  }

  /* Exibe todas as linhas da tabela na impressão */
  table tr:nth-child(even) {
      display: table-row !important;
  }

  table tr:nth-child(odd) td,
  table tr:nth-child(even) td {
      background-color: white;
      color: black;
      border-color: black;
  }

  table tr:nth-child(odd) td:before {
      content: "";
  }
}