:root {
  --mt-popup-overlay: rgba(15, 18, 25, 0.68);
  --mt-popup-shadow: 0 30px 80px rgba(0,0,0,0.28);
  --mt-popup-radius: 28px;
}

html.mt-popup-open,
body.mt-popup-open {
  overflow: hidden !important;
}

.mt-popup-shell {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
  padding: clamp(14px, 2vw, 24px);
}

.mt-popup-shell.is-active {
  opacity: 1;
  visibility: visible;
}

.mt-popup-overlay {
  position: absolute;
  inset: 0;
  background: var(--mt-popup-overlay);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.mt-popup-dialog {
  position: relative;
  z-index: 2;
  width: min(var(--mt-popup-width, 1180px), calc(100vw - 28px));
  max-height: var(--mt-popup-maxh, 88vh);
  transform: translateY(18px) scale(.985);
  opacity: 0;
  transition: transform .24s ease, opacity .24s ease;
}

.mt-popup-shell.is-active .mt-popup-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.mt-popup-panel {
  position: relative;
  border-radius: var(--mt-popup-radius);
  overflow: hidden;
  box-shadow: var(--mt-popup-shadow);
  background: #fff;
}

.mt-theme-dark .mt-popup-panel {
  background: #12151a;
  color: #fff;
}

.mt-popup-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  border: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
  background: rgba(255,255,255,.92);
  color: #222;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}

.mt-theme-dark .mt-popup-close {
  background: rgba(20,20,20,.84);
  color: #fff;
}

.mt-popup-close:hover {
  transform: scale(1.03);
}

.mt-popup-content {
  position: relative;
}

.mt-popup-scroll {
  overflow: auto;
  max-height: var(--mt-popup-maxh, 88vh);
}

.mt-popup-scroll > *:first-child {
  margin-top: 0 !important;
}

.mt-popup-scroll > *:last-child {
  margin-bottom: 0 !important;
}

.mt-popup-empty {
  padding: 48px;
}

.mt-popup-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Friendly default spacing if popup content is plain editor, not Elementor */
.mt-popup-scroll .entry-content,
.mt-popup-scroll .wp-block-group,
.mt-popup-scroll .elementor {
  margin: 0;
}

/* Editor template */
body.mt-popup-editor-template {
  margin: 0;
  background: #f6f7fb;
}

.mt-popup-editor-main {
  min-height: 100vh;
}

.mt-popup-editor-article {
  min-height: 100vh;
}

@media (max-width: 767px) {
  .mt-popup-shell {
    padding: 10px;
  }

  .mt-popup-dialog {
    width: calc(100vw - 20px);
    max-height: 92vh;
  }

  .mt-popup-panel {
    border-radius: 20px;
  }

  .mt-popup-close {
    width: 38px;
    height: 38px;
    top: 10px;
    right: 10px;
    font-size: 28px;
  }

  .mt-popup-scroll {
    max-height: 92vh;
  }
}
