/* ==========================================================================
   Survey Popup · front
   Todas las clases van prefijadas con .spp- para no chocar con el tema.
   ========================================================================== */

.spp-root {
  --spp-primary: #1f6feb;
  --spp-primary-ink: #ffffff;
  --spp-primary-soft: rgba(31, 111, 235, .08);
  --spp-primary-ring: rgba(31, 111, 235, .28);
  --spp-progress: #22c55e;
  --spp-bubble: #1f6feb;
  --spp-bubble-ink: #ffffff;
  --spp-bubble-ring: rgba(31, 111, 235, .45);
  --spp-ink: #161a20;
  --spp-ink-2: #4b5360;
  --spp-ink-3: #7b8391;
  --spp-line: #e3e6eb;
  --spp-surface: #ffffff;
  --spp-surface-2: #f5f7f9;
  --spp-radius: 20px;
  font-family: inherit;
  color: var(--spp-ink);
  -webkit-font-smoothing: antialiased;
}

.spp-root *,
.spp-root *::before,
.spp-root *::after {
  box-sizing: border-box;
}

.spp-root button {
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
  text-shadow: none;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
}

.spp-root h2,
.spp-root h3 {
  font-family: inherit !important;
  text-transform: none !important;
  margin: 0;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  height: auto !important;
  color: var(--spp-ink) !important;
  text-align: inherit;
}

.spp-root button:focus {
  outline: none !important;
}

.spp-root button:focus-visible {
  outline: 3px solid var(--spp-primary-ring) !important;
  outline-offset: 2px;
}

.spp-root img {
  display: block;
  max-width: 100%;
  border: 0;
}

.spp-root svg {
  display: block;
}

html.spp-lock,
body.spp-lock {
  overflow: hidden !important;
}

/* ------------------------------------------------------------------ overlay */

.spp-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(13, 16, 22, .55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility 0s linear .3s;
}

.spp-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity .28s ease;
}

/* -------------------------------------------------------------------- modal */

.spp-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--spp-surface);
  color: var(--spp-ink);
  border-radius: var(--spp-radius);
  box-shadow: 0 32px 80px -24px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .04);
  transform: translateY(18px) scale(.97);
  opacity: .4;
  transition: transform .38s cubic-bezier(.2, .9, .25, 1.08), opacity .28s ease;
  outline: none;
  text-align: left;
}

.spp-overlay.is-visible .spp-modal {
  transform: none;
  opacity: 1;
}

.spp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .94);
  color: var(--spp-ink);
  box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .3);
  cursor: pointer;
  transition: transform .2s ease, background .2s ease;
}

.spp-close:hover {
  transform: rotate(90deg);
  background: #fff;
}

.spp-close:focus-visible {
  outline: 3px solid var(--spp-primary-ring);
  outline-offset: 2px;
}

.spp-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* ----------------------------------------------------------------- progress */

.spp-progress {
  display: none;
  padding: 24px 68px 0 30px;
}

.spp-progress.is-visible {
  display: block;
}

.spp-progress-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.3;
}

.spp-progress-label {
  color: var(--spp-ink-3);
  font-weight: 500;
}

.spp-progress-pct {
  color: var(--spp-ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.spp-progress-track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: #edf0f3;
  overflow: hidden;
}

.spp-progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  border-radius: 99px;
  background: var(--spp-progress);
  transition: width .55s cubic-bezier(.3, .8, .3, 1);
}

.spp-progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .35) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-100%);
  animation: spp-shine 2.4s ease-in-out infinite;
}

/* ------------------------------------------------------------------ screens */

.spp-screen-wrap {
  position: relative;
}

.spp-screen {
  opacity: 1;
  transform: none;
  transition: opacity .3s ease, transform .38s cubic-bezier(.2, .8, .25, 1);
}

.spp-screen.spp-enter {
  opacity: 0;
  transition: none;
}

.spp-screen.spp-from-right {
  transform: translateX(26px);
}

.spp-screen.spp-from-left {
  transform: translateX(-26px);
}

.spp-inner {
  padding: 30px 32px 32px;
}

