/* ========================================
   BIBLE CHAT ASSISTANT + WORD TOOLTIPS
   Estilos para o widget de chat e tooltips
   ======================================== */

/* ---- WORD TOOLTIPS ---- */

.bible-special-word {
  color: var(--accent, #c46849);
  cursor: help;
  border-bottom: 1px dotted currentColor;
  transition: opacity 0.15s;
}

.bible-special-word:hover,
.bible-special-word:focus {
  opacity: 0.8;
}

.bible-tooltip {
  position: fixed;
  z-index: 950;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  animation: tooltipFadeIn 0.15s ease forwards;

  /* Dark theme (default) */
  background: rgba(30, 35, 42, 0.97);
  color: #e0d8d0;
  border: 1px solid rgba(196, 104, 73, 0.4);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

@keyframes tooltipFadeIn {
  to {
    opacity: 1;
  }
}

/* Tooltip - Sepia */
.kindle-reader.sepia .bible-tooltip {
  background: rgba(60, 48, 32, 0.97);
  color: #f4ecd8;
  border-color: rgba(139, 90, 43, 0.5);
}

/* Tooltip - Light */
.kindle-reader.light .bible-tooltip {
  background: rgba(255, 255, 255, 0.97);
  color: #333;
  border-color: #ccc;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ---- CHAT WIDGET ---- */

/* Trigger Button */
.bible-chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(196, 104, 73, 0.5);
  background: rgba(15, 20, 25, 0.95);
  color: var(--accent, #c46849);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.bible-chat-trigger:hover {
  transform: scale(1.08);
  border-color: var(--accent, #c46849);
  box-shadow: 0 6px 24px rgba(196, 104, 73, 0.3);
}

.bible-chat-trigger svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

/* Trigger - Sepia */
.kindle-reader.sepia .bible-chat-trigger {
  background: rgba(60, 48, 32, 0.95);
  border-color: rgba(139, 90, 43, 0.5);
  color: #8b5a2b;
}

/* Trigger - Light */
.kindle-reader.light .bible-chat-trigger {
  background: rgba(255, 255, 255, 0.95);
  border-color: #ccc;
  color: var(--accent, #c46849);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Chat Panel */
.bible-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 910;
  width: 360px;
  max-height: 520px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;

  /* Dark theme default */
  background: rgba(15, 20, 25, 0.98);
  border: 1px solid rgba(196, 104, 73, 0.3);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.bible-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Panel - Sepia */
.kindle-reader.sepia .bible-chat-panel {
  background: rgba(244, 236, 216, 0.98);
  border-color: rgba(139, 90, 43, 0.3);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
}

/* Panel - Light */
.kindle-reader.light .bible-chat-panel {
  background: rgba(255, 255, 255, 0.98);
  border-color: #ddd;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

/* Chat Header */
.bible-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(196, 104, 73, 0.2);
  flex-shrink: 0;
}

.bible-chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent, #c46849);
  font-size: 0.95rem;
  font-weight: 600;
}

.bible-chat-header-title svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.bible-chat-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}

.bible-chat-close:hover {
  color: var(--accent, #c46849);
}

/* Sepia header */
.kindle-reader.sepia .bible-chat-header {
  border-color: rgba(139, 90, 43, 0.2);
}

.kindle-reader.sepia .bible-chat-header-title {
  color: #8b5a2b;
}

/* Context Bar */
.bible-chat-context {
  padding: 8px 16px;
  font-size: 0.78rem;
  color: #888;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kindle-reader.sepia .bible-chat-context {
  color: #8b7a6a;
  border-color: rgba(139, 90, 43, 0.1);
}

.kindle-reader.light .bible-chat-context {
  color: #999;
  border-color: #eee;
}

/* Quick Actions */
.bible-chat-quick-actions {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.bible-chat-quick-btn {
  background: rgba(196, 104, 73, 0.1);
  border: 1px solid rgba(196, 104, 73, 0.25);
  color: var(--accent, #c46849);
  padding: 5px 10px;
  border-radius: 14px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.bible-chat-quick-btn:hover {
  background: rgba(196, 104, 73, 0.2);
  border-color: var(--accent, #c46849);
}

/* Quick Actions - Sepia */
.kindle-reader.sepia .bible-chat-quick-actions {
  border-color: rgba(139, 90, 43, 0.1);
}

.kindle-reader.sepia .bible-chat-quick-btn {
  background: rgba(139, 90, 43, 0.1);
  border-color: rgba(139, 90, 43, 0.25);
  color: #8b5a2b;
}

/* Quick Actions - Light */
.kindle-reader.light .bible-chat-quick-actions {
  border-color: #eee;
}

.kindle-reader.light .bible-chat-quick-btn {
  background: rgba(196, 104, 73, 0.08);
  border-color: rgba(196, 104, 73, 0.2);
}

/* Messages Area */
.bible-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 160px;
  max-height: 280px;
}

.bible-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.bible-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(196, 104, 73, 0.3);
  border-radius: 2px;
}

/* Message Bubbles */
.bible-chat-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.bible-chat-msg.assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  color: #d0c8c0;
  border-bottom-left-radius: 4px;
}

.bible-chat-msg.user {
  align-self: flex-end;
  background: rgba(196, 104, 73, 0.2);
  color: #e8e0d8;
  border-bottom-right-radius: 4px;
}

.bible-chat-msg.error {
  align-self: flex-start;
  background: rgba(244, 67, 54, 0.15);
  color: #f88;
  border-bottom-left-radius: 4px;
  font-size: 0.8rem;
}

/* Messages - Sepia */
.kindle-reader.sepia .bible-chat-msg.assistant {
  background: rgba(139, 90, 43, 0.1);
  color: #4a3c2e;
}

.kindle-reader.sepia .bible-chat-msg.user {
  background: rgba(139, 90, 43, 0.2);
  color: #3d3020;
}

/* Messages - Light */
.kindle-reader.light .bible-chat-msg.assistant {
  background: #f5f5f5;
  color: #333;
}

.kindle-reader.light .bible-chat-msg.user {
  background: rgba(196, 104, 73, 0.12);
  color: #222;
}

/* Typing indicator */
.bible-chat-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  align-self: flex-start;
}

.bible-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(196, 104, 73, 0.5);
  animation: typingBounce 1.2s infinite;
}

.bible-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.bible-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-6px);
  }
}

/* Input Area */
.bible-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(196, 104, 73, 0.2);
  flex-shrink: 0;
}

