/* ═══════════════════════════════════════════════════════════════════════════
   IDCraft feedback — the review popup and the after-work like / dislike card.
   Self-contained (own palette, light + dark via :root[data-theme]) because it
   sits on three different pages: the workspace, the landing page and the
   public reviews page. Markup: templates/components/feedback/review_popup.html
   ═══════════════════════════════════════════════════════════════════════════ */

.fbk-root {
  --fbk-bg: #ffffff;
  --fbk-bg-2: #f4f6f5;
  --fbk-ink: #0b130f;
  --fbk-ink-2: #47574e;
  --fbk-ink-3: #6c7e75;
  --fbk-line: rgba(11, 19, 15, 0.10);
  --fbk-line-2: rgba(11, 19, 15, 0.18);
  --fbk-forest: #072f1f;
  --fbk-forest-2: #0b3d29;
  --fbk-lime: #b4f105;
  --fbk-star: #f5b301;
  --fbk-star-off: #dde4e0;
  --fbk-like: #16a34a;
  --fbk-dislike: #e5484d;
  --fbk-shadow: 0 40px 100px -30px rgba(5, 28, 18, 0.45), 0 12px 30px -12px rgba(5, 28, 18, 0.18);
  --fbk-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fbk-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:root[data-theme="dark"] .fbk-root {
  --fbk-bg: #0a2219;
  --fbk-bg-2: #0e2c20;
  --fbk-ink: #eef4f0;
  --fbk-ink-2: #b3c5ba;
  --fbk-ink-3: #86a094;
  --fbk-line: rgba(174, 196, 184, 0.14);
  --fbk-line-2: rgba(174, 196, 184, 0.28);
  --fbk-star-off: rgba(174, 196, 184, 0.22);
  --fbk-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.8), 0 12px 30px -12px rgba(0, 0, 0, 0.6);
}

/* ── Dialog shell ───────────────────────────────────────────────────────── */
.fbk {
  position: fixed;
  inset: 0;
  z-index: 2050;
  display: grid;
  place-items: center;
  padding: 16px;
  visibility: hidden;
  pointer-events: none;
}

.fbk.is-open,
.fbk:target { visibility: visible; pointer-events: auto; }

