/* rv-chat.css — Widget chat AI cho Reformed Vietnam.
   Dùng đúng biến màu của site (var --burgundy, --gold, --surface...) nên tự
   theo theme sáng/tối của trang. Nút chat ở góc dưới-TRÁI — góc dưới-phải
   đã có nút "về đầu trang" (.to-top). Không phụ thuộc file nào khác. */

.rv-chat-fab {
  position: fixed; left: 18px; bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  height: 56px; min-width: 56px; padding: 0 14px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: var(--burgundy, #a84343); color: #fff;
  box-shadow: var(--shadow, 0 8px 30px rgba(0, 0, 0, .18));
  font-family: inherit;
}
.rv-chat-fab:hover { background: var(--burgundy-deep, #8f3535); }
.rv-chat-fab svg { color: var(--gold, #c9a45c); flex-shrink: 0; }
.rv-chat-fab-label { font-size: 15px; font-weight: 700; white-space: nowrap; }

.rv-chat-panel {
  position: fixed; z-index: 61;
  left: 0; right: 0; bottom: 0; height: min(72vh, 600px);
  display: flex; flex-direction: column;
  background: var(--surface, #fff); color: var(--ink, #2b2118);
  border-top: 1px solid var(--line, #e5ddd0);
  border-radius: 18px 18px 0 0;
  box-shadow: var(--shadow, 0 8px 30px rgba(0, 0, 0, .18));
  font-family: inherit;
}
/* SỬA 15/11: display:flex ở trên thắng thuộc tính hidden của trình duyệt
   (hidden chỉ là display:none ở stylesheet mặc định), nên nút X bấm mà panel
   không biến mất. Quy tắc này bắt hidden phải thắng. */
.rv-chat-panel[hidden] { display: none !important; }
@media (min-width: 640px) {
  .rv-chat-panel {
    left: 18px; right: auto; bottom: 86px;
    width: 380px; height: 560px; max-height: calc(100vh - 110px);
    border: 1px solid var(--line, #e5ddd0);
    border-radius: 16px;
  }
}

.rv-chat-head {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line, #e5ddd0);
}
.rv-chat-titles { flex: 1; min-width: 0; }
.rv-chat-titles strong { display: block; font-size: 16px; line-height: 1.3; }
.rv-chat-sub { display: block; font-size: 12.5px; color: var(--ink-soft, #6b5d4f); margin-top: 2px; }
.rv-chat-close {
  flex-shrink: 0; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--surface-2, #f7f2e8); color: var(--ink, #2b2118);
  font-size: 15px; cursor: pointer; line-height: 1;
}
.rv-chat-close:hover { background: var(--line, #e5ddd0); }

.rv-chat-body {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.rv-chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.rv-chat-chip {
  font-family: inherit; font-size: 13.5px; cursor: pointer;
  background: var(--surface-2, #f7f2e8); color: var(--ink, #2b2118);
  border: 1px solid var(--line, #e5ddd0); border-radius: 999px;
  padding: 7px 12px; text-align: left;
}
.rv-chat-chip:hover { border-color: var(--gold, #c9a45c); }

.rv-chat-msg { display: flex; flex-direction: column; max-width: 92%; }
.rv-chat-user { align-self: flex-end; align-items: flex-end; }
.rv-chat-ai { align-self: flex-start; align-items: flex-start; }
.rv-chat-bubble {
  padding: 10px 13px; border-radius: 14px; font-size: 15px; line-height: 1.6;
  white-space: pre-line; overflow-wrap: break-word;
}
.rv-chat-user .rv-chat-bubble {
  background: var(--burgundy, #a84343); color: #fff;
  border-bottom-right-radius: 4px;
}
.rv-chat-ai .rv-chat-bubble {
  background: var(--surface-2, #f7f2e8); color: var(--ink, #2b2118);
  border-bottom-left-radius: 4px;
}
.rv-chat-disclaimer {
  font-size: 11.5px; color: var(--ink-soft, #6b5d4f);
  margin-top: 4px; line-height: 1.4;
}
.rv-chat-typing span {
  display: inline-block; width: 7px; height: 7px; margin-right: 4px;
  border-radius: 50%; background: var(--ink-soft, #6b5d4f);
  animation: rv-chat-blink 1.2s infinite;
}
.rv-chat-typing span:nth-child(2) { animation-delay: .2s; }
.rv-chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes rv-chat-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.rv-chat-notice {
  font-size: 14px; color: var(--ink-soft, #6b5d4f);
  background: var(--surface-2, #f7f2e8);
  border: 1px solid var(--line, #e5ddd0); border-radius: 10px;
  padding: 10px 12px; line-height: 1.5;
}
.rv-chat-card {
  display: block; text-decoration: none; color: var(--ink, #2b2118);
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e5ddd0); border-radius: 10px;
  padding: 10px 12px; margin-top: 2px;
}
.rv-chat-card:hover { border-color: var(--gold, #c9a45c); }
.rv-chat-card strong { display: block; font-size: 14.5px; color: var(--burgundy, #a84343); }
.rv-chat-card span { display: block; font-size: 13px; color: var(--ink-soft, #6b5d4f); margin-top: 2px; }

.rv-chat-foot {
  display: flex; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--line, #e5ddd0);
}
.rv-chat-foot input {
  flex: 1; min-width: 0; font-family: inherit; font-size: 15px;
  color: var(--ink, #2b2118);
  background: var(--surface-2, #f7f2e8);
  border: 1px solid var(--line, #e5ddd0); border-radius: 999px;
  padding: 10px 14px; outline: none;
}
.rv-chat-foot input:focus { border-color: var(--gold, #c9a45c); }
.rv-chat-foot input:disabled { opacity: .55; }
.rv-chat-send {
  font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--burgundy, #a84343); color: #fff;
  border: 0; border-radius: 999px; padding: 10px 18px;
}
.rv-chat-send:hover { background: var(--burgundy-deep, #8f3535); }
.rv-chat-send:disabled { opacity: .55; cursor: default; }

.rv-chat-links { padding: 0 16px 12px; font-size: 13.5px; }
.rv-chat-links a { color: var(--burgundy, #a84343); text-decoration: none; }
.rv-chat-links a:hover { text-decoration: underline; }
