/* jarchi feedback (feedback.js): the «گزارش مشکل» button and sheet, the after-class form, the /feedback page. */
:root {
  --fb-shadow: var(--shadow-2);
  --fb-backdrop: var(--scrim);
  --f1: #ffd8d4; --f1-ink: #b42318;
  --f2: #ffe4cc; --f2-ink: #b54708;
  --f3: #f2ecd9; --f3-ink: #7a5e00;
  --f4: #d9f0e6; --f4-ink: #0f7a55;
  --f5: #c9ece6; --f5-ink: #0f766e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --f1: #4a2220; --f1-ink: #ff9b8f;
    --f2: #47301c; --f2-ink: #ffb870;
    --f3: #3d3820; --f3-ink: #e8d07a;
    --f4: #1d3b30; --f4-ink: #6fdcb0;
    --f5: #1b3431; --f5-ink: #4fd1c2;
  }
}

/* ---------- «گزارش مشکل»: small, always there, out of the way ---------- */
.fb-spacer { height: 52px; }
.fb-open {
  position: fixed; z-index: 20;
  bottom: max(14px, env(safe-area-inset-bottom));
  /* RTL: the inline start is the right; on wide screens it sits at the column's edge. */
  right: max(12px, calc(50% - 218px));
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; height: 44px; padding: 6px 12px 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--muted);
  font-size: 13px; font-weight: 700; cursor: pointer;
  box-shadow: var(--fb-shadow);
  touch-action: manipulation;
}
.fb-open svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.fb-open:hover { color: var(--warn); border-color: var(--warn); }
.fb-open:focus-visible, .fb-chip:focus-visible, .fb-facebtn:focus-visible, .fb-skip:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.fb-panel textarea:focus, .fb-after textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* ---------- the sheet (a bottom sheet on phones, a dialog on wide screens) ---------- */
.fb-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: var(--fb-backdrop);
  display: flex; align-items: flex-end; justify-content: center;
}
.fb-panel {
  width: min(460px, 100%); max-height: 88dvh; overflow-y: auto;
  background: var(--card); color: var(--ink);
  border-radius: 18px 18px 0 0;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  box-shadow: var(--fb-shadow);
}
@media (min-width: 600px) {
  .fb-backdrop { align-items: center; }
  .fb-panel { border-radius: 18px; }
}
.fb-panel h2 { font-size: 19px; margin: 0 0 2px; font-weight: 800; }
@media (min-width: 600px) { .fb-panel { padding: 22px 22px 20px; } }
/* A phone on its side: the whole sheet fits without scrolling. */
@media (max-height: 520px) {
  .fb-panel { max-height: 96dvh; padding-top: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .fb-panel .hint { display: none; }
  .fb-panel .fb-chips { gap: 6px; }
  .fb-panel textarea { min-height: 44px; margin-top: 8px; }
  .fb-panel .fb-row { margin-top: 8px; }
}
.fb-panel .hint { margin-bottom: 12px; }
.fb-panel .err:empty, .fb-after .err:empty { display: none; }

.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-chip {
  appearance: none; cursor: pointer;
  min-height: 44px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: 14px;
  touch-action: manipulation;
}
.fb-chip[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 700;
}

.fb-panel textarea, .fb-after textarea {
  display: block; width: 100%; margin: 12px 0 0;
  min-height: 64px; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 15px;
}
.fb-row { display: flex; gap: 8px; margin-top: 14px; }
.fb-row > * { flex: 1 1 0; text-align: center; text-decoration: none; display: flex; align-items: center; justify-content: center; }

.fb-thanks { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0 4px; color: var(--accent); font-size: 18px; }
.fb-thanks svg circle { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.fb-thanks svg path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.fb-panel .fb-thanks + .hint { text-align: center; margin: 4px 0 0; }

/* ---------- the after-class form ---------- */
.fb-after h2 { margin: 0; font-size: 18px; }
.fb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0; }
.fb-why { margin: 0 0 12px; }
.fb-skip {
  appearance: none; border: 0; background: none; cursor: pointer; flex: none;
  color: var(--muted); font: inherit; font-size: 14px; padding: 6px 10px; min-height: 44px; border-radius: 10px;
}
.fb-skip:hover { color: var(--ink); background: var(--bg); }
.fb-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.fb-facebtn {
  appearance: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: 64px; padding: 6px 0 4px; border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--muted); font: inherit;
  touch-action: manipulation;
}
.fb-facebtn small { font-size: 12px; white-space: nowrap; }
.fb-facebtn[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.fb-facebtn[aria-checked="true"] small { font-weight: 700; }
.fb-faces:has([aria-checked="true"]) .fb-facebtn[aria-checked="false"] .fb-face { opacity: .45; }
.fb-face circle:first-child { stroke-width: 1.5; }
.fb-face .fb-eye { stroke: none; }
.fb-face .fb-mouth { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.fb-face.f1 circle:first-child { fill: var(--f1); stroke: var(--f1-ink); } .fb-face.f1 .fb-eye { fill: var(--f1-ink); } .fb-face.f1 .fb-mouth { stroke: var(--f1-ink); }
.fb-face.f2 circle:first-child { fill: var(--f2); stroke: var(--f2-ink); } .fb-face.f2 .fb-eye { fill: var(--f2-ink); } .fb-face.f2 .fb-mouth { stroke: var(--f2-ink); }
.fb-face.f3 circle:first-child { fill: var(--f3); stroke: var(--f3-ink); } .fb-face.f3 .fb-eye { fill: var(--f3-ink); } .fb-face.f3 .fb-mouth { stroke: var(--f3-ink); }
.fb-face.f4 circle:first-child { fill: var(--f4); stroke: var(--f4-ink); } .fb-face.f4 .fb-eye { fill: var(--f4-ink); } .fb-face.f4 .fb-mouth { stroke: var(--f4-ink); }
.fb-face.f5 circle:first-child { fill: var(--f5); stroke: var(--f5-ink); } .fb-face.f5 .fb-eye { fill: var(--f5-ink); } .fb-face.f5 .fb-mouth { stroke: var(--f5-ink); }
.fb-label { font-weight: 700; font-size: 14px; margin: 14px 0 8px; }
.fb-details .btn { margin-top: 14px; }

/* ---------- /feedback (internal) ---------- */
.wrap.wide { max-width: 880px; }
.fb-filters .fb-filterrow { display: flex; gap: 8px; margin-bottom: 10px; }
.fb-filters input[type=text] { margin: 0; flex: 1; min-width: 0; text-align: right; }
.fb-filters input[type=text]::placeholder { direction: rtl; }
#fb-keycard input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); margin-bottom: 12px; }
#fb-count { margin: 0 4px 10px; }
.fb-report { padding: 14px 16px; }
.fb-rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fb-rhead time { margin-inline-start: auto; color: var(--muted); font-size: 13px; }
.fb-kind { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 1px 10px; }
.fb-kind.problem { background: var(--live-soft); color: var(--warn); }
.fb-kind.after { background: var(--accent-soft); color: var(--accent); }
.fb-rating { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; }
.fb-rating svg { width: 22px; height: 22px; }
.fb-who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 6px; }
.fb-roomlink {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 0;
  color: var(--muted); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 12px;
}
.fb-roomlink:hover { color: var(--accent); text-decoration: underline; }
.badge.warnchip { background: var(--live-soft); color: var(--warn); }
.fb-text { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 8px 10px; margin: 8px 0 4px; }
.fb-tech { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.fb-raw { margin-top: 8px; font-size: 13px; }
.fb-raw summary { cursor: pointer; color: var(--accent); }
.fb-raw pre { max-height: 260px; overflow: auto; background: var(--bg); border-radius: 10px; padding: 8px; font-size: 11.5px; margin: 6px 0 0; text-align: left; }
