/* Survey launcher widget — scoped under .svw (site-wide, hidden on the survey page itself) */
.svw {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.svw *,
.svw *::before,
.svw *::after {
  box-sizing: border-box;
}

/* Screen-reader only helpers (live region is created by JS) */
.svw-live {
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  height: 1px !important;
  width: 1px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  position: absolute !important;
}

/* Hide widget when printing */
@media print {
  .svw { display: none !important; }
}

/* ---------- Floating action button ---------- */
.svw-fab {
  position: relative;
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: #18427c;
  color: #f4be16;
  font-size: 24px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(14, 37, 71, 0.35), inset 0 0 0 1px rgba(244, 190, 22, 0.35);
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.4) translateY(18px);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.svw.is-in .svw-fab {
  opacity: 1;
  transform: none;
}
.svw-fab:hover {
  background: #0e2547;
  box-shadow: 0 12px 28px rgba(14, 37, 71, 0.45), inset 0 0 0 1px rgba(244, 190, 22, 0.5);
}
.svw-fab:active {
  transform: scale(0.94);
}
.svw-fab:focus-visible {
  outline: 3px solid #f4be16;
  outline-offset: 3px;
}

/* WhatsApp-style attention pulse */
.svw-pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(244, 190, 22, 0.6);
  animation: svwPulse 2.2s ease-out infinite;
  pointer-events: none;
}
.svw.interacted .svw-pulse {
  animation: none;
  border-color: transparent;
}
@keyframes svwPulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  70% { transform: scale(1.28); opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- Popup bubble ---------- */
.svw-popup {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: 320px;
  max-width: calc(100vw - 44px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(14, 37, 71, 0.2);
  border: 1px solid rgba(24, 66, 124, 0.08);
  padding: 18px 18px 16px;
  font-family: inherit;
  color: #1f2937;
  pointer-events: auto;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s linear 0.32s;
}
.svw.is-open .svw-popup {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* pointer arrow toward the FAB */
.svw-popup::after {
  content: '';
  position: absolute;
  right: 22px;
  bottom: -8px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-right: 1px solid rgba(24, 66, 124, 0.08);
  border-bottom: 1px solid rgba(24, 66, 124, 0.08);
  transform: rotate(45deg);
  border-radius: 0 0 4px 0;
}

.svw-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: #eef2f7;
  color: #18427c;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.svw-close:hover {
  background: #18427c;
  color: #fff;
  transform: rotate(90deg);
}
.svw-close:focus-visible {
  outline: 3px solid #f4be16;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(244, 190, 22, 0.25);
}

.svw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.svw-ico {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 50%;
  background: rgba(24, 66, 124, 0.08);
  color: #18427c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.svw-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #18427c;
  line-height: 1.3;
}

.svw-msg {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #4b5563;
}

.svw-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: #18427c;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(24, 66, 124, 0.25);
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.svw-cta:hover {
  background: #0e2547;
  color: #fff;
  box-shadow: 0 8px 20px rgba(14, 37, 71, 0.35);
}
.svw-cta:active {
  transform: scale(0.98);
}
.svw-cta:focus-visible {
  outline: 3px solid #f4be16;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(244, 190, 22, 0.3), 0 8px 20px rgba(14, 37, 71, 0.35);
}
.svw-cta i {
  font-size: 13px;
}

/* ---------- Mobile: bottom sheet above the FAB ---------- */
@media (max-width: 480px) {
  .svw {
    right: 14px;
    bottom: 14px;
  }
  .svw-fab {
    width: 56px;
    height: 56px;
    font-size: 22px;
  }
  .svw-popup {
    position: fixed;
    right: 12px;
    left: 12px;
    bottom: 82px;
    width: auto;
    max-width: none;
  }
  .svw-popup::after {
    display: none;
  }
}

/* ---------- Respect reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .svw-fab,
  .svw-popup {
    transition: none;
  }
  .svw-pulse {
    animation: none;
  }
}