/* --- Gallery Grid Responsive --- */
.m-video-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1132px;
  margin: 0 auto;
  justify-content: start;
}

/* --- Video Tile --- */
.m-video-tile {
  width: 100%;
  max-width: 356px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* --- Preview Container --- */
.m-preview-container {
  position: relative;
  width: 100%;
  height: 170px;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  overflow: hidden;
}

.m-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 0;
}

/* --- Play Button in Gallery --- */
.m-preview-container .a-button--primary {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

/* --- Meta and Title --- */
.a-meta {
  font-size: 0.9rem;
  color: #666;
  margin: 12px 0 0 0px;
}

.a-title {
  font-weight: bold;
  font-size: 1.25rem;
  margin: 8px 0px 16px 0px;
}

.a-description {
  font-weight: normal;
  font-size: 0.9rem;
  margin: 0px 0px 16px 0px;
}

/* --- Modal --- */
#videoModal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  align-items: center;
  justify-content: center;
}

#videoModal.active {
  display: flex;
}

.m-modal-content {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  max-width: min(90vw, 1132px);
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow: hidden;
  border: none;
}

.m-modal-header {
  width: 100%;
  height: 36px;
  background: #fff;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.a-close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: #333;
  cursor: pointer;
  z-index: 3;
  border-radius: 0;
  margin-right: 16px;
  margin-top: 0;
}

.m-modal-media-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.a-modal-img,
.a-modal-iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none;
  border-radius: 0;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  position: absolute;
  top: 0;
  left: 0;
}

#modalPlayBtn.a-button--primary {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%);
  z-index: 3;
}

#modalPlayBtn.a-button--primary .a-icon {
  font-size: 1.2em;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

/* Privacy Overlay as Centered Box */
.m-privacy-box {
  position: absolute;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 32px 32px 24px 32px;
  border-radius: 0;
  text-align: center;
  margin: 0;
  box-sizing: border-box;
  z-index: 4;
  min-width: 320px;
  max-width: 540px;
  width: 80%;
  display: flex;
  justify-content: center;
}

.m-privacy-inner {
  width: 100%;
}

.m-privacy-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.m-privacy-header strong {
  font-size: 1.2rem;
  display: inline-block;
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.a-privacy-text {
  font-size: 1rem;
  margin-bottom: 8px;
}

.m-privacy-box a {
  color: #4fc3f7;
  text-decoration: underline;
  display: block;
  margin-top: 10px;
}

/* Responsive Anpassungen */
@media (max-width: 900px) {
  .m-video-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .m-modal-content {
    max-width: 100vw;
    width: 100vw;
    height: 50vh;
  }

  .m-modal-media-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .m-privacy-box {
    margin-top: auto;
    width: 100%;
    max-width: 100vw;
    padding: 16px 12px;
    border-radius: 0;
    bottom: 0;
    left: 0;
    transform: none;
  }

  .m-privacy-inner {
    margin-top: auto;
  }

  .a-privacy-text > p {
    font-size: 14px !important;
    line-height: 1.5;
  }

  .m-preview-container {
    position: relative;
  }

  .m-preview-container img {
    display: block;
    width: 100%;
    height: auto;
  }

  .m-preview-container .a-button {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    padding: 8px;
  }

  .m-video-tile h3,
  .m-video-tile .a-meta,
  .m-video-tile .a-description {
    margin-top: 8px;
    padding: 0 12px;
  }

  .m-modal-header {
    height: 24px;
  }
}

@media (min-width: 901px) {
  .a-privacy-text > p {
    font-size: 14px;
    line-height: 1.6;
  }
}

@media (min-width: 900px) and (max-height: 950px) {
  #modalPlayBtn.a-button--primary {
    top: 33%;
  }
}

@media (max-width: 700px) {
  .m-modal-content {
    height: 50vh;
  }

  .m-modal-media-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  .m-privacy-box {
    margin-top: auto;
    padding: 12px 8px;
    width: 100%;
  }

  .a-privacy-text > p {
    font-size: 12px !important;
    line-height: 1.4;
  }

  .m-privacy-inner {
    margin-top: auto;
  }

  .m-preview-container {
    position: relative;
  }

  .m-preview-container img {
    display: block;
    width: 100%;
    height: auto;
  }

  .m-preview-container .a-button {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 2;
    padding: 8px;
  }

  .m-video-tile h3,
  .m-video-tile .a-meta,
  .m-video-tile .a-description {
    margin-top: 8px;
    padding: 0 8px;
  }

  .m-modal-content {
    max-width: 100vw;
    width: 100vw;
  }

  .m-modal-header {
    height: 24px;
  }

  .m-privacy-box {
    left: 0;
    transform: none;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: 0;
    padding: 16px 8px;
  }
}

@media (max-width: 600px) {
  .m-video-gallery {
    grid-template-columns: 1fr;
  }
  .m-video-gallery {
    display: flex;
    flex-direction: column;
    align-items: center; /* horizontally center children */
  }

  .m-video-tile {
    margin: 0 auto;
  }
}

@media (max-width: 400px), (max-height: 700px) {
  #modalPlayBtn.a-button--primary {
    top: 28%;
  }
}
