/* Center popup */
.h5p-popup-dialog {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

/* Fix popup container */
.h5p-popup-dialog .h5p-inner {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  transform: none !important;

  height: auto !important;
  max-height: calc(100vh - 4em) !important;
  overflow: auto !important;
}

/* Header layout (force clean LTR layout only here) */
.h5p-popup-dialog .h5p-inner > h2 {
  display: flex !important;
  align-items: center;

  direction: ltr !important; /* 🔥 key fix */

  position: relative !important;
  padding: 1em 3em 1em 1em !important; /* space for X */
  margin-bottom: 0.5em !important;

  gap: 8px;
  justify-content: flex-start;

  font-weight: bold;
}

/* "More Info" link */
.h5p-popup-dialog .h5p-inner > h2 a {
  margin-left: 6px; /* spacing from title */
  /*font-size: 0.75em; */ 
  opacity: 0.8;
  white-space: nowrap;
}

/* Close button — top RIGHT */
.h5p-popup-dialog .h5p-close {
  position: absolute !important;
  top: 10px;
  right: 10px;
  left: auto !important;
  z-index: 30;
}

/* Content spacing */
.h5p-popup-dialog .h5p-scroll-content {
  /* margin-top: 1em !important;*/ 
    border-top: 0em solid !important;
    margin-top: 0px;
    padding-top: 0px;
    border-top: 0px;
}

.h5p-content .h5p-popup-dialog .h5p-inner .h5p-scroll-content {
  border-top: none !important;
} 

/* TEAMWORK CORRECTION */ 
/* Interactive Book cover image spacing inside H5P iframe */
.h5p-interactive-book .h5p-theme-cover-page.h5p-theme-cover-page-with-image {
  margin-left: 50px;
}

