/* Bug reporter widget — modal + FAB.
 *
 * Architektura: BEM classes .bug-reporter__* (templ HTML ich oczekuje),
 * ALE styling oparty wprost o DS tokens (--ink, --line, --bg-elev,
 * --r-lg, --sh-3, --accent). Dziedziczy tokens.css → wygląda spójnie
 * z resztą DS bez własnych aliasów typu --surface czy --text.
 *
 * Whitelabel embed: kiedy host renderuje BugReporter z BrandAccent,
 * accent kolorystyczny ląduje przez `--bug-reporter-accent` ustawiane
 * inline przez Alpine (zob. bug-reporter.js); poza tym widget używa
 * regulárnych zmiennych DS, więc dark-mode + theme dziedziczy się
 * automatycznie z <html data-theme>.
 */

.bug-reporter {
  /* Tylko accent jest osobno — host może go nadpisać per-tenant.
   * Reszta tokenów dziedziczy się z tokens.css. */
  --bug-reporter-accent: var(--accent);
}

/* ── FAB ─────────────────────────────────────────────────────────── */
/* Pływający przycisk tuż za lewym sidebarem (88px) z 12px odstępem.
 * Hosty z własnym triggerem w brandbarze renderują BugReporter z
 * ShowFAB=false. Na mobile (<= 960px) sidebar zwija się do dolnej
 * belki (64px) — FAB ląduje wtedy w lewym dolnym powyżej tej belki,
 * żeby nie zasłaniać dolnych ikon nav. */
.bug-reporter__fab {
  position: fixed;
  left: 20px;
  bottom: 80px;
  z-index: 9998;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--bug-reporter-accent);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--sh-2);
  transition: transform .12s ease, box-shadow .12s ease;
}
@media (max-width: 960px) {
  .bug-reporter__fab {
    left: 16px;
    bottom: 80px; /* powyżej bottom-nav (64px) z .app grid */
  }
}
.bug-reporter__fab:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-3);
}
.bug-reporter__fab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Overlay + modal ──────────────────────────────────────────────── */
/* Te same wartości co .modal-backdrop / .modal z modal.css — żeby
 * wizualnie nie odstawał od innych DS modali. */
.bug-reporter__overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 19, 15, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.bug-reporter__modal {
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--sh-3);
  overflow: hidden;
}

.bug-reporter__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.bug-reporter__header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.bug-reporter__close {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
}
.bug-reporter__close:hover {
  background: var(--bg-sunk);
  color: var(--ink);
}

.bug-reporter__body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13.5px;
}

/* ── Prompt ──────────────────────────────────────────────────────── */
.bug-reporter__prompt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.bug-reporter__hint {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}
.bug-reporter__permissions {
  color: var(--ink-2);
  background: var(--bg-tinted);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 12.5px;
  margin: 0;
}

/* ── Recording ───────────────────────────────────────────────────── */
.bug-reporter__recording {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
}
.bug-reporter__rec-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
}
.bug-reporter__rec-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d04e4e;
  box-shadow: 0 0 0 4px rgba(208, 78, 78, .15);
  animation: bug-reporter-pulse 1.2s ease-in-out infinite;
}
@keyframes bug-reporter-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.85); }
}

/* ── Preview + form ──────────────────────────────────────────────── */
.bug-reporter__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bug-reporter__preview {
  width: 100%;
  max-height: 240px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-sunk);
}
.bug-reporter__label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.bug-reporter__input {
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.bug-reporter__input:hover {
  border-color: var(--line-3);
}
.bug-reporter__input:focus-visible {
  outline: none;
  border-color: var(--accent-deep);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
textarea.bug-reporter__input {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}

.bug-reporter__error {
  background: var(--bg-tinted-2);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-left: 3px solid #d04e4e;
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 12.5px;
}

/* ── Actions row ─────────────────────────────────────────────────── */
.bug-reporter__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 14px;
}

/* Buttons — visual match z .btn / .btn-primary z components.css.
 * Trzymane jako osobne klasy żeby widget działał stand-alone w
 * embed whitelabel (gdzie components.css może być nieobecne), ale
 * styling 1:1. */
.bug-reporter__btn {
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.bug-reporter__btn:hover:not(:disabled) {
  background: var(--bg-sunk);
  border-color: var(--line-3);
}
.bug-reporter__btn:active:not(:disabled) {
  transform: translateY(1px);
}
.bug-reporter__btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}
.bug-reporter__btn--primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: var(--ink);
  font-weight: 600;
}
.bug-reporter__btn--primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, white);
  border-color: var(--accent-deep);
}

/* ── Success ─────────────────────────────────────────────────────── */
.bug-reporter__success {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
}
.bug-reporter__success p {
  margin: 0;
  color: var(--ink);
  line-height: 1.5;
}
.bug-reporter__success-hint {
  color: var(--ink-3) !important;
  font-size: 12.5px;
}
