/* SAB Portal — The Feedback panel and the ticket pages.
 * `feedback/templates/feedback/`. Sizes come from tokens.css and nowhere else. */

@layer app {

/* --- The panel ------------------------------------------------------------ */

.sab-feedback {
  position: relative;
  margin: 0;
}

/* The row is drawn like a section row: one more thing to press in the column. */
.sab-feedback > summary {
  display: flex;
  align-items: center;
  gap: var(--sab-gap);
  /* Pico pushes an open summary's content down by a step; the row stays put. */
  margin: 0;
  padding: var(--sab-gap);
  border-radius: var(--sab-radius);
  color: var(--pico-muted-color);
  font-size: var(--sab-text-body);
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}

.sab-feedback > summary::-webkit-details-marker {
  display: none;
}

/* Pico draws a chevron on every summary. A row in the column has none. */
.sab-feedback > summary::after {
  display: none;
}

.sab-feedback > summary:hover,
.sab-feedback > summary:focus-visible,
.sab-feedback[open] > summary {
  background: var(--sab-quiet-bg);
  color: var(--sab-ink);
}

.sab-feedback .sab-tab-icon {
  width: 1.1rem;
  height: 1.1rem;
}

/* Opens upwards from the foot of the column, and wider than it: a form wants
 * a line long enough to write in, so it lies over the page beside. */
.sab-feedback-panel {
  position: absolute;
  bottom: 100%;
  left: 0;
  z-index: var(--sab-layer-panel);
  display: flex;
  flex-direction: column;
  gap: var(--sab-gap);
  width: min(22rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  margin: 0 0 var(--sab-gap);
  padding: var(--sab-gap-wide);
  background: var(--sab-bar-bg);
  border: var(--sab-hairline) solid var(--sab-rule);
  border-radius: var(--sab-radius-panel);
  box-shadow: var(--sab-panel-shadow);
  font-size: var(--sab-text-body);
}

.sab-feedback-panel label,
.sab-feedback-panel textarea {
  margin: 0;
}

.sab-feedback-panel textarea {
  font-size: var(--sab-text-body);
}

.sab-feedback-heading {
  color: var(--sab-ink);
  font-weight: var(--sab-weight-strong);
}

.sab-feedback-saved {
  margin: 0;
  color: var(--pico-muted-color);
  font-size: var(--sab-text-meta);
}

/* Pico stretches a form's button across it. Send is one action, not a band. */
.sab-feedback-panel button[type="submit"],
.feedback-answer button[type="submit"] {
  width: auto;
  margin: 0;
}

.sab-feedback-panel button[type="submit"] {
  align-self: flex-end;
}

/* --- States --------------------------------------------------------------
 *
 * The shape is the portal's pill; these are the four tints. The word inside
 * carries the meaning, so the tint is never the only signal. */

.feedback-state-received    { color: var(--sab-never);  background: var(--sab-never-bg); }
.feedback-state-in_progress { color: var(--sab-action); background: var(--sab-action-bg); }
.feedback-state-done        { color: var(--sab-held);   background: var(--sab-held-bg); }
.feedback-state-not_planned { color: var(--sab-absent); background: var(--sab-quiet-bg); }

/* --- The ticket pages ------------------------------------------------------ */

/* A path with a query string can be long. Cut in the table; whole on the ticket. */
td.feedback-page {
  max-width: 24rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feedback-ticket {
  display: flex;
  flex-direction: column;
  gap: var(--sab-block);
  max-width: 48rem;
}

.feedback-ticket h3 {
  margin-bottom: var(--sab-gap);
  font-size: var(--sab-text-lead);
}

.feedback-ticket .sab-record td.feedback-page {
  max-width: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The reader's own words, and ours: prose, kept as it was written. */
.feedback-text {
  overflow-wrap: anywhere;
}

/* The card's bands set the rhythm; the last paragraph adds none of its own. */
.feedback-text p:last-child,
.feedback-waiting {
  margin-bottom: 0;
}

.feedback-waiting {
  color: var(--pico-muted-color);
}

.feedback-answer {
  display: flex;
  flex-direction: column;
  gap: var(--sab-gap);
}

.feedback-answer button[type="submit"] {
  align-self: flex-start;
}

.feedback-answer label {
  margin: 0;
}

}
