/* Feedback widget styling.
   Reads the host page's own theme tokens (--accent, --ink, --panel, --border, --muted) when
   present via var(x, fallback); on a page without a theme (the test harness, for example) the
   fallback values below apply instead, so the widget stays legible either way. */

.fbw-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border, rgba(20, 20, 20, 0.25));
  background: var(--accent, #4d9dff);
  color: var(--fbw-icon-color, #10131a);
  cursor: pointer;
  z-index: 2147483000;
  --fbw-ring: rgba(77, 157, 255, 0.55);
  box-shadow: 0 0 0 0 var(--fbw-ring), 0 8px 24px rgba(0, 0, 0, 0.28);
  animation: fbw-pulse 2.4s ease-in-out infinite;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
  .fbw-fab {
    --fbw-ring: color-mix(in srgb, var(--accent, #4d9dff) 55%, transparent);
  }
}

.fbw-fab:hover,
.fbw-fab:focus-visible {
  filter: brightness(1.08);
}

.fbw-fab svg {
  width: 26px;
  height: 26px;
  pointer-events: none;
}

.fbw-fab-label {
  position: fixed;
  right: 84px;
  bottom: 35px;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--panel, rgba(22, 25, 31, 0.92));
  color: var(--ink, #e8e6e0);
  border: 1px solid var(--border, #2c3038);
  font: 12px/1.3 -apple-system, "Segoe UI", sans-serif;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 120ms ease, transform 120ms ease;
  pointer-events: none;
}

.fbw-fab:hover + .fbw-fab-label,
.fbw-fab:focus-visible + .fbw-fab-label {
  opacity: 1;
  transform: translateX(0);
}

.fbw-fab--nudge {
  animation: fbw-pulse 2.4s ease-in-out infinite, fbw-nudge 900ms ease-in-out 1;
}

@keyframes fbw-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--fbw-ring), 0 8px 24px rgba(0, 0, 0, 0.28);
  }
  70% {
    box-shadow: 0 0 0 14px transparent, 0 8px 24px rgba(0, 0, 0, 0.28);
  }
  100% {
    box-shadow: 0 0 0 0 transparent, 0 8px 24px rgba(0, 0, 0, 0.28);
  }
}

@keyframes fbw-nudge {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-10px); }
  40% { transform: translateY(0); }
  60% { transform: translateY(-5px); }
  80% { transform: translateY(0); }
}

.fbw-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  overflow: auto;
  background: var(--panel, rgba(22, 25, 31, 0.96));
  color: var(--ink, #e8e6e0);
  border: 1px solid var(--border, #2c3038);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  padding: 14px 16px;
  z-index: 2147483000;
  font: 13px/1.4 -apple-system, "Segoe UI", sans-serif;
}

.fbw-panel[hidden] {
  display: none;
}

.fbw-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.fbw-panel-header h2 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted, #9a9790);
}

.fbw-close {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink, #e8e6e0);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.fbw-close:hover,
.fbw-close:focus-visible {
  border-color: var(--border, #2c3038);
}

.fbw-textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink, #e8e6e0);
  border: 1px solid var(--border, #2c3038);
  border-radius: 8px;
  padding: 8px;
  font: inherit;
  box-sizing: border-box;
}

.fbw-counter {
  text-align: right;
  font-size: 11px;
  color: var(--muted, #9a9790);
  margin-top: 4px;
}

.fbw-attach-note {
  font-size: 11px;
  color: var(--muted, #9a9790);
  margin: 8px 0;
}

.fbw-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.fbw-actions button {
  font: inherit;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
}

.fbw-submit {
  background: var(--accent, #4d9dff);
  color: var(--fbw-icon-color, #10131a);
  border: 1px solid var(--border, transparent);
}

.fbw-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.fbw-cancel {
  background: transparent;
  color: var(--ink, #e8e6e0);
  border: 1px solid var(--border, #2c3038);
}

.fbw-status {
  margin-top: 10px;
  font-size: 12px;
}

.fbw-status.fbw-status--error {
  color: var(--bad, #ff6b6b);
}

.fbw-status.fbw-status--ok {
  color: var(--ok, #4cc38a);
}

.fbw-status a {
  color: var(--accent, #4d9dff);
}

@media (prefers-reduced-motion: reduce) {
  .fbw-fab,
  .fbw-fab--nudge {
    animation: none !important;
  }
}
