/*
 * Franqueado MotoChefe — Modal Fix
 * Provides fullscreen overlay + background video for modal-8440 (form)
 * and modal-9456 (video) when running offline / in the static clone.
 */

/* When the modal container is forced visible (display: block via lqdLity), make it true fullscreen */
#modal-8440.franqueado-modal-active,
#modal-9456.franqueado-modal-active {
  position: fixed !important;
  inset: 0 !important;
  z-index: 999999 !important;
  background: rgba(15, 15, 15, 0.96);
  overflow-y: auto;
  display: block !important;
  /* lqdLity wraps the modal in a .lqd-lity container with visibility:hidden;opacity:0
     baked into theme-elementor.min.css. Force them visible for our active state. */
  visibility: visible !important;
  opacity: 1 !important;
  animation: franqueado-fade-in 0.35s ease-out;
}

/* lqdLity also leaves the original .lqd-modal child with the .lqd-lity-hide class
   (display:none). Unhide it whenever the outer wrapper is active so the form/video
   content actually renders. */
#modal-8440.franqueado-modal-active .lqd-modal.lqd-lity-hide,
#modal-9456.franqueado-modal-active .lqd-modal.lqd-lity-hide {
  display: block !important;
}

@keyframes franqueado-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#modal-8440.franqueado-modal-active .lqd-modal-inner,
#modal-9456.franqueado-modal-active .lqd-modal-inner {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  padding: 24px 16px;
}

#modal-8440.franqueado-modal-active .lqd-modal-content,
#modal-9456.franqueado-modal-active .lqd-modal-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 760px;
  animation: franqueado-rise-in 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes franqueado-rise-in {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Background video for the form modal */
#modal-8440 .franqueado-modal-bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 1;
  pointer-events: none;
}
#modal-8440 .franqueado-modal-bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.7) 100%);
  z-index: 1;
  pointer-events: none;
}
#modal-8440:not(.franqueado-modal-active) .franqueado-modal-bg-video,
#modal-8440:not(.franqueado-modal-active) .franqueado-modal-bg-overlay,
#modal-9456:not(.franqueado-modal-active) .franqueado-modal-bg-video,
#modal-9456:not(.franqueado-modal-active) .franqueado-modal-bg-overlay {
  display: none;
}

/* Close button */
.franqueado-modal-close {
  position: fixed;
  top: 22px;
  right: 28px;
  z-index: 9999999;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 28px;
  font-weight: 300;
  line-height: 1;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.franqueado-modal-close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.05);
}

/* Lock scroll on body when modal is open */
body.franqueado-modal-open {
  overflow: hidden;
}

/* ============================================================
 * Video modal (#modal-9456) — override for a clean black player
 * ============================================================ */

#modal-9456.franqueado-modal-active {
  background: #000 !important;
  overflow: hidden;
}

#modal-9456.franqueado-modal-active .lqd-modal-inner {
  padding: 0;
  min-height: 100vh;
  overflow: hidden;
}

#modal-9456.franqueado-modal-active .lqd-modal-content {
  max-width: 100vw;
  width: 100vw;
  height: 100vh;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: franqueado-fade-in 0.4s ease-out;
}

/* Strip Elementor structural wrappers so the video can fill freely */
#modal-9456.franqueado-modal-active .elementor,
#modal-9456.franqueado-modal-active .elementor-element,
#modal-9456.franqueado-modal-active .e-con,
#modal-9456.franqueado-modal-active .e-con-inner,
#modal-9456.franqueado-modal-active .elementor-widget-container,
#modal-9456.franqueado-modal-active .elementor-wrapper {
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

#modal-9456.franqueado-modal-active .e-hosted-video {
  width: auto !important;
  height: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#modal-9456.franqueado-modal-active video.elementor-video {
  display: block;
  width: auto;
  height: auto;
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  background: #1a1a1a;
  border-radius: 4px;
  box-shadow: 0 8px 60px rgba(0, 0, 0, 0.8);
}

/* Vertical videos (portrait): Elementor sets --video-aspect-ratio=0.5625 (9:16). */
#modal-9456.franqueado-modal-active .elementor-wrapper video {
  height: 92vh;
  max-height: 92vh;
  width: auto;
}

/* Mobile tweaks */
@media (max-width: 640px) {
  #modal-8440.franqueado-modal-active .lqd-modal-inner,
  #modal-9456.franqueado-modal-active .lqd-modal-inner {
    padding: 16px 8px;
  }
  .franqueado-modal-close {
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 24px;
  }
  #modal-9456.franqueado-modal-active video.elementor-video,
  #modal-9456.franqueado-modal-active .elementor-wrapper video {
    max-width: 100vw;
    max-height: 95vh;
    width: auto;
    height: 95vh;
  }
}