.spp-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  max-height: 260px;
  overflow: hidden;
  background: var(--spp-surface-2);
}

.spp-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spp-intro,
.spp-thanks {
  text-align: center;
}

.spp-title {
  font-size: 24px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  letter-spacing: -.015em;
  margin: 0 0 10px !important;
}

.spp-intro .spp-inner {
  padding-top: 28px;
}

.spp-modal:not(.spp-has-hero) .spp-intro .spp-inner {
  padding-top: 44px;
}

.spp-text {
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--spp-ink-2);
}

.spp-text p {
  margin: 0 0 .6em;
}

.spp-text p:last-child {
  margin-bottom: 0;
}

.spp-text a {
  color: var(--spp-primary);
  text-decoration: underline;
}

.spp-intro .spp-text,
.spp-thanks .spp-text {
  max-width: 400px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------ buttons */

.spp-root .spp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 24px;
  border: 0;
  border-radius: 13px;
  font-size: 15.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .2s ease, background-color .2s ease, opacity .2s ease, filter .2s ease;
}

.spp-root .spp-btn:focus-visible {
  outline: 3px solid var(--spp-primary-ring);
  outline-offset: 2px;
}

.spp-root .spp-btn-primary {
  background: var(--spp-primary);
  color: var(--spp-primary-ink);
  box-shadow: 0 10px 22px -10px var(--spp-primary-ring), 0 2px 4px -1px rgba(0, 0, 0, .12);
}

.spp-root .spp-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 14px 26px -10px var(--spp-primary-ring), 0 2px 4px -1px rgba(0, 0, 0, .12);
}

.spp-root .spp-btn-primary:active:not(:disabled) {
  transform: translateY(0) scale(.985);
}

.spp-root .spp-btn-primary:disabled,
.spp-root .spp-btn-primary.is-disabled {
  opacity: .42;
  cursor: not-allowed;
  box-shadow: none;
}

.spp-root .spp-btn-ghost {
  background: transparent;
  color: var(--spp-ink-2);
  padding: 0 14px 0 10px;
}

.spp-root .spp-btn-ghost:hover {
  background: var(--spp-surface-2);
  color: var(--spp-ink);
}

.spp-ico svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spp-btn .spp-ico {
  transition: transform .2s ease;
}

.spp-btn-primary:hover:not(:disabled) .spp-ico {
  transform: translateX(2px);
}

.spp-root .spp-cta {
  width: 100%;
  max-width: 340px;
  margin-top: 24px;
}

.spp-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--spp-ink-3);
}

.spp-meta .spp-ico svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

/* ----------------------------------------------------------------- question */

.spp-question .spp-inner {
  padding-top: 20px;
}

.spp-question-title {
  font-size: 20px !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
  letter-spacing: -.01em;
  margin: 0 0 4px !important;
}

.spp-hint {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--spp-ink-3);
}

.spp-options {
  display: grid;
  gap: 10px;
}

.spp-root .spp-option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  text-align: left;
  font-size: 15.5px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--spp-ink);
  background: var(--spp-surface);
  border: 1.5px solid var(--spp-line);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .12s ease;
}

.spp-root .spp-option:hover {
  border-color: var(--spp-primary-ring);
  background: #fbfcfd;
}

.spp-root .spp-option:active {
  transform: scale(.992);
}

.spp-root .spp-option:focus-visible {
  outline: 3px solid var(--spp-primary-ring);
  outline-offset: 2px;
}

.spp-root .spp-option.is-selected {
  border-color: var(--spp-primary);
  background: var(--spp-primary-soft);
  box-shadow: 0 0 0 1px var(--spp-primary) inset;
}

.spp-check {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #c3c9d2;
  border-radius: 50%;
  background: #fff;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.spp-option.is-multi .spp-check {
  border-radius: 7px;
}

.spp-check svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--spp-primary-ink);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: scale(0);
  transition: transform .22s cubic-bezier(.3, 1.6, .5, 1);
}

.spp-option.is-selected .spp-check {
  background: var(--spp-primary);
  border-color: var(--spp-primary);
}

