/* Book Page Styles */

/* CSS Variables */
:root {
  --book-primary-color: #4d6c82;
  --book-primary-hover: #2c5aa0;
  --book-accent-color: #bfa14a;
  --book-title-color: #3a5a7a;
  --book-part-name-color: #afa11b;
  --book-background: #fffbe6;
  --book-content-bg: #fff;
  --book-text-color: #3a3a3a;
  --book-border-radius: 12px;
  --book-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Main Layout */
.book-main-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  /* padding: 24px 0; */
  background: var(--book-background);
  min-height: 80vh;
  box-sizing: border-box;
}

.book-sidebar {
  flex: 1;
  display: flex;
  align-items: center;
}

.book-content {
  flex: 3;
  max-width: 700px;
  background: var(--book-content-bg);
  border-radius: var(--book-border-radius);
  box-shadow: var(--book-shadow);
  padding: 32px 20px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

/* Header */
.book-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
}

.book-back-button {
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-title-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.book-title {
  text-align: center;
  font-size: 2.2rem;
  font-family: 'Tagesschrift', 'Skranji', serif;
  color: var(--book-title-color);
  letter-spacing: 1px;
  margin-bottom: 0.4em;
}

.book-subtitle {
  font-family: 'Tagesschrift', serif;
  font-size: 1.1rem;
  color: var(--book-accent-color);
  letter-spacing: 2px;
  text-transform: lowercase;
  margin: -18px 0 10px 0;
}

.book-divider {
  width: 90%;
  height: 1px;
  background-color: var(--book-accent-color);
  border: none;
  margin: 18px auto 24px auto;
}

/* Book Info */
.book-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 18px;
}

.book-cover {
  max-width: 220px;
  width: 100%;
  min-width: 120px;
  min-height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: var(--book-shadow);
  background: var(--book-content-bg);
}

.book-description {
  text-align: center;
  font-size: 1.08rem;
  color: var(--book-text-color);
  margin: 0 0 8px 0;
}

/* Parts Section */
.book-parts {
  width: 100%;
  margin-top: 18px;
}

.book-parts-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--book-content-bg);
  border-radius: 8px;
  padding: 8px 0 2px 0;
  margin-bottom: 0.5em;
}

.book-parts-label {
  font-size: 1rem;
  color: var(--book-accent-color);
  font-family: 'Tagesschrift', serif;
  margin-top: -8px;
}

.book-parts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.book-part-link {
  display: inline-block;
  color: var(--book-primary-color);
  font-size: 1.05rem;
  font-weight: 400;
  text-decoration: none;
  background: rgba(248, 245, 228, 0.2);
  border: 1px solid rgba(232, 220, 192, 0.5);
  border-radius: 6px;
  padding: 12px 24px;
  min-width: 200px;
  text-align: center;
  transition: all 0.2s ease;
  font-family: 'Tagesschrift', serif;
  letter-spacing: 0.3px;
}

.book-part-link:visited {
  color: var(--book-primary-color);
}

.book-part-link:hover {
  color: var(--book-accent-color);
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(191, 161, 74, 0.4);
  transform: translateY(-1px);
}

.book-part-link:active {
  transform: translateY(0);
}

/* Questions Header and Navigation */
.questions-header,
.book-questions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 18px;
  padding: 0 12px;
  gap: 12px;
}

.back-container {
  flex: 0 0 auto;
  width: 85px;
  display: flex;
  justify-content: flex-start;
}

