/* ===== FlipFiles Assistant Chatbot ===== */

#ff-chat-launcher {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--primary, #1a56db);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.18);
  z-index: 9998;
  border: none;
  transition: transform .15s ease, box-shadow .15s ease;
  font-size: 26px;
}
#ff-chat-launcher:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(0,0,0,.24);
}
#ff-chat-launcher .ff-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent, #f59e0b);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}

#ff-chat-window {
  position: fixed;
  bottom: 92px;
  right: 22px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 500px;
  max-height: calc(100vh - 140px);
  background: var(--bg, #fff);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  border: 1px solid var(--border, #e2e8f0);
  font-family: inherit;
  transform: translateY(12px) scale(.98);
  opacity: 0;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease;
}
#ff-chat-window.ff-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

#ff-chat-header {
  background: var(--primary, #1a56db);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
#ff-chat-header .ff-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
}
#ff-chat-header .ff-chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
#ff-chat-header .ff-chat-sub {
  font-size: 11px;
  font-weight: 400;
  opacity: .85;
  margin-top: 2px;
}
#ff-chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  opacity: .85;
  border-radius: 6px;
}
#ff-chat-close:hover { opacity: 1; background: rgba(255,255,255,.12); }

#ff-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
}

.ff-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}
.ff-msg a { color: var(--primary, #1a56db); font-weight: 600; text-decoration: underline; }
.ff-msg.ff-bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-bottom-left-radius: 4px;
  color: var(--text, #0f172a);
}
.ff-msg.ff-user {
  align-self: flex-end;
  background: var(--primary, #1a56db);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ff-msg.ff-bot ul {
  margin: 6px 0 0 0;
  padding-left: 18px;
}
.ff-msg.ff-bot li { margin-bottom: 3px; }

.ff-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  align-self: flex-start;
  max-width: 100%;
}
.ff-quick-replies button {
  background: var(--primary-light, #ebf0ff);
  color: var(--primary, #1a56db);
  border: 1px solid var(--primary-mid, #c3d3ff);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s ease;
}
.ff-quick-replies button:hover {
  background: var(--primary-mid, #c3d3ff);
}

#ff-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border, #e2e8f0);
  background: #fff;
  flex-shrink: 0;
}
#ff-chat-input {
  flex: 1;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}
#ff-chat-input:focus { border-color: var(--primary, #1a56db); }
#ff-chat-send {
  background: var(--primary, #1a56db);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}
#ff-chat-send:hover { background: var(--primary-dark, #1342b0); }

@media (max-width: 480px) {
  #ff-chat-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
    height: 70vh;
  }
  #ff-chat-launcher {
    right: 16px;
    bottom: 16px;
  }
}