.spp-option.is-selected .spp-check svg {
  transform: scale(1);
}

.spp-option-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.spp-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.spp-root .spp-next {
  min-width: 160px;
}

/* ------------------------------------------------------------------- thanks */

.spp-thanks .spp-inner {
  padding-top: 26px;
}

.spp-thanks-icon {
  width: 76px;
  height: 76px;
  margin: 4px auto 18px;
}

.spp-thanks-icon svg {
  width: 76px;
  height: 76px;
  fill: none;
  stroke: var(--spp-progress);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spp-thanks-icon circle {
  stroke-dasharray: 152;
  stroke-dashoffset: 152;
  animation: spp-draw .7s ease-out .1s forwards;
  fill: rgba(0, 0, 0, 0);
}

.spp-thanks-icon path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: spp-draw .4s ease-out .65s forwards;
}

.spp-thanks-img {
  margin: 0 auto 18px;
  max-width: 260px;
}

.spp-thanks-img img {
  margin: 0 auto;
  max-height: 180px;
  border-radius: 14px;
  object-fit: cover;
}

.spp-root .spp-finish {
  width: 100%;
  max-width: 300px;
  margin-top: 24px;
}

/* --------------------------------------------------------------- animations */

.spp-modal.spp-shake {
  animation: spp-shake .4s ease;
}

@keyframes spp-shake {
  0%, 100% { transform: none; }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

@keyframes spp-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes spp-shine {
  0% { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* ------------------------------------------------------------------- bubble */

.spp-root .spp-bubble {
  position: fixed;
  left: 18px;
  top: 50%;
  z-index: 2147482000;
  display: flex;
  align-items: center;
  height: 60px;
  min-width: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--spp-bubble);
  color: var(--spp-bubble-ink);
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 255, 255, .85);
  cursor: pointer;
  opacity: 0;
  transform: translate(-150%, -50%);
  transition: transform .5s cubic-bezier(.2, .9, .3, 1.25), opacity .3s ease;
}

.spp-root .spp-bubble.is-visible {
  opacity: 1;
  transform: translate(0, -50%);
  animation: spp-float 3.4s ease-in-out .7s infinite;
}

.spp-root .spp-bubble.is-leaving {
  animation: none;
  opacity: 0;
  transform: translate(-150%, -50%) scale(.6);
}

.spp-root .spp-bubble:focus-visible {
  outline: 3px solid var(--spp-bubble-ring);
  outline-offset: 3px;
}

.spp-bubble-pulse {
  position: absolute;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  pointer-events: none;
  animation: spp-pulse 2.8s ease-out 1s infinite;
}

.spp-bubble-icon {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  animation: spp-wiggle 5s ease-in-out 1.5s infinite;
  transform-origin: 50% 60%;
}

.spp-bubble-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.spp-bubble-label {
  position: relative;
  display: block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  padding-right: 0;
  margin-left: -6px;
  font-size: 14.5px;
  font-weight: 650;
  transition: max-width .45s cubic-bezier(.3, .8, .3, 1), padding .45s ease, opacity .3s ease;
}

.spp-bubble:hover .spp-bubble-label,
.spp-bubble:focus-visible .spp-bubble-label,
.spp-bubble.is-peek .spp-bubble-label {
  max-width: 260px;
  padding-right: 22px;
  opacity: 1;
}

.spp-bubble-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 26px;
  padding: 3px 6px;
  border-radius: 99px;
  background: #fff;
  color: var(--spp-ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 3px 8px -2px rgba(0, 0, 0, .3);
  font-variant-numeric: tabular-nums;
}

@keyframes spp-float {
  0%, 100% { transform: translate(0, -50%); }
  50% { transform: translate(0, calc(-50% - 7px)); }
}

@keyframes spp-wiggle {
  0%, 82%, 100% { transform: rotate(0); }
  85% { transform: rotate(-13deg); }
  88% { transform: rotate(11deg); }
  91% { transform: rotate(-7deg); }
  94% { transform: rotate(4deg); }
  97% { transform: rotate(-1deg); }
}

@keyframes spp-pulse {
  0% { box-shadow: 0 0 0 0 var(--spp-bubble-ring); }
  70%, 100% { box-shadow: 0 0 0 18px rgba(0, 0, 0, 0); }
}

/* --------------------------------------------------------- preview (admin) */

.spp-preview-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 2147483001;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 99px;
  background: #161a20;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .5);
}

