/* ==========================================================================
   TVD Popup Maker - Frontend Styles & Animations
   ========================================================================== */

.tvd-popup-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s ease;
  box-sizing: border-box;
}

.tvd-popup-wrapper * {
  box-sizing: border-box;
}

.tvd-popup-wrapper.tvd-popup-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Positions */
.tvd-popup-wrapper.tvd-pos-center {
  justify-content: center;
  align-items: center;
}

.tvd-popup-wrapper.tvd-pos-top_bar {
  justify-content: center;
  align-items: flex-start;
}

.tvd-popup-wrapper.tvd-pos-top_bar .tvd-popup-container {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
}

.tvd-popup-wrapper.tvd-pos-bottom_bar {
  justify-content: center;
  align-items: flex-end;
}

.tvd-popup-wrapper.tvd-pos-bottom_bar .tvd-popup-container {
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 0 !important;
}

.tvd-popup-wrapper.tvd-pos-bottom_left {
  justify-content: flex-start;
  align-items: flex-end;
  padding: 24px;
}

.tvd-popup-wrapper.tvd-pos-bottom_right {
  justify-content: flex-end;
  align-items: flex-end;
  padding: 24px;
}

.tvd-popup-wrapper.tvd-pos-top_right {
  justify-content: flex-end;
  align-items: flex-start;
  padding: 24px;
}

.tvd-popup-wrapper.tvd-pos-top_left {
  justify-content: flex-start;
  align-items: flex-start;
  padding: 24px;
}

/* Overlay / Backdrop */
.tvd-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transition: opacity 0.3s ease;
}

/* Container */
.tvd-popup-container {
  position: relative;
  z-index: 2;
  width: 92%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08);
  background-color: #ffffff;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), max-width 0.25s ease;
  -webkit-overflow-scrolling: touch;
}

/* Rich Block & 3D Carousel Support inside Popup */
.tvd-popup-container.has-carousel-3d {
  max-width: min(94vw, 920px) !important;
  background-color: #080612 !important;
  color: #ffffff !important;
  padding: 20px 10px !important;
}

.tvd-popup-container.has-carousel-3d .tvd-popup-close-btn {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

.tvd-popup-container.has-block-content {
  max-width: min(94vw, 880px);
}

.tvd-popup-content-body {
  position: relative;
  width: 100%;
}

.tvd-popup-content-body img {
  max-width: 100%;
  height: auto;
}

.tvd-popup-content-body .row {
  margin-left: 0;
  margin-right: 0;
}

/* Smooth custom scrollbar for popup content */
.tvd-popup-container::-webkit-scrollbar {
  width: 6px;
}
.tvd-popup-container::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* Close Button */
.tvd-popup-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.08);
  border: none;
  color: #333333;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
  line-height: 1;
}

.tvd-popup-close-btn:hover {
  background: rgba(0, 0, 0, 0.16);
  transform: rotate(90deg) scale(1.05);
}

.tvd-popup-close-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2.2;
}

/* Animations */
.tvd-popup-open .tvd-anim-zoom,
.tvd-popup-open .tvd-anim-zoom_in {
  animation: tvdPopupZoomIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tvd-popup-open .tvd-anim-fade {
  animation: tvdPopupFadeIn 0.3s ease-out forwards;
}

.tvd-popup-open .tvd-anim-slide_up {
  animation: tvdPopupSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tvd-popup-open .tvd-anim-slide_down {
  animation: tvdPopupSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.tvd-popup-open .tvd-anim-bounce {
  animation: tvdPopupBounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

@keyframes tvdPopupZoomIn {
  0% {
    opacity: 0;
    transform: scale(0.85);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tvdPopupFadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tvdPopupSlideUp {
  0% {
    opacity: 0;
    transform: translateY(60px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tvdPopupSlideDown {
  0% {
    opacity: 0;
    transform: translateY(-60px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tvdPopupBounceIn {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  70% {
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Body lock scroll when popup is open */
body.tvd-popup-active {
  overflow: hidden !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .tvd-popup-wrapper.tvd-pos-bottom_left,
  .tvd-popup-wrapper.tvd-pos-bottom_right,
  .tvd-popup-wrapper.tvd-pos-top_right,
  .tvd-popup-wrapper.tvd-pos-top_left {
    padding: 12px;
  }
  
  .tvd-popup-container {
    width: 95% !important;
    max-width: 100% !important;
  }

  /* Hide desktop-only popups on mobile */
  .tvd-popup-wrapper.tvd-device-desktop {
    display: none !important;
  }
}

@media (min-width: 769px) {
  /* Hide mobile-only popups on desktop */
  .tvd-popup-wrapper.tvd-device-mobile {
    display: none !important;
  }
}
