/* ============================================================
   BYBEIT SUPPORT — Chatbot Widget
   ============================================================ */

/* ── Floating Button ──────────────────────────────────────── */
.cb-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background-color: var(--link);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px rgba(0, 113, 227, 0.40);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cb-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 113, 227, 0.50);
}

.cb-fab i {
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* ── Chat Window ──────────────────────────────────────────── */
.cb-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 8999;
  width: 360px;
  max-height: 540px;
  display: flex;
  flex-direction: column;
  background: var(--surface-overlay);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--divider);
  overflow: hidden;
  transform-origin: bottom right;

  /* hidden by default */
  transform: scale(0.85) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.18s ease;
}

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

/* ── Header ───────────────────────────────────────────────── */
.cb-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background-color: var(--link);
  color: #fff;
  flex-shrink: 0;
}

.cb-header__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.cb-header__title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.cb-header__subtitle {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 1px;
}

.cb-new-chat,
.cb-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
}

.cb-new-chat:hover,
.cb-close:hover { color: #fff; }

/* ── Messages ─────────────────────────────────────────────── */
.cb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.cb-messages::-webkit-scrollbar { width: 4px; }
.cb-messages::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 2px;
  transition: background 0.3s;
}
.cb-messages:hover::-webkit-scrollbar-thumb,
.cb-messages::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}

/* Message bubble */
.cb-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.cb-msg--bot { align-self: flex-start; }
.cb-msg--user { align-self: flex-end; }

.cb-msg__bubble {
  padding: 10px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.cb-msg--bot .cb-msg__bubble {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.cb-msg--user .cb-msg__bubble {
  background-color: var(--link);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Article recommendation cards */
.cb-articles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.cb-article-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  transition: background-color 0.15s, border-color 0.15s;
}

.cb-article-card:hover {
  background-color: var(--bg-hover);
  border-color: var(--link);
}

.cb-article-card__icon {
  flex-shrink: 0;
  color: var(--link);
  font-size: 15px;
}

.cb-article-card__title { flex: 1; }

.cb-article-card__arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 13px;
}

/* Feedback row */
.cb-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  align-self: flex-start;
}

.cb-feedback__label {
  font-size: 12px;
  color: var(--text-tertiary);
}

.cb-feedback__btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.cb-feedback__btn--yes:hover {
  background-color: rgba(52, 199, 89, 0.12);
  border-color: #34c759;
  color: #34c759;
}

.cb-feedback__btn--no:hover {
  background-color: rgba(255, 59, 48, 0.10);
  border-color: #ff3b30;
  color: #ff3b30;
}

.cb-feedback__resolved {
  font-size: 12px;
  color: #34c759;
}

/* Typing indicator */
.cb-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  background-color: var(--bg-secondary);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.cb-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-tertiary);
  animation: cb-bounce 1.2s infinite ease-in-out;
}
.cb-typing span:nth-child(2) { animation-delay: 0.18s; }
.cb-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes cb-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ── Input row ────────────────────────────────────────────── */
.cb-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--divider);
  background: transparent;
  flex-shrink: 0;
}

.cb-input {
  flex: 1;
  padding: 9px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background-color: var(--bg-secondary);
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}

.cb-input::placeholder { color: var(--text-placeholder); }
.cb-input:focus { border-color: var(--link); }

.cb-send {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--link);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: opacity 0.15s;
}

.cb-send:hover { opacity: 0.88; }
.cb-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 400px) {
  .cb-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
  }
  .cb-fab {
    right: 16px;
    bottom: 16px;
  }
}
