/* frontend/css/feedback.css
 *
 * Styles for the user-facing feedback modal + admin inbox.
 * All tokens read from themes.css (--surface, --text, --accent, etc.).
 * Mobile-first: ≤480px the modal becomes a bottom-anchored sheet.
 *
 * See docs/design/user-feedback-and-admin-triage.md § 6.
 */

/* ── Honeypot (off-screen, never visible) ───────────────────────── */
.diq-honeypot {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── User modal scrim + container ───────────────────────────────── */
.feedback-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.feedback-modal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 10px;
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.feedback-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.feedback-modal__title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text);
}

.feedback-modal__close {
  background: transparent;
  color: var(--text2);
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 6px;
  cursor: pointer;
}
@media (hover: hover) {
  .feedback-modal__close:hover { color: var(--text); }
}

.feedback-modal__tabs {
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--border);
}
.feedback-modal__tab {
  background: transparent;
  color: var(--text2);
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
}
.feedback-modal__tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.feedback-modal__body {
  padding: 16px 18px 18px;
  overflow-y: auto;
}

/* ── Send tab ───────────────────────────────────────────────────── */
.feedback-send__form { display: flex; flex-direction: column; gap: 10px; }

.feedback-send__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--text2);
}

.feedback-send__select,
.feedback-send__textarea {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px 10px;
  width: 100%;
  font: inherit;
}
.feedback-send__textarea { resize: vertical; min-height: 130px; }

.feedback-send__counter {
  text-align: right;
  font-size: 0.82rem;
  color: var(--text3);
}

.feedback-send__status {
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--text2);
}

.feedback-send__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.feedback-info {
  display: inline-block;
  color: var(--text2);
  cursor: help;
  font-size: 1em;
}

.feedback-howitworks {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  color: var(--text2);
}
.feedback-howitworks__summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.92rem;
  list-style: none;
}
.feedback-howitworks__summary::-webkit-details-marker { display: none; }
.feedback-howitworks__content p { margin: 8px 0; line-height: 1.5; }

/* ── Mine tab ───────────────────────────────────────────────────── */
.feedback-mine__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-mine__open {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}
@media (hover: hover) {
  .feedback-mine__open:hover { background: var(--surface3); }
}

.feedback-mine__badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: var(--surface3);
  color: var(--text2);
}
.feedback-mine__badge--new     { background: rgba(var(--neg-rgb), 0.16); color: var(--neg); }
.feedback-mine__badge--replied { background: rgba(var(--pos-rgb), 0.16); color: var(--pos); }
.feedback-mine__badge--promoted{ background: var(--surface3); color: var(--accent); }
.feedback-mine__badge--closed  { background: var(--surface3); color: var(--text3); }

.feedback-mine__category { color: var(--text2); font-size: 0.85rem; }
.feedback-mine__preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-mine__age { color: var(--text3); font-size: 0.82rem; }
.feedback-mine__empty, .feedback-mine__loading { color: var(--text2); }

/* ── Thread detail (shared between user-modal "mine" + standalone page) ── */
.feedback-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feedback-thread__back {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.feedback-thread__heading { margin: 6px 0 0; }
.feedback-thread__meta { color: var(--text3); font-size: 0.85rem; }
.feedback-thread__message {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.feedback-thread__message--user_inbound { background: var(--surface2); }
.feedback-thread__message--admin_outbound {
  background: rgba(var(--pos-rgb), 0.08);
  border-color: rgba(var(--pos-rgb), 0.20);
}
.feedback-thread__who { font-weight: 600; font-size: 0.88rem; color: var(--text2); margin-bottom: 4px; }
.feedback-thread__body {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 0;
  color: var(--text);
}

/* ── Mobile responsive (≤480px) — bottom-anchored sheet ─────────── */
@media (max-width: 480px) {
  .feedback-scrim { padding: 0; align-items: flex-end; }
  .feedback-modal {
    width: 100%;
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
  }
  .feedback-send__textarea { font-size: 16px; }  /* prevents iOS zoom-on-focus */
}

/* ── Admin inbox ────────────────────────────────────────────────── */
.admin-feedback {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  min-height: calc(100vh - 80px);
  padding: 16px;
}

.admin-feedback__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.admin-feedback__chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.85rem;
}
.admin-feedback__chip.is-active {
  background: var(--accent);
  color: var(--on-accent, var(--text));
  border-color: var(--accent);
}

.admin-feedback__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.admin-feedback__row {
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
@media (hover: hover) {
  .admin-feedback__row:hover { background: var(--surface3); }
}
.admin-feedback__row.is-selected {
  border-color: var(--accent);
  background: var(--surface3);
}
.admin-feedback__row-meta {
  font-size: 0.8rem;
  color: var(--text3);
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.admin-feedback__detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.admin-feedback__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.admin-feedback__actions button {
  padding: 6px 12px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
@media (hover: hover) {
  .admin-feedback__actions button:hover { background: var(--surface3); }
}
.admin-feedback__actions button[disabled] { opacity: 0.5; cursor: not-allowed; }

.admin-feedback__reply-form { display: flex; flex-direction: column; gap: 8px; }
.admin-feedback__reply-textarea {
  width: 100%;
  min-height: 110px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
}

@media (max-width: 767px) {
  .admin-feedback { grid-template-columns: 1fr; }
  .admin-feedback__list { max-height: 50vh; }
  .admin-feedback__reply-textarea { font-size: 16px; }
}
