/* Staff Assistant chat + floating widget */

.hc-sa-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.hc-sa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hc-sa-chip {
  border: 1px solid #ced4da;
  background: #f8f9fa;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.hc-sa-chip:hover {
  background: #e9ecef;
}

.hc-sa-messages {
  min-height: 220px;
  max-height: 480px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.25rem;
}

.hc-sa-bubble {
  max-width: 92%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.hc-sa-bubble.user {
  align-self: flex-end;
  background: #0d6efd;
  color: #fff;
}

.hc-sa-bubble.assistant {
  align-self: flex-start;
  background: #f1f3f5;
  color: #212529;
}

.hc-sa-citations {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  opacity: 0.9;
}

.hc-sa-citations a {
  margin-right: 0.5rem;
}

.hc-sa-error {
  color: #842029;
  background: #f8d7da;
  border: 1px solid #f5c2c7;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.hc-sa-form textarea {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  resize: vertical;
}

.hc-sa-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.hc-sa-typing {
  align-self: flex-start;
  font-size: 0.8rem;
  color: #6c757d;
  font-style: italic;
}

/* Floating widget — above Unfold chrome */
.hc-sa-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 99999;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.hc-sa-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
}

.hc-sa-fab:hover {
  background: #000;
}

.hc-sa-fab-label {
  font-size: 0.95rem;
  font-weight: 600;
}

.hc-sa-widget-panel {
  position: absolute;
  right: 0;
  bottom: 3.4rem;
  width: min(400px, calc(100vw - 2rem));
  max-height: min(70vh, 640px);
  overflow: hidden;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.hc-sa-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  background: #212529;
  color: #fff;
}

.hc-sa-widget-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.hc-sa-open-full {
  color: #adb5bd;
  font-size: 0.75rem;
  text-decoration: none;
}

.hc-sa-open-full:hover {
  color: #fff;
}

.hc-sa-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.hc-sa-widget-panel .hc-sa-panel {
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-height: calc(min(70vh, 640px) - 48px);
  overflow: auto;
}

.hc-sa-widget-panel .hc-sa-messages {
  max-height: 280px;
  min-height: 160px;
}

.hc-admin-assistant .hc-sa-panel {
  max-width: 900px;
}

/* Dark-ish admin compatibility */
html.dark .hc-sa-panel,
[data-theme="dark"] .hc-sa-panel {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}

html.dark .hc-sa-bubble.assistant,
[data-theme="dark"] .hc-sa-bubble.assistant {
  background: #374151;
  color: #f3f4f6;
}

html.dark .hc-sa-chip,
[data-theme="dark"] .hc-sa-chip {
  background: #374151;
  border-color: #4b5563;
  color: #e5e7eb;
}

html.dark .hc-sa-form textarea,
[data-theme="dark"] .hc-sa-form textarea {
  background: #111827;
  border-color: #4b5563;
  color: #e5e7eb;
}

.hc-sa-escalate-wrap {
  margin-top: 0.25rem;
}

.hc-sa-escalate-panel {
  margin-top: 0.75rem;
  padding: 0.85rem;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  background: #f8f9fa;
}

.hc-sa-escalate-paste {
  border: 2px dashed #ced4da;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.82rem;
  color: #6c757d;
  cursor: pointer;
  background: #fff;
}

.hc-sa-escalate-paste:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

.hc-sa-escalate-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.hc-sa-escalate-thumb {
  position: relative;
  width: 72px;
  height: 72px;
}

.hc-sa-escalate-thumb img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ced4da;
}

.hc-sa-escalate-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
