/* Feedback dialog (static/js/feedback.js) and the "did we help?" card (static/js/sat_prompt.js).
   Own file: app.css is at its size cap. App tokens only; spacing 4/8/12/16/24/32/40, type
   12/13/15/20 at 400/600, targets >= 32px, gold focus ring (DESIGN.md). */

.fb-overlay, .sat-root {
  --fb-meta: #a39482;
}
[data-theme="light"] .fb-overlay, [data-theme="light"] .sat-root { --fb-meta: #736955; }

/* ── Dialog ─────────────────────────────────────────────── */
.fb-overlay {
  position: fixed; inset: 0; z-index: 2000;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 11, 16, .6); backdrop-filter: blur(4px);
}
[data-theme="light"] .fb-overlay { background: rgba(20, 27, 43, .38); }
.fb-open { animation: fbFade .2s ease-out; }
.fb-open .fb-dialog { animation: fbRise .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes fbFade { from { opacity: 0; } }
@keyframes fbRise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.fb-dialog {
  position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 24px; background: var(--s1); color: var(--text);
  border: 1px solid rgba(var(--gold-rgb), .45); border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, .35);
}
.fb-dialog [hidden] { display: none !important; }
.fb-x {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--dim); cursor: pointer;
  transition: background-color .18s, color .18s;
}
.fb-x:hover { background: rgba(var(--gold-rgb), .14); color: var(--text); }
.fb-x svg { width: 16px; height: 16px; }
.fb-title { margin: 0; padding-right: 32px; font-size: 20px; font-weight: 600; line-height: 1.25; color: var(--text); }
.fb-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--dim); }

.fb-faces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 24px; }
.fb-face {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-height: 80px; padding: 12px 4px; background: transparent; color: var(--dim);
  border: 1px solid var(--border); border-radius: 8px; font-family: inherit; cursor: pointer;
  transition: border-color .18s, background-color .18s, color .18s, transform .18s;
}
.fb-face:hover { border-color: var(--gold); color: var(--text); transform: translateY(-2px); }
.fb-face-ico { width: 32px; height: 32px; transition: transform .35s cubic-bezier(.16, 1, .3, 1), color .18s; }
.fb-face-lbl { font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--dim); }
.fb-face.on { border-color: var(--gold); background: var(--gold-bg); }
.fb-face.on .fb-face-ico { color: var(--gold); transform: scale(1.18); }
.fb-face.on .fb-face-ico circle:first-child { fill: rgba(var(--gold-rgb), .18); }
.fb-face.on .fb-face-lbl { color: var(--text); }

