/* Hestia FAB — bếp lửa trên trang sách, theo token reader (không teal garment) */

.hestia-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1200;
  color: #fffaf3;
  background: radial-gradient(circle at 35% 30%, #f59e0b, #b45309 58%, #7c2d12);
  box-shadow: 0 8px 22px rgba(180, 83, 9, 0.32), 0 2px 6px rgba(44, 39, 32, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}
.hestia-fab:hover { transform: scale(1.07); }
.hestia-fab.is-open { background: var(--text-muted); box-shadow: var(--shadow-sm); }

.hestia-panel {
  position: fixed;
  right: 22px;
  bottom: 88px;
  width: min(400px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  z-index: 1190;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hestia-panel.is-open { display: flex; }

.hestia-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-subtle);
}
.hestia-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hestia-title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}
.hestia-ctx {
  font-size: 0.68rem;
  color: var(--amber);
  background: var(--amber-subtle);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.hestia-icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.hestia-icon-btn:hover { background: var(--bg-hover); color: var(--text-main); }

.hestia-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hestia-welcome { font-size: 0.86rem; color: var(--text-muted); line-height: 1.5; }
.hestia-welcome strong { color: var(--text-main); }
.hestia-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.hestia-chip {
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}
.hestia-chip:hover { border-color: var(--amber); color: var(--amber); }

.hestia-bubble { max-width: 92%; font-size: 0.86rem; line-height: 1.5; }
.hestia-bubble.user {
  align-self: flex-end;
  background: var(--primary-subtle);
  color: var(--text-main);
  padding: 8px 11px;
  border-radius: 12px 12px 4px 12px;
}
.hestia-bubble.agent { align-self: flex-start; color: var(--text-main); }
.hestia-bubble.agent em { font-style: italic; }
.hestia-bubble.agent p { margin: 0 0 0.55em; }
.hestia-bubble.agent p:last-child { margin: 0; }
.hestia-bubble.agent h3 {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  margin: 0.7em 0 0.35em;
}
.hestia-bubble.agent ul {
  margin: 0.35em 0 0.65em;
  padding-left: 1.15em;
}
.hestia-bubble.agent li { margin: 0.22em 0; }
.hestia-bubble.agent blockquote {
  margin: 0.55em 0 0.75em;
  padding: 0.7em 0.85em;
  border-left: 3px solid var(--amber);
  background: var(--bg-subtle);
  border-radius: 0 10px 10px 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-main);
}
.hestia-bubble.agent code {
  font-family: var(--font-mono);
  font-size: 0.78em;
  background: var(--bg-subtle);
  padding: 0 4px;
  border-radius: 4px;
}
.hestia-status { font-size: 0.75rem; color: var(--amber); font-style: italic; }

.hestia-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.hestia-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--border-medium);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  font-size: 0.86rem;
  background: var(--bg-card);
  color: var(--text-main);
  max-height: 96px;
}
.hestia-input:focus { outline: 2px solid var(--amber-subtle); border-color: var(--amber); }
.hestia-send {
  width: 40px;
  border: 0;
  border-radius: 10px;
  background: var(--amber);
  color: #fffaf3;
  cursor: pointer;
}
.hestia-send:disabled { opacity: 0.45; cursor: default; }

@media (max-width: 640px) {
  .hestia-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .hestia-fab { right: 16px; bottom: 16px; }
}