.fbk__scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 20, 12, 0.55);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  backdrop-filter: blur(6px) saturate(140%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.fbk.is-open .fbk__scrim,
.fbk:target .fbk__scrim { opacity: 1; }

.fbk__dialog {
  position: relative;
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  scrollbar-width: none;
  border-radius: 26px;
  background: var(--fbk-bg);
  color: var(--fbk-ink);
  box-shadow: var(--fbk-shadow);
  border: 1px solid var(--fbk-line);
  opacity: 0;
  transform: translateY(26px) scale(0.94);
  transition: opacity 0.3s ease, transform 0.5s var(--fbk-spring);
  outline: none;
  isolation: isolate;
}

.fbk__dialog::-webkit-scrollbar { display: none; }

.fbk.is-open .fbk__dialog,
.fbk:target .fbk__dialog { opacity: 1; transform: none; }

/* Soft forest + lime light behind the top of the card. */
/* Tall enough that the heading and its subtitle always sit on the dark part,
   with or without the "… is done" badge above them. */
.fbk__glow {
  position: absolute;
  inset: 0 0 auto 0;
  height: 272px;
  overflow: hidden;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(160deg, #051c12 0%, #072f1f 55%, #0b3d29 100%);
  z-index: -1;
}

.fbk__glow span {
  position: absolute;
  border-radius: 50%;
  filter: blur(34px);
  opacity: 0.55;
  animation: fbkFloat 9s ease-in-out infinite alternate;
}

.fbk__glow span:first-child { width: 180px; height: 180px; left: -40px; top: -70px; background: #b4f105; opacity: 0.32; }
.fbk__glow span:last-child { width: 160px; height: 160px; right: -30px; top: 10px; background: #16a34a; animation-delay: -4s; }

.fbk__glow::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 44px;
  background: linear-gradient(to bottom, transparent, var(--fbk-bg));
}

@keyframes fbkFloat {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(24px, 18px) scale(1.15); }
}

.fbk__x {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s, transform 0.3s var(--fbk-spring);
}

.fbk__x:hover { background: rgba(255, 255, 255, 0.26); transform: rotate(90deg); }

.fbk__panel { padding: 26px 26px 24px; }
.fbk__panel[hidden] { display: none; }

.fbk__head { text-align: center; color: #fff; padding-top: 4px; }

.fbk__done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(180, 241, 5, 0.18);
  color: #d8ff6a;
  font-size: 0.74rem;
  font-weight: 700;
  margin-bottom: 8px;
  animation: fbkPop 0.5s var(--fbk-spring) both;
}

.fbk__done[hidden] { display: none; }

.fbk__face {
  width: 74px;
  height: 74px;
  margin: 2px auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 2.3rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 8px rgba(180, 241, 5, 0.08), 0 18px 40px -18px rgba(180, 241, 5, 0.6);
}

.fbk__face.is-bounce { animation: fbkBounce 0.55s var(--fbk-spring); }

.fbk__title {
  margin: 0 0 6px;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: inherit;
}

.fbk__sub { margin: 0; font-size: 0.86rem; line-height: 1.55; color: rgba(255, 255, 255, 0.74); }

.fbk__thanks .fbk__sub,
.fbk__signin .fbk__sub { color: var(--fbk-ink-2); }

.fbk__signin, .fbk__thanks { text-align: center; }
.fbk__signin { padding-top: 58px; }
.fbk__signin .fbk__actions { margin-top: 20px; }
.fbk__signin .fbk__face { background: rgba(245, 179, 1, 0.12); border-color: rgba(245, 179, 1, 0.3); }
.fbk__signin .fbk__title, .fbk__thanks .fbk__title { color: var(--fbk-ink); }

/* ── Stars ──────────────────────────────────────────────────────────────── */
.fbk__stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 34px 0 4px;
}

/* Without the "… is done" badge (the public pages) the header is shorter. */
.fbk__dialog:has(.fbk__done[hidden]) .fbk__glow { height: 232px; }

/* The thank-you and sign-in panels have dark text: just a band on top. */
.fbk__dialog:has(.fbk__thanks:not([hidden])) .fbk__glow,
.fbk__dialog:has(.fbk__signin) .fbk__glow { height: 84px; }

.fbk__star {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 12px;
  display: grid;
  place-items: center;
  animation: fbkDrop 0.55s var(--fbk-spring) both;
  animation-delay: calc(0.12s + var(--i) * 0.06s);
  transition: transform 0.25s var(--fbk-spring);
}

.fbk__star svg {
  width: 40px;
  height: 40px;
  fill: var(--fbk-star-off);
  stroke: transparent;
  transition: fill 0.2s ease, filter 0.2s ease;
}

.fbk__star:hover { transform: translateY(-3px) scale(1.12); }
.fbk__star:focus-visible { outline: 2px solid var(--fbk-lime); outline-offset: 2px; }

.fbk__star.is-lit svg {
  fill: var(--fbk-star);
  filter: drop-shadow(0 6px 12px rgba(245, 179, 1, 0.45));
}

.fbk__star.is-pop { animation: fbkPop 0.45s var(--fbk-spring); }

.fbk__mood {
  text-align: center;
  margin: 2px 0 16px;
  min-height: 1.4em;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--fbk-ink-3);
  transition: color 0.2s;
}

.fbk__mood.is-set { color: var(--fbk-ink); }

/* ── Fields ─────────────────────────────────────────────────────────────── */
.fbk__field { display: block; position: relative; margin: 0 0 14px; }

.fbk__label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--fbk-ink-2);
  margin-bottom: 6px;
}

.fbk__field textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  padding: 12px 14px 26px;
  border-radius: 14px;
  border: 1px solid var(--fbk-line-2);
  background: var(--fbk-bg-2);
  color: var(--fbk-ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.fbk__field textarea:focus {
  outline: none;
  border-color: #0b7a42;
  background: var(--fbk-bg);
  box-shadow: 0 0 0 4px rgba(180, 241, 5, 0.25);
}

.fbk__count {
  position: absolute;
  right: 12px;
  bottom: 9px;
  font-size: 0.7rem;
  color: var(--fbk-ink-3);
  pointer-events: none;
}

.fbk__who {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--fbk-bg-2);
  margin-bottom: 14px;
  font-size: 0.84rem;
}

.fbk__who b { display: block; font-weight: 700; }
.fbk__who small { display: block; color: var(--fbk-ink-3); font-size: 0.72rem; }

.fbk__avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 50%;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #08130c;
  background: linear-gradient(135deg, #b4f105, #5fd068);
}

.fbk__error {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(229, 72, 77, 0.1);
  color: #c9363b;
  font-size: 0.82rem;
  font-weight: 600;
  animation: fbkShake 0.4s ease;
}

