/* Customer-support chatbot widget — floating button + panel.
   Self-contained: works on any site, no dependency on host page styles. */

.cb-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #111111;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  z-index: 99990;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  padding: 0;
}
.cb-fab:hover { transform: scale(1.06); box-shadow: 0 8px 28px rgba(0,0,0,0.34); }
.cb-fab:focus-visible { outline: 3px solid #4d90fe; outline-offset: 2px; }
.cb-fab svg { width: 28px; height: 28px; }
.cb-fab .cb-fab-close { display: none; }
.cb-fab.cb-open .cb-fab-chat { display: none; }
.cb-fab.cb-open .cb-fab-close { display: block; }

.cb-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 130px);
  background: #ffffff;
  color: #111111;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99991;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.cb-panel.cb-open { opacity: 1; transform: none; pointer-events: auto; }

.cb-header {
  background: #111111;
  color: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.cb-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #ffffff; color: #111111;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex: 0 0 auto;
}
.cb-header-text { flex: 1 1 auto; min-width: 0; }
.cb-name { font-weight: 700; font-size: 15px; }
.cb-status { font-size: 12px; color: #bdbdbd; display: flex; align-items: center; gap: 6px; }
.cb-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4caf50; display: inline-block; }
.cb-close {
  background: transparent; border: none; color: #ffffff;
  font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.cb-close:hover { background: rgba(255,255,255,0.14); }
.cb-close:focus-visible { outline: 2px solid #ffffff; }

.cb-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fafafa;
}
.cb-msg { max-width: 85%; padding: 10px 13px; border-radius: 14px; word-wrap: break-word; }
.cb-msg p { margin: 0 0 8px; }
.cb-msg p:last-child { margin-bottom: 0; }
.cb-msg ul { margin: 6px 0; padding-left: 20px; }
.cb-msg li { margin: 3px 0; }
.cb-bot { align-self: flex-start; background: #eeeeee; color: #111111; border-bottom-left-radius: 4px; }
.cb-user { align-self: flex-end; background: #111111; color: #ffffff; border-bottom-right-radius: 4px; }
.cb-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.cb-msg a:hover { opacity: 0.8; }
.cb-cta { display: inline-block; margin: 8px 8px 0 0; padding: 8px 14px; border-radius: 999px;
  background: #111111; color: #ffffff !important; text-decoration: none !important; font-weight: 700; }
.cb-cta:hover { opacity: 0.85; }

.cb-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.cb-typing span { width: 7px; height: 7px; border-radius: 50%; background: #9e9e9e; animation: cb-blink 1.2s infinite; }
.cb-typing span:nth-child(2) { animation-delay: 0.2s; }
.cb-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cb-blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.cb-chips {
  flex: 0 0 auto;
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
}
.cb-chips:empty { display: none; }
.cb-chip {
  border: 1.5px solid #111111; background: #ffffff; color: #111111;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background 0.15s ease, color 0.15s ease;
}
.cb-chip:hover { background: #111111; color: #ffffff; }
.cb-chip:focus-visible { outline: 3px solid #4d90fe; outline-offset: 2px; }

.cb-input-row {
  flex: 0 0 auto;
  display: flex; gap: 8px;
  padding: 10px 12px 12px;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
}
.cb-input {
  flex: 1 1 auto; min-width: 0;
  border: 1.5px solid #d5d5d5; border-radius: 999px;
  padding: 10px 15px; font-size: 14px; font-family: inherit; color: #111111; background: #ffffff;
}
.cb-input:focus { outline: none; border-color: #111111; }
.cb-send {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  border: none; background: #111111; color: #ffffff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cb-send:hover { opacity: 0.85; }
.cb-send:focus-visible { outline: 3px solid #4d90fe; outline-offset: 2px; }
.cb-send svg { width: 20px; height: 20px; }

.cb-powered { flex: 0 0 auto; text-align: center; font-size: 10px; color: #9e9e9e; padding: 4px 0 8px; background: #ffffff; }

@media (max-width: 480px) {
  .cb-fab { right: 14px; bottom: 14px; width: 54px; height: 54px; }
  .cb-panel { right: 8px; left: 8px; bottom: 80px; width: auto; max-width: none; height: 70vh; }
}

@media (prefers-color-scheme: dark) {
  .cb-panel { background: #1c1c1e; color: #f2f2f2; }
  .cb-messages { background: #141416; }
  .cb-bot { background: #2c2c2e; color: #f2f2f2; }
  .cb-chips, .cb-input-row, .cb-powered { background: #1c1c1e; border-top-color: #38383a; }
  .cb-chip { background: #1c1c1e; color: #f2f2f2; border-color: #f2f2f2; }
  .cb-chip:hover { background: #f2f2f2; color: #111111; }
  .cb-input { background: #2c2c2e; border-color: #48484a; color: #f2f2f2; }
  .cb-input:focus { border-color: #f2f2f2; }
}

@media (prefers-reduced-motion: reduce) {
  .cb-fab, .cb-panel, .cb-chip { transition: none; }
  .cb-typing span { animation: none; opacity: 0.6; }
}
