/* 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: 18px;
}

.book-part-link {
  color: var(--book-primary-color);
  font-size: 1.15rem;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.2s;
}

.book-part-link:visited {
  color: #014475;
}

.book-part-link:hover {
  color: var(--book-accent-color);
}

/* 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;
}

/* 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;
  }
}
