/* bug-report-sheet — "Report a bug" from anywhere in the app (#758, REQ-0015).
 *
 * Mockup: docs/design/mockups/bug-report-758.html, approved on issue #758.
 * Script: public/js/components/bug-report-sheet.js.
 *
 * The sheet reuses the Submit an idea sheet's look: its markup carries the
 * .idea-sheet-scrim / .idea-sheet classes from idea-sheet.css (same glass, same
 * grabber, same Send, same sent and discard views). This file adds only what is
 * new: the stacking above every other sheet, the screenshot block, the closed
 * "What we'll send" list, the shake line, and the split "Submit an idea |
 * Report a bug" row used at the top of the "+" menu and the zone screen's "+".
 *
 * Uses ONLY var(--v2-*) tokens (defined in /css/canopy-v2.css).
 */

/* ─── Above every other sheet, drawer and the photo viewer: a shake opens it over whatever is open ─── */
.idea-sheet-scrim.bug-sheet-scrim { z-index: 15000; }

/* ─── Screenshot block ─── */
.bug-sheet__shot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: var(--v2-radius-md);
  background: var(--v2-bg-secondary);
}
.bug-sheet__shot-img {
  flex: 0 0 56px;
  width: 56px;
  height: 100px;
  object-fit: cover;
  object-position: top;
  border-radius: var(--v2-radius-sm);
  border: 1px solid var(--v2-border-strong);
  background: var(--v2-bg-card);
}
/* REQ-0016: the picture is taken after the sheet opens. While it is being
   taken the slot shimmers; when there is none the slot shows a crossed picture. */
.bug-sheet__shot-img.is-waiting {
  display: block;
  border-style: dashed;
  background: linear-gradient(100deg, var(--v2-bg-card) 30%, var(--v2-bg-secondary) 50%, var(--v2-bg-card) 70%) 0 0 / 300% 100%;
  animation: bug-shot-shimmer 1.8s ease-in-out infinite;
}
@keyframes bug-shot-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .bug-sheet__shot-img.is-waiting { animation: none; background: var(--v2-bg-card); }
}
.bug-sheet__shot-img.is-none {
  display: grid;
  place-items: center;
  color: var(--v2-text-support);
  border-style: dashed;
}
.bug-sheet__shot-img.is-none svg { width: 22px; height: 22px; }
.bug-sheet__shot-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: var(--v2-font-size-footnote);
  line-height: 1.4;
  color: var(--v2-text-support);
}
.bug-sheet__shot-text strong {
  font-size: var(--v2-font-size-subhead);
  font-weight: 600;
  color: var(--v2-text-primary);
}
.bug-sheet__shot-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-sheet__shot-actions { display: flex; flex-wrap: wrap; gap: 4px; }

/* Text buttons: Remove, Use my own, Add my screenshot, Turn on shake to report. 44px tall. */
.bug-sheet__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--v2-space-touch);
  padding: 0 4px;
  border: 0;
  background: none;
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-footnote);
  font-weight: 600;
  color: var(--v2-accent-terracotta-dark);
  cursor: pointer;
}
.bug-sheet__link:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: 2px; border-radius: var(--v2-radius-sm); }

/* ─── "What we'll send": closed by default ─── */
.bug-sheet__details {
  margin-bottom: 4px;
  border: 1px solid var(--v2-border-soft);
  border-radius: var(--v2-radius-md);
  background: var(--v2-bg-card);
}
.bug-sheet__details-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-subhead);
  font-weight: 600;
  color: var(--v2-text-primary);
}
.bug-sheet__details-toggle svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--v2-text-support); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.bug-sheet__details-toggle .bug-sheet__chev { margin-left: auto; transition: transform var(--v2-transition-base) var(--v2-ease-out); }
.bug-sheet__details-toggle[aria-expanded="true"] .bug-sheet__chev { transform: rotate(180deg); }
.bug-sheet__details-toggle small {
  display: block;
  margin-top: 2px;
  font-size: var(--v2-font-size-caption);
  font-weight: 400;
  line-height: 1.35;
  color: var(--v2-text-support);
}
.bug-sheet__details-toggle:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: -2px; border-radius: var(--v2-radius-md); }
.bug-sheet__details-list {
  margin: 0;
  padding: 2px 14px 12px;
  list-style: none;
  font-size: var(--v2-font-size-footnote);
  line-height: 1.5;
  color: var(--v2-text-support);
}
.bug-sheet__details-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-top: 1px solid var(--v2-border-soft);
}
.bug-sheet__details-list b { font-weight: 600; color: var(--v2-text-primary); white-space: nowrap; }
.bug-sheet__details-list span { min-width: 0; text-align: right; overflow-wrap: anywhere; }

/* ─── Shake line ─── */
.bug-sheet__shake {
  margin: 10px 0 0;
  font-size: var(--v2-font-size-footnote);
  line-height: 1.4;
  color: var(--v2-text-support);
}
/* The 44px button sits on its own line, so it does not stretch the sentence's line height. */
.bug-sheet__shake .bug-sheet__link { display: flex; padding-left: 0; }

/* ─── Split row: "Submit an idea | Report a bug", two halves side by side ─── */
.feedback-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.feedback-split__half {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 8px 6px;
  border: 0;
  border-radius: 12px;
  background: var(--v2-bg-secondary);
  color: var(--v2-text-primary);
  font-family: var(--v2-font-body);
  font-size: var(--v2-font-size-footnote);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.feedback-split__half svg { width: 22px; height: 22px; flex: none; fill: none; stroke: var(--v2-text-support); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.feedback-split__half.is-bug { background: var(--v2-pop-slate-bg); }
.feedback-split__half.is-bug svg { stroke: var(--v2-pop-slate); }
.feedback-split__half:active { opacity: 0.8; }
.feedback-split__half:focus-visible { outline: 2px solid var(--v2-accent-text); outline-offset: 2px; }

/* The zone screen's "+" shows pill rows with no card behind them, so its split row brings its own card. */
.feedback-split.is-floating {
  width: 236px;
  padding: 6px;
  border: 1px solid var(--v2-edge);
  border-radius: 18px;
  background: var(--v2-bg-panel);
  box-shadow: var(--v2-elev-2);
}

@media (prefers-reduced-motion: reduce) {
  .bug-sheet__details-toggle .bug-sheet__chev { transition: none; }
}
