/* ============================================================
   chatbot.css — BookKeepPro Chatbot Widget (Ledger system)
   ============================================================ */

.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  z-index: 9998;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, background 0.3s ease;
}
.chatbot-fab:hover { transform: scale(1.07); background: var(--emerald-dark); }
.chatbot-fab:active { transform: scale(0.96); }
.chatbot-fab .fab-icon { transition: transform 0.3s ease; }
.chatbot-fab.open .fab-icon { transform: rotate(90deg); }

.chatbot-fab::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--brass);
  opacity: 0;
  animation: chatPulse 2.5s ease-out infinite;
}
.chatbot-fab.open::before { animation: none; opacity: 0; }

@keyframes chatPulse {
  0%   { transform: scale(1);   opacity: 0.45; }
  100% { transform: scale(1.4); opacity: 0;   }
}

.chatbot-fab .notif-dot {
  position: absolute;
  top: 2px; right: 2px;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--brass);
  border: 2px solid var(--ink);
  animation: dotBounce 1.5s ease infinite;
}
.chatbot-fab.open .notif-dot { display: none; }

@keyframes dotBounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.2); } }

.chatbot-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 380px;
  max-height: 520px;
  border-radius: var(--radius-lg);
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 9999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-window.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.chatbot-header {
  background: var(--ink);
  background-image: var(--ruled);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.chatbot-header .bot-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--brass);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0; color: #fff;
}
.chatbot-header .bot-info h4 { font-size: 14px; font-weight: 600; margin: 0; color: #fff; font-family: var(--font-body); }
.chatbot-header .bot-info span { font-size: 11px; opacity: 0.75; }
.chatbot-header .close-chat {
  margin-left: auto; background: rgba(255,255,255,0.12); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.chatbot-header .close-chat:hover { background: rgba(255,255,255,0.25); }

.chatbot-messages {
  flex: 1; overflow-y: auto; padding: 22px 18px;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--paper);
  min-height: 200px; max-height: 380px; scroll-behavior: smooth;
}
.chatbot-welcome-text {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 8px; padding: 10px;
  background: var(--emerald-light);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31,93,70,0.15);
}
.chatbot-welcome-text p { font-size: 13px; font-weight: 500; color: var(--ink); margin: 0; }
.chatbot-welcome-text .sparkle { font-size: 17px; color: var(--brass); }
.chatbot-messages::-webkit-scrollbar { width: 5px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #d8d0b6; border-radius: 10px; }

.chat-msg {
  max-width: 85%; padding: 10px 14px; border-radius: 13px;
  font-size: 13px; line-height: 1.5; animation: msgSlideIn 0.3s ease; word-wrap: break-word;
}
@keyframes msgSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-msg.bot {
  background: #fff; color: var(--ink); border: 1px solid var(--border);
  border-bottom-left-radius: 4px; align-self: flex-start; box-shadow: var(--shadow-xs);
}
.chat-msg.user {
  background: var(--emerald); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end;
}

.typing-indicator { display: flex; gap: 4px; padding: 12px 16px; align-self: flex-start; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald); opacity: 0.4; animation: typingDot 1.2s ease-in-out infinite; }
.typing-indicator span:nth-child(2) { animation-delay: 0.15s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-6px); opacity: 1; } }

.quick-replies { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.quick-reply-btn {
  background: #fff; border: 1.5px solid var(--border); color: var(--ink);
  padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-align: left; transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
  font-family: inherit; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-xs);
}
.quick-reply-btn:hover { background: var(--emerald-light); border-color: var(--emerald); color: var(--emerald-dark); transform: translateY(-1px); }
.quick-reply-btn .qr-icon { font-size: 16px; flex-shrink: 0; }

.doc-status-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xs); padding: 10px 12px; margin-top: 6px; font-size: 12px; }
.doc-status-card .doc-name { font-weight: 600; color: var(--ink); margin-bottom: 4px; font-size: 13px; }
.doc-status-card .doc-year { color: var(--muted); font-size: 11px; }
.doc-status-card .doc-badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; font-family: var(--font-mono); }
.doc-badge.pending  { background: var(--warn-bg);    color: var(--brass-dark); }
.doc-badge.approved { background: var(--success-bg); color: var(--success); }
.doc-badge.rejected { background: var(--error-bg);   color: var(--error); }
.doc-status-card .doc-note { margin-top: 4px; color: var(--muted); font-style: italic; font-size: 11px; }

.status-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.summary-item { text-align: center; padding: 8px 4px; border-radius: var(--radius-xs); background: var(--paper); }
.summary-item .count { font-family: var(--font-mono); font-size: 19px; font-weight: 600; display: block; }
.summary-item .label { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.summary-item.pending  .count { color: var(--brass-dark); }
.summary-item.approved .count { color: var(--success); }
.summary-item.rejected .count { color: var(--error); }

.faq-question {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 9px 12px; font-size: 12.5px; cursor: pointer; transition: all 0.2s ease;
  text-align: left; color: var(--ink); width: 100%; font-family: inherit; display: block; margin-top: 4px;
}
.faq-question:hover { border-color: var(--emerald); color: var(--emerald); background: var(--emerald-light); }

.back-btn {
  background: none; border: none; color: var(--emerald); cursor: pointer; font-size: 12px;
  padding: 4px 0; font-family: inherit; font-weight: 500; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 4px;
}
.back-btn:hover { text-decoration: underline; }

@media (max-width: 480px) {
  .chatbot-window { bottom: 0; right: 0; left: 0; width: 100%; max-height: 75vh; border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .chatbot-fab { bottom: 16px; right: 16px; width: 50px; height: 50px; font-size: 22px; }
}


