/* -- Floating Chat Widget ------------------------------------------------ */

/* Bubble trigger button */
.bcp-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #0060a8;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0,96,168,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5em;
  transition: transform .2s, background .2s;
}
.bcp-chat-bubble:hover { background: #004f8c; transform: scale(1.08); }

.bcp-chat-bubble .bcp-unread-dot {
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}
.bcp-chat-bubble.has-unread .bcp-unread-dot { display: block; }

/* Chat window */
.bcp-chat-window {
  position: fixed;
  bottom: 98px;
  right: 28px;
  z-index: 9999;
  width: 360px;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s;
  transform-origin: bottom right;
}

.bcp-chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

@media (max-width: 420px) {
  .bcp-chat-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 82px;
    max-height: 70dvh;
  }
  .bcp-chat-bubble { bottom: 16px; right: 16px; }
}

/* Window header */
.bcp-chat-header {
  background: #0060a8;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.bcp-chat-header .bcp-host-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1em;
  flex-shrink: 0;
}
.bcp-chat-header .bcp-header-info { flex: 1; }
.bcp-chat-header .bcp-header-info h3 { font-size: 0.95em; font-weight: 700; margin: 0; }
.bcp-chat-header .bcp-header-info p  { font-size: 0.75em; opacity: .8; margin: 2px 0 0; }
.bcp-chat-header .bcp-close-btn {
  background: none; border: none; color: rgba(255,255,255,.8);
  font-size: 1.3em; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.bcp-chat-header .bcp-close-btn:hover { color: #fff; background: rgba(255,255,255,.15); }

/* Intro / name-capture panel */
.bcp-chat-intro {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.bcp-chat-intro p { font-size: 0.9em; color: #555; }
.bcp-chat-intro input, .bcp-chat-intro textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9em;
  font-family: inherit;
  outline: none;
}
.bcp-chat-intro input:focus,
.bcp-chat-intro textarea:focus { border-color: #0060a8; box-shadow: 0 0 0 3px rgba(0,96,168,.1); }
.bcp-chat-intro .bcp-start-btn {
  background: #0060a8;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.bcp-chat-intro .bcp-start-btn:hover { background: #004f8c; }
.bcp-chat-intro .bcp-start-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Messages area */
.bcp-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bcp-w-msg-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}
.bcp-w-msg-row.host  { flex-direction: row; }
.bcp-w-msg-row.guest { flex-direction: row-reverse; }

.bcp-w-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 0.65em; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bcp-w-msg-row.host  .bcp-w-avatar { background: #0060a8; }
.bcp-w-msg-row.guest .bcp-w-avatar { background: #34a853; }

.bcp-w-bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.88em;
  line-height: 1.45;
  word-wrap: break-word;
}
.bcp-w-msg-row.host  .bcp-w-bubble { background: #f0f0f0; color: #222; border-bottom-left-radius: 3px; }
.bcp-w-msg-row.guest .bcp-w-bubble { background: #0060a8; color: #fff; border-bottom-right-radius: 3px; }

/* Input bar */
.bcp-chat-footer {
  border-top: 1px solid #eee;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.bcp-chat-footer textarea {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 0.88em;
  font-family: inherit;
  resize: none;
  max-height: 80px;
  outline: none;
  line-height: 1.4;
}
.bcp-chat-footer textarea:focus { border-color: #0060a8; }
.bcp-chat-footer .bcp-send-btn {
  background: #0060a8; color: #fff;
  border: none; border-radius: 50%;
  width: 38px; height: 38px;
  flex-shrink: 0; cursor: pointer;
  font-size: 1em; align-self: flex-end;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.bcp-chat-footer .bcp-send-btn:hover    { background: #004f8c; }
.bcp-chat-footer .bcp-send-btn:disabled { opacity: .5; cursor: not-allowed; }

.bcp-chat-offline { text-align: center; font-size: 0.72em; color: #bbb; padding: 3px 0 8px; }

/* Error message in chat */
.bcp-chat-error {
  text-align: center; font-size: 0.8em;
  color: #c00; padding: 6px; background: #fff0f0;
  border-radius: 6px; margin: 4px 0;
}

/* -- Knowledge Base Widget Styles ---------------------------------------- */

.bcp-screen { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* Search bar */
.bcp-kb-search-wrap {
  padding: 12px 14px 8px;
  flex-shrink: 0;
}
.bcp-kb-search-wrap input {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  font-size: 0.88em;
  font-family: inherit;
  outline: none;
  background: #f7f7f7;
  box-sizing: border-box;
}
.bcp-kb-search-wrap input:focus { border-color: #0060a8; background: #fff; box-shadow: 0 0 0 3px rgba(0,96,168,.1); }

/* Category rows */
#bcp-kb-categories { overflow-y: auto; flex: 1; padding: 4px 0; }

.bcp-kb-cat-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px 16px;
  border: none; background: none; cursor: pointer;
  text-align: left; border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.bcp-kb-cat-row:hover { background: #f5f9ff; }
.bcp-kb-cat-icon  { font-size: 1.3em; flex-shrink: 0; }
.bcp-kb-cat-name  { flex: 1; font-size: 0.9em; color: #222; font-weight: 500; }
.bcp-kb-cat-count { font-size: 0.78em; color: #aaa; background: #f0f0f0; border-radius: 20px; padding: 1px 7px; }
.bcp-kb-cat-arrow { font-size: 1.2em; color: #ccc; }

/* Search results */
#bcp-kb-search-results { overflow-y: auto; flex: 1; }
.bcp-kb-result-row {
  display: flex; flex-direction: column; gap: 2px;
  width: 100%; padding: 10px 16px;
  border: none; background: none; cursor: pointer;
  text-align: left; border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.bcp-kb-result-row:hover { background: #f5f9ff; }
.bcp-kb-result-cat   { font-size: 0.72em; color: #0060a8; font-weight: 600; }
.bcp-kb-result-title { font-size: 0.88em; color: #222; }
.bcp-kb-no-results   { text-align: center; color: #aaa; font-size: 0.85em; padding: 20px; }

/* CTA to start chat */
.bcp-kb-chat-cta {
  border-top: 1px solid #f0f0f0;
  padding: 12px 16px;
  text-align: center;
  flex-shrink: 0;
}
.bcp-kb-chat-cta p { font-size: 0.8em; color: #888; margin: 0 0 8px; }
.bcp-btn-ghost {
  background: none; border: 1.5px solid #0060a8; color: #0060a8;
  padding: 8px 18px; border-radius: 20px; font-size: 0.88em; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.bcp-btn-ghost:hover { background: #0060a8; color: #fff; }

/* Screen nav bar (Back button + title) */
.bcp-screen-nav {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 6px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.bcp-back-btn {
  background: none; border: none; color: #0060a8; font-size: 0.88em;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.bcp-back-btn:hover { background: #f0f7ff; }
.bcp-screen-nav span { font-size: 0.88em; font-weight: 600; color: #333; }

/* Article list */
#bcp-cat-articles { overflow-y: auto; flex: 1; padding: 4px 0; }
.bcp-kb-article-row {
  display: block; width: 100%; padding: 12px 16px;
  border: none; border-bottom: 1px solid #f0f0f0;
  background: none; cursor: pointer; text-align: left;
  font-size: 0.9em; color: #222;
  transition: background .15s;
}
.bcp-kb-article-row::before { content: '  '; color: #0060a8; font-weight: 700; }
.bcp-kb-article-row:hover { background: #f5f9ff; }

/* Article body */
.bcp-article-body { overflow-y: auto; flex: 1; padding: 16px; }
.bcp-article-title { font-size: 1em; font-weight: 700; color: #222; margin: 0 0 12px; line-height: 1.4; }
.bcp-article-content { font-size: 0.88em; color: #444; line-height: 1.65; }
.bcp-article-content strong { color: #222; }
.bcp-article-content br + br { display: block; margin-top: 4px; }

/* Helpful vote */
.bcp-vote-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid #f0f0f0;
  font-size: 0.82em; color: #888;
  flex-shrink: 0;
}
.bcp-vote-row span { flex: 1; }
.bcp-vote-btn {
  background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 20px;
  padding: 4px 12px; font-size: 0.85em; cursor: pointer;
  transition: background .15s;
}
.bcp-vote-btn:hover:not(:disabled) { background: #e8f0fe; border-color: #0060a8; }
.bcp-vote-btn.voted  { background: #e8f0fe; border-color: #0060a8; color: #0060a8; }
.bcp-vote-btn:disabled { opacity: .6; cursor: not-allowed; }
