.cp-popup-open {
  overflow: hidden;
}

.cp-popup-overlay {
  position: fixed;
  inset: 0;
  background: var(--cp-overlay-bg, rgba(0, 0, 0, 0.6));
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 9999;
}

.cp-popup-overlay.is-open {
  display: flex;
}

.cp-popup-container {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  background: #ffffff;
  border-radius: var(--cp-popup-radius, 14px);
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  -webkit-overflow-scrolling: touch;
}

.cp-popup-content {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  padding-top: 52px;
  color: #111;
  line-height: 1.7;
  word-break: break-word;
}

.cp-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #333;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cp-popup-close:hover {
  background: transparent;
}

.cp-popup-content :first-child {
  margin-top: 0;
}

.cp-popup-content :last-child {
  margin-bottom: 0;
}

/* Keep WPForms full-width inside popup only. */
.cp-popup-content .wpforms-container,
.cp-popup-content .wpforms-form {
  width: 100% !important;
  max-width: 100% !important;
}

.cp-popup-content .wpforms-field-container,
.cp-popup-content .wpforms-submit-container {
  width: 100% !important;
}

.cp-popup-content .wpforms-field input,
.cp-popup-content .wpforms-field select,
.cp-popup-content .wpforms-field textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .cp-popup-overlay {
    padding: 12px;
  }

  .cp-popup-container {
    max-width: 100%;
    max-height: 90vh;
    border-radius: var(--cp-popup-radius, 14px);
  }

  .cp-popup-content {
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
  }
}