.fb-more { margin-top: 24px; }
.fb-reveal { animation: fbReveal .32s cubic-bezier(.16, 1, .3, 1); }
@keyframes fbReveal { from { opacity: 0; transform: translateY(8px); } }
.fb-q { display: block; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.fb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.fb-chip {
  min-height: 32px; padding: 0 12px; background: transparent; color: var(--dim);
  border: 1px solid var(--border); border-radius: 16px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .18s, background-color .18s, color .18s;
}
.fb-chip:hover { border-color: var(--gold); color: var(--text); }
.fb-chip[aria-pressed="true"] { background: var(--gold-bg); border-color: var(--gold); color: var(--text); }
.fb-text {
  display: block; width: 100%; min-height: 80px; padding: 12px; resize: vertical;
  background: var(--s2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; line-height: 1.5;
}
.fb-text::placeholder { color: var(--fb-meta); }
.fb-text:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.fb-count { margin-top: 4px; text-align: right; font-size: 12px; color: var(--fb-meta); font-variant-numeric: tabular-nums; }
.fb-err { margin-top: 12px; font-size: 13px; color: var(--err); }
[data-theme="light"] .fb-err { color: #b42318; }

.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.fb-btn {
  min-height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: filter .18s, background-color .18s, border-color .18s, opacity .18s;
}
.fb-btn-gold { background: var(--gold); color: var(--bg); }
.fb-btn-gold:hover:not(:disabled) { filter: brightness(1.1); }
.fb-btn-gold:disabled { opacity: .4; cursor: not-allowed; }
.fb-btn-ghost { background: transparent; color: var(--dim); }
.fb-btn-ghost:hover { background: rgba(var(--gold-rgb), .12); color: var(--text); }

.fb-done { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 8px; }
.fb-done .fb-title { padding-right: 0; outline: none; }
.fb-done .fb-btn { margin-top: 24px; }
.fb-tick {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 16px;
  border-radius: 50%; background: var(--gold-bg); border: 1px solid var(--gold); color: var(--gold);
  animation: fbPop .45s cubic-bezier(.16, 1, .3, 1);
}
.fb-tick svg { width: 24px; height: 24px; stroke-width: 2.2; stroke-dasharray: 24; stroke-dashoffset: 0; animation: fbDraw .4s .12s ease-out backwards; }
@keyframes fbPop { from { transform: scale(.6); opacity: 0; } }
@keyframes fbDraw { from { stroke-dashoffset: 24; } }
.fb-link {
  margin-top: 16px; padding: 4px 0; min-height: 32px; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px;
}
.fb-link:hover { color: var(--gold); }

.fb-follow { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
.fb-follow-lbl { font-size: 13px; color: var(--dim); }
.fb-social { display: flex; gap: 8px; }
.fb-social a {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 1px solid var(--border); border-radius: 50%; color: var(--dim); text-decoration: none;
  transition: border-color .18s, color .18s, transform .18s;
}
.fb-social a:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.fb-social svg { width: 16px; height: 16px; }

.fb-dialog button:focus-visible, .fb-dialog a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 600px) {
  .fb-overlay { align-items: flex-end; padding: 0; }
  .fb-dialog { max-width: none; border-radius: 12px 12px 0 0; padding-bottom: 24px; max-height: 92vh; }
  .fb-open .fb-dialog { animation-name: fbSheet; }
  @keyframes fbSheet { from { transform: translateY(32px); opacity: 0; } }
}

/* ── "Did we help you keyword faster?" card ─────────────── */
.sat-root { position: fixed; bottom: 24px; z-index: 145; }
.sat-root.sat-narrow { left: 16px; right: 16px; bottom: 72px; }
.sat-card {
  position: relative; padding: 16px; background: var(--s1); color: var(--text);
  border: 1px solid rgba(var(--gold-rgb), .45); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
  animation: spRise .45s cubic-bezier(.16, 1, .3, 1);
}
@keyframes spRise { from { opacity: 0; transform: translateY(16px); } }
.sat-out { opacity: 0; transform: translateY(8px); transition: opacity .22s, transform .22s; pointer-events: none; }
.sat-root.sat-out.sat-narrow { transform: translateY(8px); }

.sat-head { display: flex; align-items: center; gap: 12px; padding-right: 32px; }
.sat-ico {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%; background: var(--gold-bg); color: var(--gold);
}
.sat-ico svg { width: 16px; height: 16px; }
.sat-q { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--text); }
.sat-q-solo { padding-right: 32px; margin-bottom: 12px; }
.sat-x {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--dim); cursor: pointer;
  transition: background-color .18s, color .18s;
}
.sat-x:hover { background: rgba(var(--gold-rgb), .14); color: var(--text); }
.sat-x svg { width: 16px; height: 16px; }

.sat-answers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sat-ans {
  min-height: 32px; padding: 0 12px; background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: border-color .18s, background-color .18s, transform .18s;
}
.sat-ans:hover { border-color: var(--gold); background: var(--gold-bg); transform: translateY(-1px); }

.sat-text {
  display: block; width: 100%; min-height: 56px; padding: 8px 12px; resize: vertical;
  background: var(--s2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 13px; line-height: 1.5;
}
.sat-text::placeholder { color: var(--fb-meta); }
.sat-actions { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.sat-link {
  margin-right: auto; min-height: 32px; padding: 0; background: none; border: 0; cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--dim);
  text-decoration: underline; text-underline-offset: 4px;
}
.sat-link:hover { color: var(--text); }
.sat-btn {
  min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: filter .18s, background-color .18s;
}
.sat-btn-gold { background: var(--gold); color: var(--bg); }
.sat-btn-gold:hover { filter: brightness(1.1); }
.sat-btn-ghost { background: transparent; color: var(--dim); }
.sat-btn-ghost:hover { background: rgba(var(--gold-rgb), .12); color: var(--text); }
.sat-root button:focus-visible, .sat-root textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .fb-open, .fb-open .fb-dialog, .fb-reveal, .fb-tick, .fb-tick svg, .sat-card { animation: none; }
  .fb-face, .fb-face-ico, .fb-chip, .fb-btn, .fb-social a, .sat-ans, .sat-out { transition: none; }
}
