.feedback-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2147483000;
  width: auto;
  height: auto;
}

.feedback-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: "Avenir", "Open Sans", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
    background-color 0.2s;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.feedback-button .icon {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease-in-out;
}

.feedback-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .feedback-button {
  background-color: var(--pst-color-primary, #4a6ce8);
  color: #fff;
  border-color: var(--pst-color-secondary, #2950e3);
}

html[data-theme="light"] .feedback-button .icon {
  filter: brightness(0) invert(1);
}

html[data-theme="light"] .feedback-button:hover {
  background-color: var(--pst-color-secondary, #2950e3);
}

html[data-theme="dark"] .feedback-button {
  background-color: var(--pst-color-secondary-highlight, #1839a0);
  color: var(--pst-color-text-base, #ced6dd);
  border-color: var(--pst-color-primary, #4a6ce8);
}

html[data-theme="dark"] .feedback-button:hover {
  background-color: #2950e3;
  color: #fff;
}

.feedback-panel {
  position: absolute !important;
  bottom: 50px !important;
  left: -185px !important;
  width: 320px !important;
  min-height: 150px !important;
  max-height: 80vh !important;
  padding: 12px !important;
  background: white !important;
  border-radius: 8px !important;
  border: 1px solid var(--pst-color-border, #e5eeff) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
  overflow: hidden !important;
  opacity: 0 !important;
  transform: translateY(8px) scale(0.98) !important;
  transition: opacity 160ms ease, transform 160ms ease,
    visibility 0s linear 160ms !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.feedback-panel.is-open {
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
  pointer-events: auto !important;
  visibility: visible !important;
  transition: opacity 160ms ease, transform 160ms ease !important;
}

.survey-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background-color 0.2s ease;
}

.survey-close-button:hover {
  background: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .survey-close-button {
  color: #666;
}

html[data-theme="light"] .survey-close-button:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
}

html[data-theme="dark"] .survey-close-button {
  color: #ccc;
}

html[data-theme="dark"] .survey-close-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

html[data-theme="dark"] .feedback-panel {
  background: white !important;
  border-color: var(--pst-color-border, #374151);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.feedback-panel iframe {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  border: none;
  border-radius: 4px;
}

#refiner-widget-frame {
  color-scheme: light;
}

@media (max-width: 768px) {
  .feedback-container:not(.mobile-header-position) {
    bottom: 15px;
    right: 15px;
  }

  .mobile-header-position {
    position: static !important;
    bottom: auto !important;
    right: auto !important;
    display: inline-block !important;
    margin: 0 12px 0 0 !important;
  }

  .mobile-header-position .feedback-button {
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--bs-navbar-color, rgba(0, 0, 0, 0.65)) !important;
    border-radius: 0 !important;
    gap: 0 !important;
  }

  .mobile-header-position .feedback-button .icon {
    width: 1.5rem !important;
    height: 1.5rem !important;
    margin: 0 !important;
  }

  .mobile-header-position .feedback-text {
    display: none !important;
  }

  .mobile-header-position .feedback-button:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--bs-navbar-hover-color, rgba(0, 0, 0, 0.8)) !important;
  }

  html[data-theme="light"] .mobile-header-position .feedback-button {
    background: transparent !important;
    color: var(--bs-navbar-color, rgba(0, 0, 0, 0.65)) !important;
    border: none !important;
  }

  html[data-theme="light"] .mobile-header-position .feedback-button .icon {
    filter: none !important;
  }

  html[data-theme="light"] .mobile-header-position .feedback-button:hover {
    background-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--bs-navbar-hover-color, rgba(0, 0, 0, 0.8)) !important;
  }

  html[data-theme="dark"] .mobile-header-position .feedback-button {
    background: transparent !important;
    color: var(--bs-navbar-color, #fff) !important;
    border: none !important;
  }

  html[data-theme="dark"] .mobile-header-position .feedback-button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
  }

  .mobile-header-position .feedback-panel {
    position: fixed !important;
    top: 60px !important;
    left: 50% !important;
    bottom: auto !important;
    transform: translateX(-50%) translateY(8px) scale(0.98) !important;
    width: min(90vw, 380px) !important;
    max-height: 70vh !important;
  }

  .mobile-header-position .feedback-panel.is-open {
    transform: translateX(-50%) translateY(0) scale(1) !important;
  }

  .survey-close-button {
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
  }
}

@media (max-width: 480px) {
  .mobile-header-position .feedback-panel {
    width: min(95vw, 320px) !important;
    top: 55px !important;
  }
}
