/* "Chat with the Book" full-screen overlay on the book detail page.
   book_detail.html does not load coach-chat.css, so the small set of
   generic chat-state classes it needs (pending/failed/typing dots) are
   duplicated here rather than shared across pages. */

.book-detail-page .bv-chat-author-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 44px;
  padding: 11px 16px;
  border: 1px solid var(--book-purple);
  border-radius: 999px;
  color: var(--book-purple);
  background: var(--book-surface);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.book-detail-page .book-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: var(--book-bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.book-detail-page .book-chat-overlay.show { opacity: 1; visibility: visible; }

.book-detail-page .book-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 20px;
  border-bottom: 1px solid var(--book-line);
  background: var(--book-surface);
}
.book-detail-page .book-chat-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--book-ink);
  background: var(--book-surface-soft);
  cursor: pointer;
}
.book-detail-page .book-chat-close svg { width: 18px; height: 18px; }
.book-detail-page .book-chat-header-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.book-detail-page .book-chat-header-info div { display: flex; flex-direction: column; min-width: 0; }
.book-detail-page .book-chat-header-info strong { color: var(--book-ink); font-size: 13px; font-weight: 700; }
.book-detail-page .book-chat-header-info span { color: var(--book-purple); font-size: 10px; font-weight: 600; }

.book-detail-page .book-chat-author-initials {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #1a3a5c, #2f76a7);
  font-size: 12px;
  font-weight: 800;
}

.book-detail-page .book-chat-area {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px;
}
.book-detail-page .book-chat-area .chat-transcript {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.book-detail-page .book-chat-area .chat-input-bar { flex: 0 0 auto; margin-top: 12px; }

.book-detail-page .chat-bubble.pending { opacity: .55; }
.book-detail-page .chat-bubble.failed {
  border: 1.5px solid #e85d5d;
  cursor: pointer;
}

.book-detail-page .chat-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 4px 4px 10px 42px;
}
[dir="rtl"] .book-detail-page .chat-typing-indicator { padding: 4px 42px 10px 4px; }
.book-detail-page .chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--book-muted);
  animation: bookChatTypingBounce 1.2s infinite ease-in-out;
}
.book-detail-page .chat-typing-dot:nth-child(2) { animation-delay: .15s; }
.book-detail-page .chat-typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bookChatTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-4px); opacity: 1; }
}
