/*
 * Self-contained styles for the feedback widget. Everything is scoped
 * under .fb-* class names and CSS custom properties prefixed --fb- so this
 * never collides with a host application's own CSS framework.
 */

.fb-root {
  --fb-color-bg: #ffffff;
  --fb-color-fg: #1a1a1a;
  --fb-color-muted: #6b7280;
  --fb-color-border: #e2e2e2;
  --fb-color-accent: #2563eb;
  --fb-color-accent-fg: #ffffff;
  --fb-color-danger: #b91c1c;
  --fb-color-overlay: rgba(15, 15, 15, 0.4);
  --fb-radius: 10px;
  --fb-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  --fb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--fb-font);
  color: var(--fb-color-fg);
}

@media (prefers-color-scheme: dark) {
  .fb-root {
    --fb-color-bg: #1c1c1e;
    --fb-color-fg: #f2f2f2;
    --fb-color-muted: #9aa0a6;
    --fb-color-border: #333438;
    --fb-color-overlay: rgba(0, 0, 0, 0.55);
  }
}

.fb-root, .fb-root *, .fb-root *::before, .fb-root *::after {
  box-sizing: border-box;
}

/* Trigger button */
.fb-trigger {
  position: fixed;
  z-index: 2147483000;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  font: 500 13px/1.2 var(--fb-font);
  color: var(--fb-color-muted);
  background: var(--fb-color-bg);
  border: 1px solid var(--fb-color-border);
  border-radius: 999px;
  box-shadow: var(--fb-shadow);
  cursor: pointer;
  opacity: 0.85;
  transition: opacity .15s ease, color .15s ease;
}

.fb-trigger:hover,
.fb-trigger:focus-visible {
  opacity: 1;
  color: var(--fb-color-fg);
}

.fb-trigger:focus-visible {
  outline: 2px solid var(--fb-color-accent);
  outline-offset: 2px;
}

.fb-trigger svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* Overlay + panel */
.fb-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  background: var(--fb-color-overlay);
  display: none;
}

.fb-overlay.is-open {
  display: block;
}

.fb-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--fb-color-bg);
  box-shadow: var(--fb-shadow);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .2s ease;
}

.fb-overlay.is-open .fb-panel {
  transform: translateX(0);
}

@media (max-width: 640px) {
  .fb-panel {
    width: 100vw;
  }
}

.fb-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--fb-color-border);
  flex: none;
}

.fb-panel__title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.fb-panel__close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--fb-color-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.fb-panel__close:hover,
.fb-panel__close:focus-visible {
  color: var(--fb-color-fg);
}

.fb-panel__body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.fb-panel__footer {
  padding: 14px 18px;
  border-top: 1px solid var(--fb-color-border);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* "Sending as ..." identity line */
.fb-identity {
  font-size: 12.5px;
  color: var(--fb-color-muted);
  margin: -2px 0 14px;
}

.fb-identity__name {
  color: var(--fb-color-fg);
  font-weight: 600;
  transition: color .15s ease;
}

.fb-identity__name.fb-is-struck {
  color: var(--fb-color-muted);
  font-weight: 400;
  text-decoration: line-through;
}

.fb-identity__anon-note {
  margin-left: 2px;
}

/* Form elements */
.fb-field {
  margin-bottom: 14px;
}

.fb-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--fb-color-fg);
}

.fb-hint {
  font-size: 12px;
  color: var(--fb-color-muted);
  margin-top: 4px;
}

.fb-textarea,
.fb-input,
.fb-select {
  width: 100%;
  font: 400 13.5px/1.4 var(--fb-font);
  color: var(--fb-color-fg);
  background: var(--fb-color-bg);
  border: 1px solid var(--fb-color-border);
  border-radius: 8px;
  padding: 9px 10px;
}

.fb-textarea {
  min-height: 110px;
  resize: vertical;
}

.fb-textarea:focus,
.fb-input:focus,
.fb-select:focus {
  outline: 2px solid var(--fb-color-accent);
  outline-offset: 1px;
}

.fb-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 10px;
}

.fb-checkbox-row input {
  margin-top: 3px;
}

.fb-error {
  color: var(--fb-color-danger);
  font-size: 12px;
  margin-top: 4px;
}

.fb-warning {
  font-size: 12px;
  color: var(--fb-color-danger);
  background: rgba(185, 28, 28, 0.08);
  border: 1px solid rgba(185, 28, 28, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: 600 13.5px/1 var(--fb-font);
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.fb-btn-primary {
  background: var(--fb-color-accent);
  color: var(--fb-color-accent-fg);
}

.fb-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fb-btn-secondary {
  background: transparent;
  color: var(--fb-color-muted);
  border-color: var(--fb-color-border);
}

.fb-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fb-color-muted);
  margin: 18px 0 8px;
}

.fb-success,
.fb-fatal-error {
  text-align: center;
  padding: 30px 10px;
  font-size: 13.5px;
  color: var(--fb-color-muted);
}

.fb-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Elements the host page marks up for redaction get covered in-page too,
   while feedback is open, as a visual cue that they're excluded. */
[data-feedback-redact].fb-is-capturing {
  position: relative;
}

[data-feedback-redact].fb-is-capturing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #111;
  border-radius: inherit;
}
