/* Overlay */
.av-pop__overlay {
  position: fixed;
  inset: 0;
  background: var(--avpop-overlay_bg, rgba(0, 0, 0, 0.6));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
  z-index: 9998;
}
.av-pop__overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* Popup base */

.av-pop {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(90vw, var(--avpop-max_width_px, 560px));
  background: var(--avpop-popup_bg, #fff);
  color: var(--avpop-text_color, #111);
  border-radius: var(--avpop-border_radius_px, 16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 20px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  display: flex;
  flex-direction: var(--avpop-img_position);
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  padding: var(--avpop-box_spacing_px);
  overflow: hidden;
}
.av-pop__content-wrap {
  min-width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
#av-pop-title h1:first-child,
#av-pop-title h2:first-child,
#av-pop-title h3:first-child,
#av-pop-title h4:first-child,
#av-pop-title h5:first-child,
#av-pop-title h6:first-child,
#av-pop-body h1:first-child,
#av-pop-body h2:first-child,
#av-pop-body h3:first-child,
#av-pop-body h4:first-child,
#av-pop-body h5:first-child,
#av-pop-body h6:first-child {
  margin-top: 0;
}
.av-pop.is-visible {
  opacity: 1;
  visibility: visible;
}

#av-pop .av-pop__close {
  position: absolute;
  top: 2px;
  right: 6px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.av-pop__media {
  text-align: center;
  min-width: var(--avpop-img_width_percent, 30%);
  min-height: var(--avpop-img_height_px, 160px);
  background-position: center center;
  background-size: cover;
  flex-grow: 1;
  border-radius: var(--avpop-img_radius_px);
}

.av-pop__content {
	font-size: 16px;
	line-height: 1.5;
	display: flex;
	flex-grow: 1;
	flex-direction: column;
	justify-content: center;
}
.av-pop__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.av-pop__title:empty,
.av-pop__body:empty {
  display: none;
}
.av-pop__actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: var(--avpop-button_position, center);
}
.av-pop__btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border-radius: var(--avpop-button_radius_px);
}

/* Animaciones */
.av-pop.anim-none {
  transition: none;
}
.av-pop.anim-fade {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.av-pop.anim-from-top {
  transform: translate(-50%, calc(-60%));
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.av-pop.anim-from-top.is-visible {
  transform: translate(-50%, -50%);
}
.av-pop.anim-from-right {
  transform: translate(calc(-40%), -50%);
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.av-pop.anim-from-right.is-visible {
  transform: translate(-50%, -50%);
}
.av-pop.anim-from-bottom {
  transform: translate(-50%, calc(-40%));
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.av-pop.anim-from-bottom.is-visible {
  transform: translate(-50%, -50%);
}
.av-pop.anim-from-left {
  transform: translate(calc(-60%), -50%);
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.av-pop.anim-from-left.is-visible {
  transform: translate(-50%, -50%);
}

/* Estado inicial oculto */
.av-pop,
.av-pop__overlay {
  pointer-events: none;
}
.av-pop.is-visible,
.av-pop__overlay.is-visible {
  pointer-events: auto;
}
