/* ======================================================
   SV Popup Manager – Frontend Styles
   ====================================================== */

.svpm-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  overflow-y: auto;
  padding: 48px 40px 40px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.svpm-overlay.svpm-open {
  opacity: 1;
  visibility: visible;
}

.svpm-overlay.svpm-hidden,
.svpm-overlay.svpm-closing {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.svpm-popup {
  position: relative;
  width: 100%;
  margin-top: 56px;
  box-sizing: border-box;
  overflow: visible;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
  transform: translateY(12px) scale(0.97);
  opacity: 0;
  transition: transform 240ms cubic-bezier(.2,.8,.2,1), opacity 240ms ease;
}

.svpm-popup-inner {
  position: relative;
  max-height: 85vh;
  padding: 26px;
  box-sizing: border-box;
  overflow: auto;
  border-radius: inherit;
  background: inherit;
  box-shadow: inherit;
}

.svpm-overlay.svpm-open .svpm-popup {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.svpm-overlay.svpm-closing .svpm-popup {
  transform: translateY(10px) scale(0.98);
  opacity: 0;
}

.svpm-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.svpm-content.svpm-btn-v-top .svpm-action {
  order: -1;
}

.svpm-content.svpm-btn-v-middle .svpm-action {
  order: 5;
}

.svpm-content.svpm-btn-v-bottom .svpm-action {
  order: 10;
}

.svpm-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
}

.svpm-action {
  margin-top: 2px;
}

.svpm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 13px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  line-height: 1.1;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.svpm-button:hover {
  transform: translateY(-2px);
  filter: brightness(0.98);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
}

.svpm-button:active {
  transform: translateY(0);
  opacity: 0.92;
}

.svpm-button:focus-visible {
  outline: 3px solid rgba(0, 0, 0, 0.18);
  outline-offset: 3px;
}

.svpm-close {
  position: absolute;
  top: -52px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  z-index: 4;
  transition: transform 150ms ease, filter 150ms ease, opacity 150ms ease;
}

.svpm-close:hover {
  transform: scale(1.05);
  filter: brightness(1.08);
}

.svpm-close:active {
  transform: scale(1);
  opacity: 0.9;
}

.svpm-close:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.7);
  outline-offset: 3px;
}

/* Visual themes */
.svpm-theme-minimal {
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.svpm-theme-minimal .svpm-popup-inner {
  padding: 22px;
}

.svpm-theme-minimal .svpm-button {
  border-radius: 10px;
  box-shadow: none;
}

.svpm-theme-premium {
  border-radius: 22px;
  box-shadow: 0 32px 110px rgba(0, 0, 0, 0.42);
}

.svpm-theme-premium .svpm-popup-inner {
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.svpm-theme-premium .svpm-image img {
  border-radius: 18px;
}

.svpm-theme-dark .svpm-popup-inner {
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.48);
}

.svpm-theme-dark .svpm-button {
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.32);
}

.svpm-theme-promo {
  border-radius: 20px;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.36);
}

.svpm-theme-promo .svpm-popup-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, var(--svpm-cta-bg, #000), rgba(255,255,255,.85), var(--svpm-cta-bg, #000));
  pointer-events: none;
}

.svpm-theme-promo .svpm-button {
  min-height: 48px;
  padding-inline: 26px;
  text-transform: uppercase;
  font-size: 14px;
}

@media (max-width: 480px) {
  .svpm-overlay {
    padding: 36px 18px 18px;
  }

  .svpm-popup {
    margin-top: 48px;
    border-radius: 14px;
    max-width: calc(100vw - 36px) !important;
  }

  .svpm-popup-inner {
    padding: 18px;
  }

  .svpm-content {
    gap: 14px;
  }

  .svpm-close {
    top: -44px;
    right: 0;
    width: 36px;
    height: 36px;
  }

  .svpm-button {
    width: 100%;
    padding: 13px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .svpm-overlay,
  .svpm-popup,
  .svpm-button,
  .svpm-close {
    transition: none !important;
  }

  .svpm-popup {
    transform: none !important;
  }
}
