.gcl-popup-button {
  position: relative;
}

.gcl-popup-button__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    transform 0.25s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.gcl-popup-button__trigger:hover,
.gcl-popup-button__trigger:focus-visible {
  background-color: var(--gcl-button-hover-bg, #2f2f2f);
  color: var(--gcl-button-hover-text, #ffffff);
  transform: translateY(-1px);
}

.gcl-popup-button__overlay {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  z-index: 2147483647;
  box-sizing: border-box;
  overscroll-behavior: contain;
}

.gcl-popup-button__overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.gcl-popup-button__modal {
  position: relative;
  background: #fff;
  border-radius: var(--gcl-popup-radius, 24px);
  width: min(92vw, 720px);
  max-width: calc(100vw - 32px);
  min-width: 0;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  box-sizing: border-box;
}

.gcl-popup-button__overlay.is-open .gcl-popup-button__modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.gcl-popup-button__content {
  position: relative;
  padding: calc(var(--gcl-popup-padding-y, 28px) + 44px) var(--gcl-popup-padding-x, 28px) var(--gcl-popup-padding-y, 28px);
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.gcl-popup-button__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: #111;
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;
  z-index: 2;
}

.gcl-popup-button__close:hover,
.gcl-popup-button__close:focus-visible {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(1.05);
}

.gcl-popup-lock {
  overflow: hidden !important;
}

/* Mobile / tablet */
@media (max-width: 767px) {
  .gcl-popup-button__overlay {
    padding: 12px;
    align-items: center;
  }

  .gcl-popup-button__modal {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 24px);
    border-radius: 18px;
  }

  .gcl-popup-button__content {
    padding: 56px 16px 16px;
  }

  .gcl-popup-button__close {
    top: 12px;
    right: 12px;
  }
}

/* Editor preview helpers */
.editor-styles-wrapper .gcl-popup-button__overlay {
  position: relative;
  inset: auto;
  min-height: 420px;
  margin-top: 18px;
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 18px;
}

.editor-styles-wrapper .gcl-popup-button__modal {
  max-width: 100%;
  max-height: none;
  opacity: 1;
  transform: none;
}

.editor-styles-wrapper .gcl-popup-button__content {
  min-height: 120px;
}

.editor-styles-wrapper .gcl-popup-button__overlay:not(.is-open) {
  display: none;
}