/* =========================
   TOC - Índice do Livro
   Estilo congruente com base.css
========================= */

/* Botão TOC - estilo flutuante */
#toc-toggle {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50px;
  font-size: 1.2rem;
  background: var(--gold);
  color: #1a1a1a;
  border: 2px solid var(--gold);
  cursor: pointer;
  z-index: 1001;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

#toc-toggle:hover {
  transform: translateY(-2px);
}

/* Overlay */
#toc-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 990;
}

#toc-overlay.active { display: block; }

/* Painel TOC */
#toc-panel {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  max-height: 80vh;
  background: var(--parchment);
  border-bottom: 3px solid var(--gold);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1.5rem;
  z-index: 1000;
  overflow-y: auto;
  box-shadow: var(--shadow);
  flex-direction: column;
}
#toc-panel.active { display: flex; }

/* Título do capítulo */
.toc-chapter-title {
  color: var(--bronze);
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin: 0.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--gold);
}

/* Select de capítulos */
#chapter-select {
  width: 100%;
  max-width: 800px;
  padding: 0.8rem;
  background: white;
  border: 2px solid var(--bronze);
  border-radius: 8px;
  font-size: 1rem;
  font-family: 'Cinzel', serif;
  color: var(--bg-dark);
  margin-bottom: 1rem;
  cursor: pointer;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Navegação entre capítulos */
.chapter-nav {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.chapter-nav button {
  flex: 1;
  padding: 0.8rem;
  background: white;
  border: 2px solid var(--bronze);
  border-radius: 8px;
  color: var(--bronze);
  font-weight: bold;
  cursor: pointer;
}
.chapter-nav button:hover {
  background: var(--bronze);
  color: white;
}
.chapter-nav button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Lista de seções */
#toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
#toc-list li {
  border-bottom: 1px dashed var(--bronze);
}
#toc-list a {
  display: block;
  padding: 0.8rem 0.5rem;
  color: var(--bg-dark);
  font-family: 'Crimson Text', serif;
  font-size: 1.1rem;
  text-decoration: none;
}
#toc-list a:hover {
  color: var(--gold);
  padding-left: 0.8rem;
  transition: padding 0.2s;
}

/* =========================
   TOC - Adaptação para Desktop
   Adicione ao final do seu toc.css
========================= */

@media (min-width: 1024px) {
  /* Botão TOC maior e mais quadrado */
  #toc-toggle {
    top: 1rem;
    left: 1rem;
    width: 60px;
    height: 60px;
    border-radius: 12px; /* Mais quadrado, igual aos floating buttons */
    font-size: 1.5rem;
    box-shadow: var(--shadow);
  }

  /* Painel TOC com largura controlada */
  #toc-panel {
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 900px; /* Um pouco maior que 800px para comportar os botões */
    border-radius: var(--radius);
    border: 3px solid var(--gold);
    box-shadow: var(--shadow);
  }

  /* Container do select e navegação com largura máxima */
  #chapter-select {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
  }

  /* Navegação entre capítulos */
  .chapter-nav {
    max-width: 800px;
    margin: 0 auto 2rem;
    gap: 1rem;
  }

  /* Botões de navegação maiores e mais quadrados */
  .chapter-nav button {
    width: 300px;
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 10px;
    border-width: 2px;
  }

  /* Título do capítulo com mesma largura */
  .toc-chapter-title {
    max-width: 800px;
    margin: 0.5rem auto 1.5rem;
    font-size: 1.5rem;
  }

}

/* Ajuste intermediário para tablets */
@media (min-width: 768px) and (max-width: 1023px) {
  #toc-toggle {
    width: 55px;
    height: 55px;
    border-radius: 10px;
    font-size: 1.3rem;
  }
}