/*
 * Fire / yellow card / red card reaction widget (reactions/_widget) and the
 * creator-only sentiment badge (ReactionsHelper#sentiment_badge). Loaded by
 * the ultrzn_tv and studio layouts. Built from the signed-off Phase 0
 * mockup ("Comments & Cards").
 */
:root {
  --rx-yellow: #ffd60a;
  --rx-fire: #ff8a00;
  --rx-fire-text: #ffae42;
}

.rx { display: inline-flex; align-items: center; }
/* button_to wraps each option in a form; let the buttons lay out as siblings. */
.rx .rx-form { display: contents; }

.rx-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #b5b5b5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  border-radius: 999px;
  padding: 6px 10px;
  min-height: 32px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s, color 0.15s;
}
.rx-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); color: var(--clr-text); }
.rx-btn:focus-visible { outline: 2px solid var(--clr-cyan); outline-offset: 2px; }
.rx-btn:disabled { cursor: default; opacity: 1; }
.rx-btn.is-locked { opacity: 0.35; cursor: not-allowed; }

/* Fire: outline flame at rest, gradient flame with a glow when selected. */
.rx-flame { width: 18px; height: 18px; overflow: visible; flex: none; }
.rx-flame .fo { fill: transparent; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; transition: fill 0.2s, stroke 0.2s; }
.rx-flame .fi { fill: transparent; transition: fill 0.2s; }
.rx-fire:hover:not(:disabled) .fo { stroke: var(--rx-fire); }
.rx-fire[aria-pressed="true"] { color: var(--rx-fire-text); }
.rx-fire[aria-pressed="true"] .fo { fill: url(#rxFlameGradient); stroke: #ff6a00; }
.rx-fire[aria-pressed="true"] .fi { fill: #ffe07a; }
.rx-fire[aria-pressed="true"] .rx-flame { filter: drop-shadow(0 0 6px rgba(255, 120, 0, 0.55)); }

/* Cards: outline at rest; filled and tilted, like a referee showing one. */
.rx-card {
  display: inline-block;
  flex: none;
  width: 11px;
  height: 15px;
  border: 1.7px solid currentColor;
  border-radius: 2.5px;
  transition: transform 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.rx-yellow:hover:not(:disabled) .rx-card { border-color: var(--rx-yellow); }
.rx-red:hover:not(:disabled) .rx-card { border-color: var(--clr-red); }
.rx-yellow[aria-pressed="true"] { color: var(--rx-yellow); }
.rx-yellow[aria-pressed="true"] .rx-card {
  background: var(--rx-yellow);
  border-color: var(--rx-yellow);
  transform: rotate(-10deg) translateY(-1px);
  box-shadow: 0 0 10px rgba(255, 214, 10, 0.45);
}
.rx-red[aria-pressed="true"] { color: #ff6b62; }
.rx-red[aria-pressed="true"] .rx-card {
  background: var(--clr-red);
  border-color: var(--clr-red);
  transform: rotate(-10deg) translateY(-1px);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.5);
}

/* Large (video) variant: one pill with dividers. */
.rx-lg { background: var(--clr-surface-2); border-radius: 999px; padding: 2px; }
.rx-lg .rx-btn { padding: 8px 14px; min-height: 36px; font-size: 14px; color: var(--clr-text); position: relative; }
.rx-lg .rx-form + .rx-form .rx-btn::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 10px;
  bottom: 10px;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
}
.rx-lg .rx-flame { width: 20px; height: 20px; }
.rx-lg .rx-card { width: 13px; height: 18px; }

/* Click feedback (reaction_controller.js adds .is-anim to the new choice). */
.rx-n { display: inline-block; }
.is-anim.rx-fire .rx-flame { animation: rx-pop 0.36s cubic-bezier(0.3, 1.6, 0.5, 1); }
.is-anim.rx-yellow .rx-card { animation: rx-brandish 0.4s ease-out; }
.is-anim.rx-red .rx-card { animation: rx-brandish 0.4s ease-out, rx-shake 0.32s 0.4s ease-in-out; }
.is-anim .rx-n { animation: rx-tick 0.25s ease-out; }
@keyframes rx-pop { 0% { transform: scale(1); } 40% { transform: scale(1.32); } 100% { transform: scale(1); } }
@keyframes rx-brandish {
  0% { transform: rotate(0) translateY(3px); }
  60% { transform: rotate(-16deg) translateY(-4px); }
  100% { transform: rotate(-10deg) translateY(-1px); }
}
@keyframes rx-shake {
  0%, 100% { transform: rotate(-10deg) translateY(-1px); }
  25% { transform: rotate(-15deg) translateY(-1px); }
  75% { transform: rotate(-5deg) translateY(-1px); }
}
@keyframes rx-tick { from { transform: translateY(45%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Sentiment badge (creator only) ─────────────────────────────────── */
.sentiment-band {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.sentiment-band b { font-weight: 700; }
.sentiment-band.band-sm { font-size: 11px; padding: 1px 8px; }
.band-fire { background: rgba(255, 138, 0, 0.14); color: var(--rx-fire-text); border-color: rgba(255, 138, 0, 0.35); }
.band-pos { background: var(--clr-cyan-dim); color: var(--clr-cyan); border-color: rgba(0, 232, 255, 0.35); }
.band-mixed { background: rgba(255, 255, 255, 0.06); color: #cfcfcf; border-color: rgba(255, 255, 255, 0.16); }
.band-caution { background: rgba(255, 214, 10, 0.12); color: var(--rx-yellow); border-color: rgba(255, 214, 10, 0.35); }
.band-red { background: rgba(255, 59, 48, 0.14); color: #ff7a72; border-color: rgba(255, 59, 48, 0.4); }
.band-none { color: var(--clr-muted); border: 1px dashed #444; }

/* "How sentiment works" modal (reactions/_sentiment_help_modal). */
.sx-weights, .sx-bands { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sx-weights li { display: grid; grid-template-columns: 26px 1fr; align-items: center; gap: 10px; }
.sx-weights .rx-btn { padding: 0; min-height: 0; }
.sx-bands li { display: grid; grid-template-columns: 112px 84px 1fr; align-items: center; gap: 10px; }
.sx-bands .rng { font-size: 12px; color: var(--clr-muted); text-align: end; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .sx-bands li { grid-template-columns: 104px 1fr; }
  .sx-bands li > span:last-child { grid-column: 1 / -1; }
}
.sx-example { padding: 10px 12px; border-radius: 12px; background: var(--clr-bg); border: 1px solid var(--clr-border); font-variant-numeric: tabular-nums; }
.sx-private { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--clr-cyan-dim); }
.sx-private .fa-lock { color: var(--clr-cyan); margin-top: 3px; }

@media (prefers-reduced-motion: reduce) {
  .rx-btn, .rx-card, .rx-flame .fo, .rx-flame .fi { transition: none; }
  .is-anim.rx-fire .rx-flame,
  .is-anim.rx-yellow .rx-card,
  .is-anim.rx-red .rx-card,
  .is-anim .rx-n { animation: none; }
}
