/* ===== Chatbot Bakery - css/chatbot.css ===== */
.bk-chat-launcher {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 950;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: var(--primary, #C8956C);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 30px rgba(44, 24, 16, .28);
  transition: transform .2s ease, background .2s ease;
}
.bk-chat-launcher:hover { background: var(--primary-dark, #A67550); transform: scale(1.06); }
.bk-chat-launcher svg { width: 28px; height: 28px; }
.bk-chat-launcher .bk-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e5534b;
  border: 2px solid #fff;
}
.bk-chat-nudge {
  position: fixed;
  right: 94px;
  bottom: 38px;
  z-index: 949;
  max-width: 220px;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--text, #5A3E2B);
  font-size: .85rem;
  box-shadow: 0 8px 28px rgba(44, 24, 16, .18);
  display: none;
}
.bk-chat-nudge.show { display: block; }

.bk-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  z-index: 951;
  width: 370px;
  max-width: calc(100vw - 24px);
  height: 540px;
  max-height: calc(100vh - 120px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(44, 24, 16, .3);
  font-family: inherit;
}
.bk-chat-panel.open { display: flex; animation: bkPop .22s ease; }
@keyframes bkPop { from { opacity: 0; transform: translateY(14px) scale(.98); } }

.bk-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--dark, #2C1810), var(--dark-brown, #3D2317));
  color: #fff;
}
.bk-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary, #C8956C);
  display: grid;
  place-items: center;
  flex: none;
}
.bk-chat-avatar svg { width: 22px; height: 22px; }
.bk-chat-title { flex: 1; line-height: 1.25; }
.bk-chat-title strong { display: block; font-size: 1rem; }
.bk-chat-title small { opacity: .75; font-size: .75rem; }
.bk-chat-head button {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.bk-chat-head button:hover { background: rgba(255, 255, 255, .15); }

.bk-chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--light-bg, #FDF6EE);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bk-msg {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: .9rem;
  line-height: 1.5;
  white-space: pre-line;
  word-wrap: break-word;
}
.bk-msg.bot { align-self: flex-start; background: #fff; color: var(--text, #5A3E2B); border-bottom-left-radius: 4px; box-shadow: 0 2px 8px rgba(44, 24, 16, .06); }
.bk-msg.user { align-self: flex-end; background: var(--primary, #C8956C); color: #fff; border-bottom-right-radius: 4px; }
.bk-msg a { color: var(--primary-dark, #A67550); font-weight: 600; }
.bk-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.bk-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--primary, #C8956C); animation: bkDot 1s infinite; }
.bk-typing span:nth-child(2) { animation-delay: .15s; }
.bk-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bkDot { 0%, 60%, 100% { opacity: .3; transform: none; } 30% { opacity: 1; transform: translateY(-4px); } }

.bk-products { display: flex; flex-direction: column; gap: 8px; align-self: stretch; }
.bk-product {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(44, 24, 16, .06);
}
.bk-product img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.bk-product-info { flex: 1; min-width: 0; }
.bk-product-info strong { display: block; font-size: .85rem; color: var(--dark, #2C1810); }
.bk-product-info span { color: var(--primary-dark, #A67550); font-weight: 700; font-size: .85rem; }
.bk-product-actions { display: flex; flex-direction: column; gap: 4px; }
.bk-product-actions .btn,
.bk-product-actions a {
  padding: 5px 10px;
  font-size: .72rem;
  border-radius: 20px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}
.bk-product-actions .add-to-cart { border: 0; background: var(--primary, #C8956C); color: #fff; }
.bk-product-actions a { border: 1px solid var(--primary-light, #E8C9A8); color: var(--text, #5A3E2B); text-decoration: none; }

.bk-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; background: var(--light-bg, #FDF6EE); }
.bk-chip {
  border: 1px solid var(--primary-light, #E8C9A8);
  background: #fff;
  color: var(--text, #5A3E2B);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: .78rem;
  cursor: pointer;
  transition: background .15s;
}
.bk-chip:hover { background: var(--primary-light, #E8C9A8); }

.bk-chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #f0e4d8; background: #fff; }
.bk-chat-form input {
  flex: 1;
  border: 1px solid var(--primary-light, #E8C9A8);
  border-radius: 24px;
  padding: 10px 16px;
  font: inherit;
  font-size: .9rem;
  outline: none;
}
.bk-chat-form input:focus { border-color: var(--primary, #C8956C); }
.bk-chat-form button {
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary, #C8956C);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bk-chat-form button svg { width: 18px; height: 18px; }
.bk-chat-note { text-align: center; font-size: .68rem; color: var(--text-light, #8B6F5E); padding: 0 12px 8px; background: #fff; }

/* tránh đè lên nút "Lên đầu trang" và thông báo */
.has-chatbot .back-to-top { bottom: 96px; }
.has-chatbot .toast-box { bottom: 96px; }

@media (max-width: 520px) {
  .bk-chat-panel { right: 8px; left: 8px; width: auto; bottom: 88px; height: calc(100vh - 110px); }
  .bk-chat-launcher { right: 14px; bottom: 16px; }
  .has-chatbot .back-to-top { right: 16px; bottom: 88px; }
  .bk-chat-nudge { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { .bk-chat-panel.open, .bk-typing span { animation: none; } }
