/* Bug Report Widget — Phase 7.C-style feedback button + modal.
   Bottom-left floating trigger, modal with type/urgency/message + opt-in
   form snapshot. Auto-captures page context on submit. Same UX as ATS's
   feedback widget, scoped beneath main to avoid leaking onto game
   canvases or matrix dashboards.

   Stays CSP-safe: no inline JS, all interactive logic in
   /scripts/feedback.js (external file). Color tokens borrowed from
   global.css: --red, --ink, --bg, --bg-panel. We deliberately do
   NOT use --paper or --cyan (not defined globally; would resolve to
   transparent). */

/* Floating trigger button */
#feedback-trigger {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  background: var(--red);
  color: var(--bg);
  border: 1.5px solid var(--red);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transition: transform .12s, background .12s, border-color .12s;
  font-family: inherit;
}
#feedback-trigger:hover {
  transform: translateY(-1px);
  background: #b82020;
  border-color: #b82020;
}
#feedback-trigger:focus-visible {
  outline: 2px solid #1f9fc4;
  outline-offset: 2px;
}
.feedback-trigger-label { display: inline; }
@media (max-width: 480px) {
  .feedback-trigger-label { display: none; }
  #feedback-trigger { padding: 10px 12px; }
}

/* Hide the trigger while the modal is open so the user doesn't open
   a second report from inside the first one. */
#feedback-modal:not([hidden]) ~ #feedback-trigger { display: none; }

/* Modal overlay */
#feedback-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
#feedback-modal[hidden] { display: none; }
#feedback-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,15,15,.55);
}
#feedback-modal-card {
  position: relative;
  background: var(--bg-panel);
  color: var(--ink);
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px 24px 20px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
}
#feedback-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--ink);
  border: 0;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}
#feedback-modal-close:hover { background: rgba(0,0,0,.06); }
#feedback-modal-title { font-size: 1.2rem; margin: 0 0 6px; }
#feedback-modal-sub {
  font-size: .88rem;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
#feedback-form { display: flex; flex-direction: column; gap: 14px; }
.feedback-fieldset { border: 0; padding: 0; margin: 0; }
.feedback-fieldset legend {
  font-size: .82rem;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 600;
}
.feedback-radio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.feedback-radio:hover { background: rgba(0,0,0,.04); }
.feedback-radio input { accent-color: var(--red); }
.feedback-field { display: flex; flex-direction: column; gap: 4px; }
.feedback-field label { font-size: .86rem; font-weight: 600; }
.feedback-field textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  background: var(--bg-panel);
  color: var(--ink);
  border: 1px solid rgba(0,0,0,.2);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}
.feedback-field textarea:focus {
  outline: 2px solid #1f9fc4;
  border-color: #1f9fc4;
}
.feedback-checkbox-row { gap: 6px; }
.feedback-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.feedback-checkbox input { accent-color: var(--red); }
.feedback-hint {
  font-size: .78rem;
  color: var(--ink-soft);
  margin: 0;
}
#feedback-error,
#feedback-success {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: .85rem;
}
#feedback-error {
  background: rgba(212,43,43,.1);
  color: var(--red);
  border: 1px solid var(--red);
}
#feedback-success {
  background: rgba(41,197,246,.1);
  color: #1f9fc4;
  border: 1px solid #1f9fc4;
}
.feedback-actions { display: flex; gap: 8px; justify-content: flex-end; }
.feedback-btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: inherit;
}
.feedback-btn-primary {
  background: var(--red);
  color: var(--bg);
  border-color: var(--red);
}
.feedback-btn-primary:hover {
  background: #b82020;
  border-color: #b82020;
}
.feedback-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.feedback-btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: rgba(30,34,40,.4);
}
.feedback-btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}
