/* =========================================
   Hunian 68 — Chatbot Widget Stylesheet
   ========================================= */

/* Floating Launcher Button */
.chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--accent, #2783DE);
  color: #ffffff;
  border: 0;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(39, 131, 222, 0.4), 0 2px 8px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 750;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.chatbot-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 30px rgba(39, 131, 222, 0.5), 0 4px 12px rgba(0, 0, 0, 0.16);
}

.chatbot-launcher-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  position: relative;
}

.chatbot-badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background: #25D366;
  border: 2px solid #ffffff;
  border-radius: 50%;
  animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 7px rgba(37, 211, 102, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Chatbot Floating Window */
.chatbot-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #E6E5E3);
  border-radius: 22px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.chatbot-window.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent, #2783DE) 0%, #1761b0 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.chatbot-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
  font-size: 22px;
  position: relative;
  flex-shrink: 0;
}

.chatbot-online-indicator {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #25D366;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.chatbot-header-title h4 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.chatbot-header-title span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  display: block;
}

.chatbot-header-actions {
  display: flex;
  gap: 6px;
}

.chatbot-action-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.chatbot-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Messages Body */
.chatbot-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-soft, #f9f8f7);
  scroll-behavior: smooth;
}

/* Message Bubble */
.chatbot-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: fadeInMsg 0.25s ease-out;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chatbot-msg.bot {
  align-self: flex-start;
}

.chatbot-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-msg-bubble {
  padding: 11px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.chatbot-msg.bot .chatbot-msg-bubble {
  background: var(--bg-card, #ffffff);
  color: var(--ink, #2C2C2B);
  border: 1px solid var(--line, #E6E5E3);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.chatbot-msg.user .chatbot-msg-bubble {
  background: var(--accent, #2783DE);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chatbot-msg-time {
  font-size: 10.5px;
  color: var(--muted, #6f6b65);
  margin-top: 4px;
  display: block;
  text-align: right;
}

.chatbot-msg.user .chatbot-msg-time {
  color: rgba(255, 255, 255, 0.8);
}

/* Message Content Formatting */
.chatbot-msg-bubble p {
  margin: 0 0 6px;
}

.chatbot-msg-bubble p:last-child {
  margin-bottom: 0;
}

.chatbot-msg-bubble ul, .chatbot-msg-bubble ol {
  margin: 6px 0;
  padding-left: 18px;
}

.chatbot-msg-bubble li {
  margin-bottom: 4px;
}

.chatbot-msg-bubble a.chat-link {
  color: var(--accent, #2783DE);
  font-weight: 750;
  text-decoration: underline;
}

.chatbot-msg-bubble a.chat-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ink, #2C2C2B);
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 750;
  padding: 6px 12px;
  border-radius: 8px;
  margin-top: 6px;
  transition: opacity 0.2s;
}

body.dark-mode .chatbot-msg-bubble a.chat-link-btn {
  background: #f0f2f7;
  color: #101216 !important;
}

.chatbot-msg-bubble a.chat-link-btn:hover {
  opacity: 0.9;
}

/* Quick Replies / Chips */
.chatbot-chips-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.chatbot-chips-title {
  font-size: 11.5px;
  font-weight: 750;
  color: var(--muted, #6f6b65);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chatbot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chatbot-chip {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #E6E5E3);
  color: var(--ink, #2C2C2B);
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chatbot-chip:hover {
  border-color: var(--accent, #2783DE);
  background: var(--accent, #2783DE);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--line, #E6E5E3);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--muted, #6f6b65);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Bar */
.chatbot-footer {
  padding: 12px;
  background: var(--bg-card, #ffffff);
  border-top: 1px solid var(--line, #E6E5E3);
}

.chatbot-input-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot-input {
  flex: 1;
  border: 1px solid var(--line, #E6E5E3);
  background: var(--bg-soft, #f9f8f7);
  color: var(--ink, #2C2C2B);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-input:focus {
  border-color: var(--accent, #2783DE);
  background: var(--bg-card, #ffffff);
}

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent, #2783DE);
  color: #ffffff;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: transform 0.2s, background 0.2s;
}

.chatbot-send-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.08);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .chatbot-launcher {
    bottom: 18px;
    right: 18px;
    padding: 10px 14px;
    font-size: 13.5px;
  }
  .chatbot-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }
}