.spp-preview-bar button {
  border: 0;
  border-radius: 99px;
  padding: 6px 12px;
  background: #fff;
  color: #161a20;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.spp-inline {
  position: absolute;
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

.spp-inline .spp-overlay {
  position: absolute;
  z-index: 5;
  padding: 18px;
}

.spp-inline .spp-modal {
  max-height: calc(100% - 8px);
}

.spp-root.spp-inline .spp-bubble {
  position: absolute;
  z-index: 4;
}

/* --------------------------------------------------------------- responsive */

@media (max-width: 600px) {
  .spp-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .spp-modal {
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    opacity: 1;
    transition: transform .42s cubic-bezier(.2, .9, .25, 1);
  }

  .spp-inner {
    padding: 24px 20px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .spp-progress {
    padding: 22px 64px 0 20px;
  }

  .spp-hero {
    max-height: 190px;
  }

  .spp-title {
    font-size: 21px !important;
  }

  .spp-question-title {
    font-size: 18px !important;
  }

  .spp-root .spp-option {
    min-height: 52px;
    padding: 13px 14px;
    font-size: 15px;
  }

  .spp-nav {
    position: sticky;
    bottom: 0;
    margin: 20px -20px -24px;
    margin-bottom: calc(-24px - env(safe-area-inset-bottom));
    padding: 12px 20px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--spp-line);
  }

  .spp-root .spp-next {
    flex: 1 1 auto;
    min-width: 0;
  }

  .spp-root .spp-bubble {
    left: 12px;
    height: 52px;
    min-width: 52px;
  }

  .spp-bubble-icon {
    width: 52px;
    height: 52px;
  }

  .spp-bubble-icon svg {
    width: 24px;
    height: 24px;
  }

  .spp-bubble-label {
    font-size: 13.5px;
  }
}

/* Mismas reglas forzadas para la vista previa "móvil" del back-office */
.spp-force-mobile .spp-overlay {
  padding: 0;
  align-items: flex-end;
}

.spp-force-mobile .spp-modal {
  max-width: 100%;
  max-height: 92%;
  border-radius: 22px 22px 0 0;
  transform: translateY(100%);
  opacity: 1;
  transition: transform .42s cubic-bezier(.2, .9, .25, 1);
}

.spp-force-mobile .spp-inner {
  padding: 24px 20px;
}

.spp-force-mobile .spp-progress {
  padding: 22px 64px 0 20px;
}

.spp-force-mobile .spp-hero {
  max-height: 190px;
}

.spp-force-mobile .spp-title {
  font-size: 21px !important;
}

.spp-force-mobile .spp-question-title {
  font-size: 18px !important;
}

.spp-force-mobile .spp-option {
  min-height: 52px;
  padding: 13px 14px;
  font-size: 15px;
}

.spp-force-mobile .spp-nav {
  position: sticky;
  bottom: 0;
  margin: 20px -20px -24px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--spp-line);
}

.spp-force-mobile .spp-next {
  flex: 1 1 auto;
  min-width: 0;
}

.spp-root.spp-force-mobile .spp-bubble {
  left: 12px;
  height: 52px;
  min-width: 52px;
}

.spp-force-mobile .spp-bubble-icon {
  width: 52px;
  height: 52px;
}

.spp-force-mobile .spp-bubble-icon svg {
  width: 24px;
  height: 24px;
}

/* Overlay visible: el modal entra desde abajo en móvil */
.spp-overlay.is-visible .spp-modal {
  transform: none;
}

/* Refresco instantáneo de la vista previa del back-office */
.spp-instant .spp-overlay,
.spp-instant .spp-modal,
.spp-instant .spp-screen,
.spp-instant .spp-bubble,
.spp-instant .spp-progress-bar {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .spp-root *,
  .spp-root *::before,
  .spp-root *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
