* { box-sizing: border-box; }

/* Base */
.scb-root { font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial; color: #111827; }
.scb-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.scb-header-actions { display: flex; gap: 6px; }
.scb-close, .scb-reset { background: transparent; border: 0; cursor: pointer; font-size: 16px; line-height: 1; padding: 6px 8px; border-radius: 8px; }
.scb-close:hover, .scb-reset:hover { background: #f3f4f6; }

/* Chat area */
.scb-chatlog { flex: 1; height: 360px; overflow: auto; padding: 8px; background: #fafafa; border-radius: 8px; }
.scb-bubble { max-width: 85%; padding: 10px 12px; border-radius: 16px; margin: 6px 0; white-space: pre-wrap; word-break: break-word; }
.scb-bubble.user { margin-left: auto; background: #dbeafe; }
.scb-bubble.bot  { margin-right: auto; background: #f3f4f6; }

.scb-form { display: flex; gap: 8px; margin-top: 10px; }
.scb-input { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid #ddd; }
.scb-send  { padding: 12px 14px; border: 0; border-radius: 12px; background: #111827; color: #fff; cursor: pointer; }

.scb-hint { color: #6b7280; display:block; margin-top: 6px; }

/* Debug panel under bot replies (admins only) */
.scb-debug {
  margin: 4px 0 10px 0;
  padding: 8px 10px;
  background: #0f172a;
  color: #d1d5db;
  border-radius: 8px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

/* Inline (shortcode) */
.scb-inline { max-width: 720px; margin: 1rem auto; border: 1px solid #eee; border-radius: 12px; padding: 12px; }
.scb-inline .scb-chatlog { height: 360px; }

/* Floating launcher (configurable via CSS vars; defaults 20/20) */
.scb-fab {
  position: fixed;
  right: var(--scb-fab-right, 20px);
  bottom: var(--scb-fab-bottom, 20px);
  width: 56px; height: 56px; border-radius: 50%;
  background: #111827; color: #fff; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  z-index: 9999;
}

/* Floating panel uses same offsets; sits above FAB */
.scb-panel {
  position: fixed;
  right: var(--scb-fab-right, 20px);
  bottom: calc(var(--scb-fab-bottom, 20px) + 70px); /* 56px + ~14px gap */
  width: 360px; max-width: calc(100% - 40px); height: 520px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
  padding: 12px; display: none; z-index: 9999;
}
.scb-panel.open { display: flex; flex-direction: column; animation: scbPop .12s ease-out; }
@keyframes scbPop { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Mobile: full-width sheet (FAB still respects offsets) */
@media (max-width: 540px) {
  .scb-panel {
    right: 0; left: 0; bottom: 0;
    width: 100vw; height: 80vh; max-width: 100vw; border-radius: 12px 12px 0 0;
  }
  .scb-fab {
    right: var(--scb-fab-right, 16px);
    bottom: var(--scb-fab-bottom, 16px);
    width: 56px; height: 56px;
  }
}

/* Larger bubble width on wide screens */
@media (min-width: 768px) {
  .scb-bubble { max-width: 70%; }
}
