/* Reusable support-chat widget + admin styles. Theme-aware: reads the host's
   CSS custom properties (--c-primary, --radius, …) with safe fallbacks so it
   blends into any host that defines them and still looks right where it doesn't. */

.lbc-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: var(--c-primary, #6366f1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.18));
  transition: transform 0.15s ease, background 0.15s ease;
}
.lbc-launcher:hover {
  background: var(--c-primary-hover, #4f46e5);
  transform: translateY(-2px);
}

.lbc-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 9999;
  width: 360px;
  max-width: calc(100vw - 40px);
  height: 520px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.18));
  overflow: hidden;
}
.lbc-hidden { display: none !important; }

.lbc-header {
  padding: 14px 16px;
  background: var(--c-primary, #6366f1);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lbc-header .lbc-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.lbc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--c-bg, #f8fafc);
}
.lbc-msg {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: var(--radius, 8px);
  font-size: 0.875rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.lbc-msg-user {
  align-self: flex-end;
  background: var(--c-primary, #6366f1);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.lbc-msg-assistant {
  align-self: flex-start;
  background: var(--c-surface, #fff);
  color: var(--c-text, #1e293b);
  border: 1px solid var(--c-border, #e2e8f0);
  border-bottom-left-radius: 2px;
}
.lbc-msg-error {
  align-self: center;
  background: var(--c-error-bg, #fef2f2);
  color: var(--c-error, #b91c1c);
  font-size: 0.8125rem;
}

.lbc-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--c-border, #e2e8f0);
  background: var(--c-surface, #fff);
}
.lbc-composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.875rem;
  max-height: 96px;
  color: var(--c-text, #1e293b);
}
.lbc-composer textarea:focus {
  outline: none;
  border-color: var(--c-primary, #6366f1);
}
.lbc-composer button {
  border: none;
  border-radius: var(--radius, 8px);
  padding: 0 16px;
  background: var(--c-primary, #6366f1);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.lbc-composer button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Admin triage page ---- */
.lbc-admin {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}
.lbc-admin h1 { font-size: 1.4rem; margin-bottom: 16px; }
.lbc-admin-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.lbc-admin-filters select, .lbc-admin-filters button {
  padding: 6px 10px;
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  font: inherit;
  background: var(--c-surface, #fff);
  color: var(--c-text, #1e293b);
}
.lbc-insight {
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  background: var(--c-surface, #fff);
  padding: 16px;
  margin-bottom: 12px;
}
.lbc-insight-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lbc-insight-title { font-weight: 600; flex: 1; }
.lbc-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
}
.lbc-badge-feature_request { background: #eef2ff; color: #4338ca; }
.lbc-badge-bug { background: var(--c-error-bg, #fef2f2); color: var(--c-error, #b91c1c); }
.lbc-badge-issue { background: var(--c-warning-bg, #fffbeb); color: var(--c-warning, #b45309); }
.lbc-badge-question { background: #f0f9ff; color: #0369a1; }
.lbc-badge-other { background: var(--c-muted, #f1f5f9); color: var(--c-text-secondary, #526070); }
.lbc-badge-high { background: var(--c-error-bg, #fef2f2); color: var(--c-error, #b91c1c); }
.lbc-badge-med { background: var(--c-warning-bg, #fffbeb); color: var(--c-warning, #b45309); }
.lbc-badge-low { background: var(--c-muted, #f1f5f9); color: var(--c-text-secondary, #526070); }
.lbc-badge-reviewed { background: var(--c-success-bg, #f0fdf4); color: var(--c-success, #15803d); }
.lbc-insight-summary { font-size: 0.875rem; color: var(--c-text-secondary, #526070); margin: 8px 0; }
.lbc-insight-actions { display: flex; gap: 8px; align-items: center; }
.lbc-insight-actions button {
  font-size: 0.8125rem;
  padding: 4px 10px;
  border: 1px solid var(--c-border, #e2e8f0);
  border-radius: var(--radius, 8px);
  background: var(--c-surface, #fff);
  cursor: pointer;
  color: var(--c-text, #1e293b);
}
.lbc-transcript {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--c-border, #e2e8f0);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lbc-transcript .lbc-msg { max-width: 100%; }
.lbc-admin-gate { text-align: center; padding: 60px 20px; color: var(--c-text-secondary, #526070); }
