/* Tester feedback bubble (src/feedback.rs, static/js/feedback.js) and the admin list. */

/* ---------- the floating bubble ---------- */
.fb {
  position: fixed; z-index: 30;
  right: calc(12px + env(safe-area-inset-right));
  /* phones: sit above the fixed bottom tab bar and the home-indicator inset */
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px);
}
.fb[hidden] { display: none; }
@media (min-width: 900px) {
  /* the tab bar is hidden on desktop */
  .fb { right: 18px; bottom: 18px; }
}
@media print { .fb { display: none; } }

.fb-bubble {
  display: flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; margin-left: auto; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink); border: 2px solid var(--card);
  box-shadow: var(--shadow); cursor: pointer; font-size: 1.25rem; line-height: 1;
  list-style: none; user-select: none; -webkit-user-select: none;
  opacity: .9; transition: transform .15s, opacity .15s;
}
.fb-bubble::-webkit-details-marker { display: none; }
.fb-bubble::marker { content: ""; }
.fb-bubble:hover, .fb-details[open] .fb-bubble { opacity: 1; transform: scale(1.06); }
.fb-bubble:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }

/* ---------- the panel ---------- */
.fb-panel {
  position: absolute; right: 0; bottom: calc(100% + 8px);
  width: min(340px, calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  max-height: calc(100vh - var(--tabbar-h) - env(safe-area-inset-bottom) - 90px);
  max-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom) - 90px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
@media (min-width: 900px) {
  .fb-panel { max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); }
}
.fb-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 8px 8px 14px; background: var(--title-bg);
  border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 0; z-index: 1;
}
.fb-close {
  flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--text); font-size: 1.3rem; line-height: 1;
}
.fb-close[hidden] { display: none; }
.fb-close:hover { background: var(--card); }
.fb-form { display: grid; gap: 10px; padding: 12px 14px 14px; }
.fb-form textarea { min-height: 76px; }

.fb-cats { border: 0; padding: 0; margin: 0; min-width: 0; }
.fb-cats legend { padding: 0; margin-bottom: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-cat { position: relative; display: inline-block; cursor: pointer; }
.fb-cat input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.fb-chip {
  display: inline-block; padding: 5px 11px; border-radius: 999px; white-space: nowrap;
  background: var(--card-alt); border: 1px solid var(--line);
  color: var(--text); font-size: .82rem; font-weight: 700;
}
.fb-cat input:checked + .fb-chip { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.fb-cat input:focus-visible + .fb-chip { outline: 3px solid var(--link); outline-offset: 2px; }
/* one hint line, for the chosen category */
.fb-hint { display: none; margin: 6px 0 0; font-size: .8rem; color: var(--muted); min-height: 2.2em; }
.fb-cats:has(input[value="bug"]:checked) .fb-hint[data-cat="bug"],
.fb-cats:has(input[value="design"]:checked) .fb-hint[data-cat="design"],
.fb-cats:has(input[value="wording"]:checked) .fb-hint[data-cat="wording"],
.fb-cats:has(input[value="idea"]:checked) .fb-hint[data-cat="idea"],
.fb-cats:has(input[value="other"]:checked) .fb-hint[data-cat="other"] { display: block; }

.fb-shot { display: grid; gap: 8px; justify-items: start; }
.fb-capture[hidden], .fb-preview[hidden], .fb-error[hidden], .fb-toast[hidden] { display: none; }
.fb-attach { width: 100%; }
.fb-attach input[type=file] { display: block; margin-top: 4px; max-width: 100%; font-size: .8rem; color: var(--text); }
.fb-preview { display: flex; align-items: center; gap: 10px; }
.fb-preview img {
  width: 96px; height: 64px; object-fit: cover; object-position: top;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card-alt);
}
.fb-error { margin: 0; font-size: .85rem; }
.fb-privacy { margin: 0; font-size: .76rem; }

.fb-toast {
  position: absolute; right: 0; bottom: calc(100% + 8px);
  width: max-content; max-width: min(300px, calc(100vw - 24px));
  padding: 9px 13px; border-radius: var(--radius-sm); font-weight: 600; font-size: .88rem;
  background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--text);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: reduce) {
  .fb-bubble { transition: none; }
}

/* ---------- admin list ---------- */
.fb-admin-cats .tab { font-size: .8rem; padding: 5px 11px; }
.fb-item .fb-page { margin: 4px 0; color: var(--muted); overflow-wrap: anywhere; }
.fb-message { margin: 4px 0; }
.fb-thumb {
  display: inline-block; margin: 6px 0 2px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden; line-height: 0; background: var(--card-alt);
}
.fb-thumb img { display: block; width: 180px; max-width: 100%; height: 112px; object-fit: cover; object-position: top; }
.fb-context { margin: 4px 0 0; }
.fb-done { color: var(--ok); }
