/*
 * Backchannel — minimal styles. Inherits theme typography and button styling
 * where possible; aims to look intentional without imposing a visual identity.
 */

:root {
  /* Shared accent color for the "private mode" visual cues (tab, inline form,
   * hint paragraph). RGB triple so per-use alpha can vary via rgba(). */
  --bc-amber: 255, 193, 7;
}

/* ---------- Frontend: tab strip ---------- */

.backchannel-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0 0 1rem 0;
  border-bottom: 1px solid currentColor;
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

.backchannel-tab {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 0.5rem 1rem;
  margin-bottom: -1px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.backchannel-tab:hover,
.backchannel-tab:focus {
  opacity: 1;
  outline: none;
}

.backchannel-tab.is-active {
  opacity: 1;
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  border-bottom-color: transparent;
}

/* Visual cue for the private mode: warm amber accent so visitors immediately
 * register "this is different from the public comment form". */
.backchannel-mode-private .backchannel-tab[data-mode="private"].is-active {
  background: rgba(var(--bc-amber), 0.12);
  border-color: rgba(var(--bc-amber), 0.35);
}

.backchannel-mode-private .comment-form,
.backchannel-mode-private #commentform {
  padding: 1rem;
  border-radius: 4px;
  background: rgba(var(--bc-amber), 0.06);
  border: 1px solid rgba(var(--bc-amber), 0.25);
}

.backchannel-private-hint {
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.95em;
  background: rgba(var(--bc-amber), 0.12);
  border-left: 3px solid rgba(var(--bc-amber), 0.6);
  border-radius: 2px;
}

/* Noscript: keep only the public tab visible / functional, hide the rest of
 * the tab UI so a JS-off visitor isn't confronted with a non-working button. */
.no-js .backchannel-tab[data-mode="private"],
.no-js .backchannel-private-hint {
  display: none;
}

/* Subject dropdown — only visible while in private mode in the tab UI. The
 * inline-force form is always private (no .backchannel-mode-public wrapper)
 * so the dropdown shows there unconditionally. */
.backchannel-mode-public .backchannel-subject-row {
  display: none;
}

/* Lay the label, dropdown, and "Other" text input out in a single row. The
 * gap handles label-to-control spacing so the label doesn't visually touch
 * the dropdown. The Other input flexes to fill remaining width when revealed.
 *
 * min-height on the ROW (not on the controls) pre-claims vertical space so
 * revealing the Other input is a layout no-op: the row is already as tall as
 * the tallest control will be, whether or not the input is visible. Setting
 * min-height on <select> directly doesn't reliably work in WebKit/Blink —
 * native select chrome can render shorter than the declared min-height — so
 * matching individual control heights is unreliable cross-browser. Pinning
 * the row's height instead sidesteps the issue entirely. The formula is
 * line-height (1.4em) + vertical padding (2 × 0.4rem) + border (2 × 1px). */
.backchannel-subject-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-height: calc(1.4em + 0.8rem + 2px);
}

.backchannel-subject-row select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  max-width: 100%;
  box-sizing: border-box;
  line-height: 1.4;
}

/* flex-basis is a modest default; themes can override
 * .backchannel-subject-row input[name="backchannel_subject_other"] for
 * site-specific width tuning (e.g. min-width, flex-basis, or width). */
.backchannel-subject-row input[name="backchannel_subject_other"] {
  flex: 1 1 12rem;
  min-width: 12rem;
  padding: 0.4rem 0.5rem;
  font: inherit;
  box-sizing: border-box;
  line-height: 1.4;
  /* Explicit height matches the row's min-height so revealing the input
   * doesn't grow the row, regardless of theme border thickness. */
  height: calc(1.4em + 0.8rem + 2px);
  /* WordPress themes (GeneratePress and others) commonly add a
   * bottom margin to form inputs for vertical rhythm. In a flex row
   * with `align-items: center`, a non-zero margin-bottom pushes the
   * input's visible box above the geometric center, leaving the
   * margin space below. !important is needed because the theme's
   * #commentform-scoped selectors win specificity over ours. */
  margin: 0 !important;
}

/* Admin subject tag next to the 🔒 Private badge */
.backchannel-subject-tag {
  margin-left: 0.4em;
  color: #6b4a00;
}

/* ---------- Inline form (for [backchannel force] on comments-closed posts) ---------- */

.backchannel-inline {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  background: rgba(var(--bc-amber), 0.06);
  border: 1px solid rgba(var(--bc-amber), 0.25);
}

.backchannel-inline-heading {
  margin: 0 0 0.5rem 0;
  font-size: 1.15em;
}

.backchannel-inline .backchannel-private-hint {
  margin-top: 0;
  margin-bottom: 1rem;
}

.backchannel-inline-form .backchannel-field {
  margin: 0.5rem 0;
}

.backchannel-inline-form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.backchannel-inline-form input[type="text"],
.backchannel-inline-form input[type="email"],
.backchannel-inline-form input[type="url"],
.backchannel-inline-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem;
  font: inherit;
}

.backchannel-inline-form .required {
  color: #c00;
  margin-left: 0.15em;
}

.backchannel-inline-form .backchannel-submit {
  margin-top: 0.75rem;
}

.backchannel-thanks {
  padding: 0.75rem 0;
}

.backchannel-thanks strong {
  font-size: 1.1em;
}

/* ---------- Admin: private badge + row tint ---------- */

.backchannel-badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  background: #fff4d6;
  border: 1px solid #f0c36d;
  color: #6b4a00;
  font-size: 0.85em;
  font-weight: 600;
  white-space: nowrap;
}

tr.backchannel-private-row,
tr.backchannel-private-row > td,
tr.backchannel-private-row > th {
  background-color: #fffaf0 !important;
}

.backchannel-edit-warning {
  border-left-color: #d97700 !important;
}
.backchannel-edit-warning strong {
  color: #6b4a00;
  letter-spacing: 0.02em;
}