.bible-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(196, 104, 73, 0.2);
  border-radius: 8px;
  color: #e0d8d0;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  outline: none;
  transition: border-color 0.15s;
}

.bible-chat-input:focus {
  border-color: var(--accent, #c46849);
}

.bible-chat-input::placeholder {
  color: #666;
}

/* Input - Sepia */
.kindle-reader.sepia .bible-chat-input-area {
  border-color: rgba(139, 90, 43, 0.2);
}

.kindle-reader.sepia .bible-chat-input {
  background: rgba(139, 90, 43, 0.08);
  border-color: rgba(139, 90, 43, 0.2);
  color: #3d3020;
}

.kindle-reader.sepia .bible-chat-input::placeholder {
  color: #a09080;
}

/* Input - Light */
.kindle-reader.light .bible-chat-input-area {
  border-color: #eee;
}

.kindle-reader.light .bible-chat-input {
  background: #f8f8f8;
  border-color: #ddd;
  color: #222;
}

.kindle-reader.light .bible-chat-input::placeholder {
  color: #aaa;
}

/* Send Button */
.bible-chat-send {
  background: var(--accent, #c46849);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.bible-chat-send:hover {
  opacity: 0.85;
}

.bible-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.bible-chat-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Login CTA (when not authenticated) */
.bible-chat-login-cta {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 28px;
  cursor: pointer;
  border: 1px solid rgba(196, 104, 73, 0.4);
  background: rgba(15, 20, 25, 0.95);
  color: var(--accent, #c46849);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.bible-chat-login-cta:hover {
  border-color: var(--accent, #c46849);
  box-shadow: 0 6px 24px rgba(196, 104, 73, 0.3);
}

.bible-chat-login-cta svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Login CTA - Sepia */
.kindle-reader.sepia .bible-chat-login-cta {
  background: rgba(60, 48, 32, 0.95);
  border-color: rgba(139, 90, 43, 0.4);
  color: #8b5a2b;
}

/* Login CTA - Light */
.kindle-reader.light .bible-chat-login-cta {
  background: rgba(255, 255, 255, 0.95);
  border-color: #ccc;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* ---- MOBILE RESPONSIVE ---- */

@media (max-width: 480px) {
  .bible-chat-trigger,
  .bible-chat-login-cta {
    bottom: 16px;
    right: 16px;
  }

  .bible-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 75vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .bible-chat-panel.open {
    transform: translateY(0);
  }
}

@media (max-width: 768px) and (min-width: 481px) {
  .bible-chat-panel {
    width: 320px;
  }
}