.book-back-link {
  text-decoration: none;
  color: var(--book-primary-color);
  font-size: 1rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.book-back-link:hover {
  color: var(--book-primary-hover);
  background-color: rgba(77, 108, 130, 0.1);
}

.book-header-info {
  flex: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  margin: 0 auto;
}

/* Part Container - Fixed Overflow Issues */
.part-container {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  width: 115px;
  min-width: 80px;
  max-width: 140px;
  text-align: center;
  overflow: hidden;
}

.book-part-name {
  font-weight: bold;
  color: var(--book-part-name-color);
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.book-question-number {
  color: var(--book-accent-color);
  font-size: 0.98rem;
  text-align: center;
  margin-top: 4px;
}

.book-question-number a {
  color: var(--book-primary-color);
  text-decoration: none;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.book-question-number a:hover {
  color: var(--book-primary-hover);
  background-color: rgba(77, 108, 130, 0.1);
}

/* Question Content */
.book-question-content {
  padding: 24px 18px 24px 32px;
  font-size: 1.08rem;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.book-question-content h1,
.book-question-content h2,
.book-question-content h3 {
  color: #222;
  font-family: inherit;
  font-weight: bold;
  word-wrap: break-word;
}

.book-question-content h2 {
  text-align: center;
  margin: 1.5em 0 1em 0;
}

.book-question-content h5 {
  font-size: 1.1rem;
  font-weight: bold;
  color: #3a5a7a;
  margin: 1.2em 0 0.6em 0;
  line-height: 1.3;
}

.book-question-content ol,
.book-question-content ul {
  list-style-position: inside;
  padding-left: 0;
  margin-left: 0;
}

.book-question-content li {
  padding-left: 0.5em;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Next Question Navigation */
.book-next-question {
  text-align: right;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.book-next-question a {
  color: var(--book-primary-color);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 8px 12px 0 12px;
  border-radius: 6px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.book-next-question a:hover {
  color: var(--book-primary-hover);
  background-color: rgba(77, 108, 130, 0.1);
  transform: translateX(3px);
}

/* Questions List */
.book-questions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.book-questions-list li {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  text-align: center;
  word-break: break-word;
  overflow-wrap: break-word;
  display: flex;
  justify-content: center;
}

/* Confissões-specific styles */
.confissoes-book-section {
  margin-bottom: 2.5rem;
  background: rgba(248, 245, 228, 0.4);
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid #e8dcc0;
}

.confissoes-book-title {
  font-family: 'Tagesschrift', 'Skranji', serif;
  font-size: 1.4rem;
  color: var(--book-title-color);
  text-align: center;
  margin-bottom: 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--book-accent-color);
}

.confissoes-chapters-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.8rem;
}

.confissoes-chapters-list li {
  margin: 0;
}

/* Chapter/Question Links with circular numbers (used by Confissões, Catecismo, and Summa) */
.chapter-link,
.confissoes-chapter-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  border: 1px solid #f0ead6;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 50px;
}

.chapter-link:hover,
.confissoes-chapter-link:hover {
  background: rgba(248, 245, 228, 0.9);
  border-color: var(--book-accent-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chapter-number {
  flex-shrink: 0;
  background: var(--book-accent-color);
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
}

.chapter-title {
  flex-grow: 1;
  color: var(--book-primary-color);
  font-size: 1rem;
  line-height: 1.3;
  font-weight: 500;
}

/* Tablet Styles */
@media (max-width: 900px) {
  .book-main-container {
    flex-direction: column;
    gap: 0;
    /* padding: 18px 0; */
  }

  .book-sidebar {
    display: none;
  }

  .book-content {
    max-width: 100vw;
    padding: 18px 4vw;
  }

  .questions-header,
  .book-questions-header {
    gap: 8px;
    padding: 0 8px;
  }

  .back-container {
    width: 85px;
  }

  .part-container {
    width: 80px;
    min-width: 60px;
    max-width: 100px;
  }

  .book-part-name {
    font-size: 0.9rem;
    line-height: 1.1;
  }

  .book-header-info {
    min-width: 0;
    overflow: hidden;
    margin: 0 auto;
  }
}

/* Mobile Styles */
@media (max-width: 600px) {
  .book-title {
    font-size: 1.4rem;
  }

  .book-description {
    font-size: 0.98rem;
  }

  .book-cover {
    max-width: 140px;
  }

  .book-question-content {
    padding: 12px 8px 12px 16px;
    font-size: 0.98rem;
  }

  .book-next-question {
    text-align: center;
    margin-top: 1.5rem;
    justify-content: center;
  }

  .book-next-question a {
    font-size: 0.95rem;
    padding: 10px 16px 0 16px;
  }

  .questions-header,
  .book-questions-header {
    gap: 4px;
    padding: 0 4px;
  }

  .back-container {
    width: 85px;
  }

  .part-container {
    width: 75px;
    min-width: 50px;
    max-width: 85px;
  }

  .book-part-name {
    font-size: 0.8rem;
    line-height: 1.0;
  }
}

/* Mobile responsive for Confissões */
@media (max-width: 768px) {
  .confissoes-chapters-list {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  
  .chapter-link,
  .confissoes-chapter-link {
    padding: 0.7rem 0.8rem;
    gap: 0.6rem;
    min-height: 45px;
  }
  
  .chapter-number {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }
  
  .chapter-title {
    font-size: 0.9rem;
  }
  
  .confissoes-book-title {
    font-size: 1.2rem;
  }
  
  .confissoes-book-section {
    padding: 1rem;
    margin-bottom: 2rem;
  }

  /* Enhanced book parts responsive */
  .book-parts-list {
    gap: 12px;
  }
  
  .book-part-link {
    padding: 14px 24px;
    min-width: 200px;
    font-size: 1.05rem;
  }
}

@media (max-width: 480px) {
  .book-parts-list {
    gap: 10px;
  }
  
  .book-part-link {
    padding: 12px 20px;
    min-width: 180px;
    font-size: 1rem;
    letter-spacing: 0.6px;
  }
  
  .book-part-link:hover,
  .book-part-link:active {
    color: var(--book-accent-color);
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(191, 161, 74, 0.4);
    transform: translateY(-1px);
  }
}
