/**
 * Divi Module Height Matcher
 * Author: DerErsteSeelord
 * Version: 2.2.1
 * Date: 2025-03-25 18:27:06
 * 
 * Final cross-browser compatibility CSS
 * Focused on image and video module consistency
 */

/* Main row containing the modules */
.pa-match-height-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  width: 100%;
}

/* 
 * Text column - THE SOURCE OF TRUTH
 * We don't apply any height or sizing CSS to this.
 * We only add a class for identification purposes.
 */
.pa-text-source-column {
  /* Intentionally empty - we don't modify the text column */
}

/* Target column - THIS IS WHAT GETS ADJUSTED */
.pa-match-height-target {
  display: flex;
  align-items: stretch; /* Changed from center to stretch */
  overflow: hidden !important;
}

/* IMAGE MODULE - Critical fixes */
.pa-match-height-target .et_pb_image {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

/* Direct targeting of images */
.pa-match-height-target .et_pb_image img,
.pa-matched-image-element {
  max-height: 100% !important;
  height: 100% !important;
  width: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  margin: 0 auto !important;
  display: block !important;
}

/* VIDEO MODULE - Critical fixes */
.pa-match-height-target .et_pb_video {
  width: 100% !important;
  overflow: hidden !important;
}

.pa-match-height-target .et_pb_video_box {
  width: 100% !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  overflow: hidden !important;
}

/* Direct targeting of video elements */
.pa-match-height-target .et_pb_video_box iframe,
.pa-match-height-target .et_pb_video_box video,
.pa-matched-video-element {
  height: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 auto !important;
  display: block !important;
  object-fit: contain !important;
}

/* Chrome and Edge specific fixes */
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm) {
  .pa-match-height-target .et_pb_video,
  .pa-match-height-target .et_pb_video_box,
  .pa-match-height-target .et_pb_image {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }
  
  .pa-match-height-target .et_pb_video_box iframe,
  .pa-match-height-target .et_pb_video_box video,
  .pa-match-height-target .et_pb_image img {
    width: auto !important;
    max-width: 100% !important;
  }
}

/* Firefox specific fixes */
@-moz-document url-prefix() {
  .pa-match-height-target {
    overflow: hidden !important;
  }
  
  .pa-match-height-target .et_pb_video,
  .pa-match-height-target .et_pb_video_box,
  .pa-match-height-target .et_pb_image {
    overflow: hidden !important;
  }
}

/* CODE MODULE */
.pa-match-height-target .et_pb_code {
  width: 100% !important;
  display: block !important;
  overflow: hidden !important;
}

.pa-match-height-target .et_pb_code .et_pb_code_inner {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
}

/* CRITICAL - Ensure iframe fills the space */
.pa-match-height-target .et_pb_code iframe,
.pa-matched-iframe-element {
  width: 100% !important;
  min-width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 100% !important;
  display: block !important;
  border: 0 !important;
}

/* Maintain aspect ratios on mobile */
@media only screen and (max-width: 980px) {
  .pa-match-height-row {
    flex-direction: column;
  }
  
  /* Reset heights */
  .pa-match-height-target {
    height: auto;
  }
  
  /* Video on mobile */
  .pa-match-height-target .et_pb_video_box {
    position: relative;
    padding-bottom: 56.25%; /* Default to 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
  }
  
  .pa-match-height-target .et_pb_video_box iframe,
  .pa-match-height-target .et_pb_video_box video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
  }
  
  /* Maps on mobile */
  .pa-match-height-target .et_pb_code iframe {
    height: 350px !important;
    min-height: 300px !important;
    width: 100% !important;
  }
  
  /* Images on mobile */
  .pa-match-height-target .et_pb_image img {
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}