.fbk__error[hidden] { display: none; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.fbk__actions { display: flex; gap: 10px; }
.fbk__actions > * { flex: 1 1 0; }

.fbk__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s var(--fbk-ease), box-shadow 0.2s, background 0.2s, color 0.2s, opacity 0.2s, border-color 0.2s;
}

.fbk__btn--sm { min-height: 36px; padding: 0 14px; font-size: 0.8rem; }

.fbk__btn--primary {
  background: linear-gradient(135deg, #072f1f, #0b3d29);
  color: #fff;
  box-shadow: 0 14px 30px -14px rgba(7, 47, 31, 0.7);
}

:root[data-theme="dark"] .fbk__btn--primary { background: #b4f105; color: #08130c; box-shadow: 0 14px 30px -14px rgba(180, 241, 5, 0.6); }

.fbk__btn--primary:hover:not(:disabled) { transform: translateY(-2px); color: #fff; box-shadow: 0 20px 40px -16px rgba(11, 122, 66, 0.7); }
:root[data-theme="dark"] .fbk__btn--primary:hover:not(:disabled) { color: #08130c; }
.fbk__btn--primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.fbk__btn--primary i { transition: transform 0.3s var(--fbk-spring); }
.fbk__btn--primary:hover:not(:disabled) i { transform: translateX(3px) rotate(-8deg); }
.fbk__btn.is-busy { pointer-events: none; opacity: 0.7; }

.fbk__btn--ghost { background: transparent; border-color: var(--fbk-line-2); color: var(--fbk-ink); }
.fbk__btn--ghost:hover { border-color: #0b7a42; color: var(--fbk-ink); transform: translateY(-2px); }

/* ── Thanks ─────────────────────────────────────────────────────────────── */
.fbk__thanks { position: relative; padding-top: 64px; }
.fbk__thanks .fbk__actions { margin-top: 20px; }

.fbk__check { width: 86px; height: 86px; margin: 0 auto 14px; display: block; }

.fbk__check circle {
  fill: rgba(180, 241, 5, 0.16);
  stroke: #16a34a;
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: fbkDraw 0.6s var(--fbk-ease) forwards;
}

.fbk__check path {
  fill: none;
  stroke: #16a34a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: fbkDraw 0.4s 0.45s var(--fbk-ease) forwards;
}

.fbk__burst { position: absolute; left: 50%; top: 108px; width: 0; height: 0; pointer-events: none; }

.fbk__burst i {
  position: absolute;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: fbkConfetti 1.1s var(--fbk-ease) forwards;
}

/* ── After-work like / dislike card — small, glassy, one line ───────────── */
.fbk-react {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2040;
  width: min(320px, calc(100vw - 32px));
  padding: 10px 10px 10px 10px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--fbk-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  color: var(--fbk-ink);
  border: 1px solid var(--fbk-line);
  box-shadow: 0 18px 44px -18px rgba(5, 28, 18, 0.45), 0 2px 6px rgba(5, 28, 18, 0.06);
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transition: opacity 0.25s ease, transform 0.5s var(--fbk-spring), visibility 0s linear 0.5s;
}

.fbk-react.is-open {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity 0.25s ease, transform 0.5s var(--fbk-spring), visibility 0s;
}

/* A thin lime-to-green edge that runs along the top. */
.fbk-react::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #b4f105, #16a34a, transparent);
  background-size: 200% 100%;
  animation: fbkSheen 2.4s linear infinite;
}

.fbk-react__main { display: flex; align-items: center; gap: 10px; }

.fbk-react__icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: #08130c;
  background: linear-gradient(135deg, #b4f105, #6fdc5a);
  box-shadow: 0 8px 18px -10px rgba(180, 241, 5, 0.9);
}

.fbk-react.is-open .fbk-react__icon { animation: fbkPop 0.55s 0.1s var(--fbk-spring) both; }

.fbk-react__text { flex: 1 1 auto; min-width: 0; line-height: 1.25; }
.fbk-react__text b { display: block; font-size: 0.8rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fbk-react__text small { display: block; font-size: 0.72rem; color: var(--fbk-ink-3); }

.fbk-react__choices { display: flex; gap: 6px; flex: 0 0 auto; }
.fbk-react__choices[hidden] { display: none; }

.fbk-react__btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--fbk-line-2);
  background: var(--fbk-bg);
  color: var(--fbk-ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.98rem;
  transition: transform 0.25s var(--fbk-spring), border-color 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
}

.fbk-react__btn:hover { transform: translateY(-2px) scale(1.08); }
.fbk-react__btn:focus-visible { outline: 2px solid #0b7a42; outline-offset: 2px; }

.fbk-react__btn--like:hover, .fbk-react__btn--like.is-picked {
  border-color: var(--fbk-like);
  background: var(--fbk-like);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(22, 163, 74, 0.8);
}

.fbk-react__btn--dislike:hover, .fbk-react__btn--dislike.is-picked {
  border-color: var(--fbk-dislike);
  background: var(--fbk-dislike);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(229, 72, 77, 0.8);
}

.fbk-react__btn--like:hover i { animation: fbkWiggle 0.5s ease; }
.fbk-react__btn--dislike:hover i { animation: fbkWiggle 0.5s ease reverse; }
.fbk-react__btn.is-picked i { animation: fbkBounce 0.6s var(--fbk-spring); }

.fbk-react__x {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fbk-ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--fbk-spring);
}

.fbk-react__x:hover { background: var(--fbk-bg-2); color: var(--fbk-ink); transform: rotate(90deg); }

.fbk-react__why {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  animation: fbkRise 0.35s var(--fbk-ease) both;
}

.fbk-react__why[hidden] { display: none; }

.fbk-react__why input {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--fbk-line-2);
  background: var(--fbk-bg-2);
  color: var(--fbk-ink);
  font: inherit;
  font-size: 0.78rem;
}

.fbk-react__why input:focus { outline: none; border-color: #0b7a42; box-shadow: 0 0 0 3px rgba(180, 241, 5, 0.25); }

.fbk-react__mini {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--fbk-line-2);
  background: transparent;
  color: var(--fbk-ink-2);
  font: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.fbk-react__mini:hover { background: var(--fbk-bg-2); color: var(--fbk-ink); }
.fbk-react__mini--send { padding: 0; width: 34px; border: 0; background: #072f1f; color: #fff; }
:root[data-theme="dark"] .fbk-react__mini--send { background: #b4f105; color: #08130c; }
.fbk-react__mini--send:hover { transform: translateY(-1px) rotate(-8deg); background: #0b3d29; color: #fff; }
:root[data-theme="dark"] .fbk-react__mini--send:hover { background: #c1f824; color: #08130c; }

.fbk-react.is-done .fbk-react__icon { background: linear-gradient(135deg, #ff7a8a, #e5484d); color: #fff; }
.fbk-react.is-done.is-liked .fbk-react__icon { background: linear-gradient(135deg, #34d67a, #16a34a); }

/* "+1" drifting up from the button that was picked. */
.fbk-react__float { position: absolute; pointer-events: none; font-size: 0.8rem; font-weight: 800; opacity: 0; }
.fbk-react__float.is-go { animation: fbkFloatUp 1s var(--fbk-ease) forwards; }

.fbk-react__timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: rgba(11, 122, 66, 0.4);
  transform-origin: left;
  transform: scaleX(0);
}

.fbk-react__timer.is-running { animation: fbkTimer var(--fbk-react-ms, 25s) linear forwards; }
.fbk-react:hover .fbk-react__timer.is-running,
.fbk-react:focus-within .fbk-react__timer.is-running { animation-play-state: paused; }

@keyframes fbkSheen { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes fbkWiggle { 0%, 100% { transform: none; } 30% { transform: rotate(-16deg) scale(1.1); } 60% { transform: rotate(10deg); } }
@keyframes fbkFloatUp { 0% { opacity: 0; transform: translateY(0) scale(0.7); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px) scale(1.15); } }

/* The workspace's quick-add button lives bottom-right too. */
.fbk-root--workspace .fbk-react { bottom: 88px; }

/* ── Keyframes ──────────────────────────────────────────────────────────── */
@keyframes fbkDrop { from { opacity: 0; transform: translateY(-16px) scale(0.6) rotate(-20deg); } to { opacity: 1; transform: none; } }
@keyframes fbkPop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes fbkBounce { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-8deg); } 70% { transform: scale(0.92) rotate(4deg); } }
@keyframes fbkDraw { to { stroke-dashoffset: 0; } }
@keyframes fbkRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fbkShake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes fbkBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.22); } }
@keyframes fbkTimer { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes fbkConfetti {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) rotate(var(--r)); }
}

@media (max-width: 480px) {
  .fbk__panel { padding: 22px 18px 18px; }
  .fbk__star { width: 44px; height: 44px; }
  .fbk__star svg { width: 36px; height: 36px; }
  .fbk__actions { flex-direction: column-reverse; }
  .fbk-react { right: 16px; left: 16px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .fbk-root *, .fbk-root *::before, .fbk-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
