/* Widget-only Inter as 'FS Inter' so host-page Inter @font-face is never overridden.
   Live embed: compile inlines this woff2 (no extra request). Builder loads the file locally. */
@font-face {
  font-family: 'FS Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/widget/fs-inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.fs-widget,
.fs-widget *,
.fs-widget *::before,
.fs-widget *::after {
  box-sizing: border-box;
  font-family: 'FS Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.fs-widget button {
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.fs-widget {
  position: fixed;
  bottom: var(--fs-widget-inset);
  right: var(--fs-widget-inset);
  z-index: 999999;
  -webkit-font-smoothing: antialiased;
  --fs-widget-inset: 24px;
  --fs-widget-pad: 25px;
  --fs-widget-card-offset: 64px;
  --fs-widget-close-size: 20px;
  --fs-widget-close-inset: 12px;
  --fs-widget-border: #e7e7e7;
  --fs-widget-chip-bg: #f9f9f9;
  --fs-widget-chip-border: #eaeaea;
  --fs-widget-footer-bg: #fcfcfc;
  --fs-widget-footer-border: #f3f3f3;
  --fs-widget-muted: #bdbdbd;
  --fs-widget-strong: #606060;
  --fs-widget-brand: #0171ff;
}

/* Notched phones: keep the launcher clear of the home indicator / sides */
.fs-widget {
  bottom: max(var(--fs-widget-inset), env(safe-area-inset-bottom, 0px));
  right: max(var(--fs-widget-inset), env(safe-area-inset-right, 0px));
}

/* Left-side override */
.fs-widget.fs-widget--left {
  right: auto;
  left: var(--fs-widget-inset);
  left: max(var(--fs-widget-inset), env(safe-area-inset-left, 0px));
}

/* Launcher bubble — anchors the whole widget to the corner */
.fs-widget-launcher {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  border-radius: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: opacity 0.5s ease;
}



.fs-widget--left .fs-widget-launcher {
  right: auto;
  left: 0;
}

.fs-widget-launcher-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  pointer-events: none;
}

.fs-widget-launcher-icon svg {
  width: 48px;
  height: 48px;
  display: block;
}

/* Card */

@keyframes fadeInUpWidget {
  from {
    opacity: 0;
    transform: translate3d(0, 10%, 0);
  }

  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeOutDownWidget {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  to {
    opacity: 0;
    transform: translate3d(0, 10%, 0);
  }
}

.fadeInUpWidget {
  animation-name: fadeInUpWidget;
}

.fadeOutDownWidget {
  animation-name: fadeOutDownWidget;
}

.fs-widget-card {
  position: absolute;
  bottom: var(--fs-widget-card-offset);
  right: 0;
  width: 380px;
  max-width: calc(100vw - (var(--fs-widget-inset) * 2) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  max-height: calc(100vh - var(--fs-widget-card-offset) - var(--fs-widget-inset) * 2);
  max-height: calc(100svh - var(--fs-widget-card-offset) - var(--fs-widget-inset) * 2);
  background: #ffffff;
  border: 1px solid var(--fs-widget-border);
  border-radius: 22px;
  padding-top: var(--fs-widget-pad);
  box-shadow: 0 4px 2px rgba(188, 188, 188, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate3d(0, 10%, 0);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s linear 0.4s;
}

.fs-widget--left .fs-widget-card {
  right: auto;
  left: 0;
}

.fs-widget.fs-widget-is-open .fs-widget-card {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition: opacity 0.4s ease, transform 0.4s ease, visibility 0s linear 0s;
}


.fs-widget-body {
  width: calc(100% - (var(--fs-widget-pad) * 2));
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: var(--fs-widget-pad);
}

.fs-widget-question {
  margin: 0;
  font-weight: 500;
  font-size: 17px;
  line-height: 20px;
  color: #000000;
  word-break: break-word;
  padding-right: 30px;
}

/* Emoji rating row */
.fs-widget-emoji-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

.fs-widget-emoji {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 8px 0;
  background: var(--fs-widget-chip-bg);
  border: 1px solid var(--fs-widget-chip-border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

.fs-widget-emoji-icon {
  display: block;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  pointer-events: none;
}

.fs-widget-emoji-icon svg,
.fs-widget-emoji-icon img {
  display: block;
  width: 100%;
  height: 100%;
}

/* Number / thumbs scale */
.fs-widget-scale {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.fs-widget-scale-row {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.fs-widget-option {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  padding: 2px 0;
  background: var(--fs-widget-chip-bg);
  border: 1px solid var(--fs-widget-chip-border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-weight: 600;
  font-size: 17px;
  line-height: 24px;
  color: #1a1919;
  cursor: pointer;
  transition: opacity 0.5s ease;
}

.fs-widget-scale-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  font-weight: 500;
  font-size: 11px;
  line-height: normal;
  letter-spacing: 0.0645px;
  color: #98a2b3;
}

.fs-widget-scale-labels span {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Thumbs up / down */
.fs-widget-scale-row--thumbs {
  gap: 10px;
}

.fs-widget-option--thumb {
  padding: 5px 0;
  min-height: 50px;
}

/* 0–10 NPS scale (wider card, 11 score buttons) */
.fs-widget-card--wide {
  width: 450px;
}

.fs-widget-scale-row--ten {
  gap: 4px;
  width: 100%;
}

.fs-widget-option--ten {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 12px;
  font-size: 13px;
  line-height: 24px;
  font-variant-numeric: tabular-nums;
}

/* Follow-up step */
.fs-widget-follow-up {
  display: none;
  width: calc(100% - (var(--fs-widget-pad) * 2));
  flex-direction: column;
  gap: 15px;
  padding-bottom: var(--fs-widget-pad);
}

.fs-widget-textarea {
  display: block;
  width: 100%;
  min-height: 70px;
  max-height: 200px;
  margin: 0;
  padding: 12px 15px;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #d2d2d2;
  border-radius: 16px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.06);
  font-family: inherit;
  font-style: normal;
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  color: #000000;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}

.fs-widget-textarea::placeholder {
  color: #bebebe;
}

.fs-widget-textarea:focus {
  border: 1px solid var(--fs-widget-brand);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--fs-widget-brand);
  color: var(--fs-widget-brand);
  background-color: #fff;
}

.fs-widget-follow-up-actions {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-height: 46px;
}

.fs-widget-btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 19px;
  background: var(--fs-widget-brand);
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 500;
  font-size: 14.5px;
  line-height: normal;
  color: var(--fs-widget-btn-text, #ffffff);
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.5s ease;
}

.fs-widget-btn-skip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  margin-left: 4px;
  background: #ffffff;
  border: none;
  border-radius: 16px;
  font-family: inherit;
  font-weight: 500;
  font-size: 14.5px;
  line-height: normal;
  color: var(--fs-widget-muted);
  cursor: pointer;
  white-space: nowrap;
}

/* Success step */
.fs-widget-success {
  display: none;
  width: calc(100% - (var(--fs-widget-pad) * 2));
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding-top: 27px;
  padding-bottom: 50px;
  text-align: center;
}

.fs-widget-success-icon {
  width: 36px;
  height: 36px;
  border-radius: 40px;
  background: #04cb10;
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.fs-widget-success-icon svg {
  width: 18px;
  height: 14px;
  display: block;
}

.fs-widget-success-message {
  margin: 0;
  width: 100%;
  font-weight: 500;
  font-size: 17px;
  line-height: 20px;
  color: #000000;
  word-break: break-word;
}

.fs-widget-card--success .fs-widget-footer {
  margin-top: 0;
}

/* Already participated — return visit after a completed vote */
.fs-widget-thanks {
  display: none;
  width: calc(100% - (var(--fs-widget-pad) * 2));
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  padding-bottom: 28px;
  text-align: center;
}

.fs-widget-thanks-message {
  margin: 0;
  width: 100%;
  font-weight: 500;
  font-size: 15px;
  line-height: 20px;
  color: var(--fs-widget-strong);
  word-break: break-word;
}

.fs-widget-card--thanks .fs-widget-footer {
  margin-top: 0;
}

/* Footer */
.fs-widget-footer {
  width: 100%;
  margin-top: 0;
  padding: 15px var(--fs-widget-pad);
  background: var(--fs-widget-footer-bg);
  border-top: 1px solid var(--fs-widget-footer-border);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.fs-widget-footer p {
  margin: 0;
  font-weight: 500;
  font-size: 11px;
  line-height: 20px;
  white-space: nowrap;
  color: var(--fs-widget-muted);
}

.fs-widget-footer-link {
  color: var(--fs-widget-strong);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.5s ease;
}

/* Close button — overlaps the top corner of the card */
.fs-widget-close {
  position: absolute;
  top: var(--fs-widget-close-inset);
  right: var(--fs-widget-close-inset);
  width: var(--fs-widget-close-size);
  height: var(--fs-widget-close-size);
  background: #ffffff;
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  padding: 3px;
  transition: opacity 0.5s ease;
}

.fs-widget-close svg {
  width: 14px;
  height: 14px;
}

/* Hover only when the device can hover — avoids sticky tap states on touch */
@media (hover: hover) {
  .fs-widget-launcher:hover {
    opacity: 0.7;
  }

  .fs-widget-emoji:hover,
  .fs-widget-option:hover,
  .fs-widget-btn-submit:hover {
    opacity: 0.7;
  }

  .fs-widget-btn-skip:hover {
    color: var(--fs-widget-strong);
  }

  .fs-widget-footer-link:hover {
    color: #1964FF;
  }

  .fs-widget-close:hover {
    opacity: 0.5;
  }
}

/* -------------------------------------------------------------------------
   Responsive — breakpoints from the widget’s own widths, not the host page.

   520px  NPS 450px card + 24px insets no longer fits (450 + 48 = 498)
   420px  Standard 380px card + 24px insets no longer fits (380 + 48 = 428)
   360px  Compact phones (320–375)
   500px height  Landscape / short viewports
   ------------------------------------------------------------------------- */

@media screen and (max-width: 520px) {
  .fs-widget {
    --fs-widget-inset: 16px;
  }

  .fs-widget-option--ten {
    height: 40px;
    min-height: 40px;
    font-size: 12px;
  }
}

@media screen and (max-width: 420px) {
  .fs-widget {
    --fs-widget-inset: 12px;
    --fs-widget-pad: 18px;
    --fs-widget-close-size: 24px;
    --fs-widget-close-inset: 8px;
  }

  .fs-widget-card {
    border-radius: 18px;
  }

  .fs-widget-body {
    gap: 14px;
  }

  .fs-widget-follow-up {
    gap: 12px;
  }

  .fs-widget-emoji-row,
  .fs-widget-scale-row:not(.fs-widget-scale-row--ten):not(.fs-widget-scale-row--thumbs) {
    gap: 6px;
  }

  .fs-widget-emoji-icon {
    width: 24px;
    height: 24px;
  }

  .fs-widget-option:not(.fs-widget-option--ten):not(.fs-widget-option--thumb) {
    border-radius: 14px;
    font-size: 15px;
    min-height: 42px;
  }

  .fs-widget-option--ten {
    border-radius: 10px;
  }

  .fs-widget-question,
  .fs-widget-success-message {
    font-size: 16px;
    line-height: 20px;
  }

  .fs-widget-textarea {
    min-height: 64px;
    padding: 14px 15px;
    border-radius: 14px;
  }

  .fs-widget-btn-submit,
  .fs-widget-btn-skip {
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
  }

  .fs-widget-success {
    padding-top: 20px;
    padding-bottom: 36px;
    gap: 12px;
  }

  .fs-widget-thanks {
    padding-bottom: 20px;
  }

  .fs-widget-footer {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .fs-widget-close {
    padding: 4px;
  }
}

@media screen and (max-width: 360px) {
  .fs-widget {
    --fs-widget-pad: 14px;
  }

  .fs-widget-card {
    border-radius: 16px;
  }

  .fs-widget-body {
    gap: 12px;
  }

  .fs-widget-emoji-row,
  .fs-widget-scale-row:not(.fs-widget-scale-row--ten):not(.fs-widget-scale-row--thumbs) {
    gap: 4px;
  }

  .fs-widget-option:not(.fs-widget-option--ten):not(.fs-widget-option--thumb) {
    border-radius: 12px;
    font-size: 14px;
    min-height: 40px;
  }

  .fs-widget-option--ten {
    height: 36px;
    min-height: 36px;
    border-radius: 8px;
    font-size: 11px;
  }

  .fs-widget-question,
  .fs-widget-success-message {
    font-size: 15px;
    line-height: 19px;
  }

  .fs-widget-scale-labels {
    font-size: 10px;
  }

  .fs-widget-footer p {
    font-size: 10px;
    white-space: normal;
  }

  .fs-widget-btn-submit,
  .fs-widget-btn-skip {
    padding: 12px 14px;
  }
}

@media screen and (max-height: 500px) {
  .fs-widget-card {
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .fs-widget-body,
  .fs-widget-follow-up {
    gap: 10px;
  }

  .fs-widget-textarea {
    min-height: 52px;
    padding: 12px 14px;
  }

  .fs-widget-success {
    padding-top: 12px;
    padding-bottom: 24px;
    gap: 10px;
  }

  .fs-widget-thanks {
    padding-top: 4px;
    padding-bottom: 16px;
  }

  .fs-widget-footer {
    padding-top: 10px;
    padding-bottom: 10px;
  }
}
