.docketpay-inline-widget,
.docketpay-inline-widget *,
.docketpay-badge-widget,
.docketpay-badge-widget *,
.docketpay-overlay,
.docketpay-overlay * {
  font-size: 16px;
  line-height: 1.2em;
}

/* Enhanced loading animation with better performance */
.survcart-loading {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  /* Performance optimizations */
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Prevent layout shift */
  contain: layout style paint;
}

.survcart-loading.exit {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale3d(0.98, 0.98, 1);
}

.survcart-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007aff;
  border-radius: 50%;
  animation: survcart-spin 1s linear infinite;
  margin-bottom: 16px;
  /* Performance optimizations */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  /* Prevent layout shift */
  contain: layout style paint;
}

.survcart-loading-text {
  color: #666;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

@keyframes survcart-spin {
  0% {
    transform: rotate3d(0, 0, 1, 0deg);
  }
  100% {
    transform: rotate3d(0, 0, 1, 360deg);
  }
}

/* Legacy spinner styles for backward compatibility */
.docketpay-spinner {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  right: 0;
  bottom: 0;
  text-align: center;
  align-items: center;
  pointer-events: none;
  justify-content: center;
  background: rgb(255, 255, 255);
  opacity: 1;
  transition: transform 0.25s, opacity 0.25s;
}

.docketpay-spinner.exit {
  transform: scale3d(1.2, 1.2, 1);
  opacity: 0;
}

.survcart-trigger-button {
  border-radius: 5px;
  background: rgb(0, 122, 255);
  color: white;
  font-weight: 700;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  border: none;
  box-shadow: none;
  outline: none;
  justify-content: center;
  font-family: 'Inter';
  font-weight: 700;
  animation: trigger-button-entrance 0.25s cubic-bezier(0.34, 1.56, 0.64, 1)
    forwards;
}

.survcart-elem-replaced {
  position: absolute !important;
  animation: replace-animation 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.survcart-trigger-button:hover {
  cursor: pointer;
  background: rgb(0, 100, 230);
}

@keyframes trigger-button-entrance {
  from {
    transform: translate3d(0px, 30px, 0px);
    opacity: 0;
  }

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

@keyframes replace-animation {
  from {
    transform: translate3d(0px, 0px, 0px);
  }

  to {
    opacity: 0;
    transform: translate3d(0px, -30px, 0px);
  }
}

@keyframes close-button-hop {
  from {
    transform: translate3d(0px, 50px, 0px);
    opacity: 0;
  }

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

@-webkit-keyframes docketpay-bouncedelay {
  0%,
  80%,
  100% {
    -webkit-transform: scale(0);
    transform: scale(0);
  }

  40% {
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

@keyframes docketpay-bouncedelay {
  0%,
  80%,
  100% {
    -webkit-transform: scale(0);
    transform: scale(0);
  }

  40% {
    -webkit-transform: scale(1);
    transform: scale(1);
  }
}

/* Optimized iframe styles to prevent layout shift */
.survcart-inline-widget iframe,
.docketpay-badge-widget iframe,
.docketpay-overlay iframe {
  display: inline;
  width: 100%;
  height: 100%;
  border-radius: 0px;
  overflow: hidden;
  /* Performance optimizations */
  will-change: contents;
  contain: layout style paint;
}

/* Optimized popup content for better performance */
.docketpay-popup-content {
  position: relative;
  animation: 0.2s 0.1s overlay-open ease-out forwards;
  box-shadow: 0px 0px 50px rgb(0 0 0 / 70%);
  background: white;
  border-radius: 10px;
  opacity: 0;
  overflow: hidden;
  /* Performance optimizations */
  will-change: opacity, transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Prevent layout shift and improve performance */
  contain: layout style paint;
}

.docketpay-popup-content.docketpay-mobile {
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}

/* Optimized overlay for better performance */
.docketpay-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 2147483647;
  background-color: rgba(10, 10, 10, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  /* Performance optimizations */
  will-change: opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  /* Prevent layout shift */
  contain: layout style paint;
}

/* Hidden overlay for background resource loading */
.docketpay-overlay[data-background-loading='true'] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  /* Lower z-index to ensure it doesn't interfere */
  z-index: -1 !important;
}

.docketpay-overlay.active {
  display: flex !important;
  animation: fadein 0.2s ease-out forwards;
}

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

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

.docketpay-overlay .docketpay-close-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.docketpay-overlay .docketpay-popup.stretched {
  max-height: 900px;
  max-width: 1350px;
}

.docketpay-overlay .docketpay-popup {
  box-sizing: border-box;
  width: 80%;
  max-height: 900px;
  max-width: 1350px;
  height: calc(100% - 100px);
  /* Performance optimizations */
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

@keyframes overlay-open {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0) scale3d(0.95, 0.95, 1);
  }

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

@media (max-width: 800px), (max-height: 600px) {
  .docketpay-overlay .docketpay-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Add safe area support for modern devices */
    top: env(safe-area-inset-top, 0);
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    bottom: env(safe-area-inset-bottom, 0);
    -webkit-transform: none;
    transform: none;
    width: 100%;
    height: 100%;
    max-width: 100%;
    /* Use multiple height fallbacks for better compatibility */
    height: 100vh;
    height: -webkit-fill-available;
    height: stretch;
    min-width: 0;
    max-height: none;
    border-radius: 0px;
  }
}

@media (min-width: 801px) and (min-height: 601px) {
  .docketpay-overlay .docketpay-popup {
    top: 50%;
    left: 50%;
    /* -webkit-transform: translateY(-50%) translateX(-50%); */
    /* transform: translateY(-50%) translateX(-50%); */
  }
}

.docketpay-overlay .docketpay-popup .docketpay-popup-content {
  height: 100%;
}

.docketpay-overlay .docketpay-popup-close {
  color: white;
  background: rgb(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  right: 0px;
  top: -45px;
  width: 100px;
  display: flex;
  height: 36px;
  border-radius: 24px;
  position: absolute;
  margin-bottom: 5px;
  min-width: 0px;
  cursor: pointer;
  font-family: sans-serif;
  font-weight: 600;
  display: none;
  animation: close-button-hop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.docketpay-overlay .docketpay-popup-close:hover {
  background: rgb(40, 40, 40, 0.8);
}

@media (max-width: 800px) {
  .docketpay-overlay .docketpay-popup-close {
    top: 15px;
    right: 15px;
  }
}

/* Enhanced mobile device support */
@media (max-width: 800px) and (hover: none) and (pointer: coarse) {
  .docketpay-overlay {
    /* Reduce hardware acceleration on touch devices to prevent blank rendering */
    will-change: auto;
    -webkit-transform: none;
    transform: none;
    /* Ensure proper rendering on mobile */
    -webkit-backface-visibility: visible;
    backface-visibility: visible;
  }

  .docketpay-popup-content {
    /* Reduce hardware acceleration on mobile to prevent blank screens */
    will-change: auto;
    -webkit-transform: none;
    transform: none;
    -webkit-backface-visibility: visible;
    backface-visibility: visible;
  }

  .docketpay-overlay .docketpay-popup {
    /* Additional mobile positioning fixes */
    position: fixed !important;
    -webkit-transform: none !important;
    transform: none !important;
    /* Ensure full coverage on mobile */
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
  }
}

/* Specific mobile overlay handling */
.docketpay-overlay[data-mobile='true'] {
  /* Force basic rendering on mobile to prevent blank screens */
  -webkit-transform: none !important;
  transform: none !important;
  will-change: auto !important;
  -webkit-backface-visibility: visible !important;
  backface-visibility: visible !important;
  /* Ensure visible on mobile */
  opacity: 1;
  visibility: visible;
}

.docketpay-overlay[data-mobile='true'] .docketpay-popup-content {
  /* Disable animations on problematic mobile devices */
  animation: none !important;
  opacity: 1 !important;
  -webkit-transform: none !important;
  transform: none !important;
}

.docketpay-badge-widget {
  position: fixed;
  right: 20px;
  bottom: 15px;
  z-index: 9998;
}

.docketpay-badge-widget .docketpay-badge-content {
  display: table-cell;
  width: auto;
  height: 45px;
  padding: 0 30px;
  border-radius: 25px;
  box-shadow: rgba(0, 0, 0, 0.25) 0 2px 5px;
  font-family: sans-serif;
  text-align: center;
  vertical-align: middle;
  font-weight: bold;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
}

.docketpay-popup-header {
  height: 36px;
  width: 100%;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
}

.docketpay-badge-widget .docketpay-badge-content.docketpay-white {
  color: #666a73;
}

.docketpay-badge-widget .docketpay-badge-content span {
  display: block;
  font-size: 12px;
}
