/* v1.4.4 */
/* Video Gallery Minimal – Frontend CSS (WP 5.4) */

.vgm-wrap{
  margin:20px 0;
  position:relative;
  z-index:1;
}

/* Filters: responsive wrap, no horizontal scroll */
.vgm-filters{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:flex-end;
  margin-bottom:24px;
  overflow:visible !important;
  position:relative;
  z-index:10;
  background: #f6f6f6;
  padding: 30px;
  border-radius: 10px;
}

.vgm-field{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:0 1 auto;
  min-width:0;

  overflow:visible !important;
  position:relative;
}

.vgm-field label{
  font-size:12px;
}

/* No fixed widths */
.vgm-field select,
.vgm-field input{
  padding:8px 10px;
  width:auto;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  border:0;
  font-family: Raleway, sans-serif;
  font-weight: 600;
}
.vgm-field input{
  min-width: 190px;
  width: 300px;
}

/* Search first, can grow, wraps on small screens */
.vgm-search{
  order: 0;
  flex:1 1 auto;
  /*min-width:220px;*/
}

.vgm-search-wrap{
  position:relative;
  overflow:visible !important;
}

/* Autocomplete dropdown */
.vgm-suggest{
  position:absolute;
  left:0;
  right:0;
  top:calc(100% + 6px);

  background:#fff;
  border:1px solid rgba(0,0,0,0.18);
  border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,0.12);

  max-height:280px;
  overflow:auto;

  z-index:999999 !important;
}

.vgm-suggest button{
  display:block;
  width:100%;
  text-align:left;
  border:0;
  background:transparent;
  padding:10px 12px;
  cursor:pointer;
}

.vgm-suggest button:hover{
  background:rgba(0,0,0,0.05);
}

/* Grid */
.vgm-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:24px;
	align-items: stretch; /* WICHTIG */
}

@media (max-width:1024px){
  .vgm-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); }
}

@media (max-width:640px){
  .vgm-grid{ grid-template-columns:1fr; }
}

.vgm-card{
	border: 0px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    overflow: hidden;
    background: #f6f6f6;
}

.vgm-card-btn{
  width:100%;
  text-align:left;
  padding:0;
  margin:0;
  border:0;
  background:transparent;
  cursor:pointer;
}

.vgm-thumb{
  /*height:160px;*/ aspect-ratio: 16 / 9;
  background-size:cover;
  background-position:center;
  position:relative;
	flex-shrink: 0; /* WICHTIG für Safari */
}
.video-grid-quadrat .vgm-thumb{
  aspect-ratio: 1 / 1;
	/*max-height:400px;*/
}

.vgm-thumb:before{
  content:"";
  position:absolute;
  inset:0;
  background:rgba(0,0,0,0.25);
  transition: all ease 0.5s;
}
.vgm-card:hover .vgm-thumb:before {
    background: rgba(0, 0, 0, 0);
}

.vgm-play{
  position:absolute;
    left: 40px;
    bottom: -20px;
  transform:translate(-50%,-50%);
  width:60px;
  height:60px;
  background:rgba(0,0,0,0.55) url("play_butt.png") no-repeat center;
  background-size:28px 28px;
  border-radius:999px;
  z-index:2;
}

.vgm-thumb--empty{
  display:flex;
  align-items:center;
  justify-content:center;
  background:#f1f1f1;
  font-size:30px;
}

.vgm-meta{ 
	padding:10px 12px 12px; 
	font-family: Raleway, sans-serif; 
	display:flex; 
	flex-direction:column;  
	transition: all ease 0.5s; 
}
.video-auf-grau .vgm-meta{ 
	background: #fff;
}
.vgm-card:hover .vgm-meta {
  background: #fafafa;
}
.vgm-title{
	font-weight: 700;
    margin-bottom: 6px;
    font-size: 20px;
}
.vgm-desc{ font-size:14px; line-height:1.35; }

.vgm-extra{ font-size:14px; line-height:1.35; margin-top:auto; padding-top:8px; }
.vgm-empty{ padding:20px; }

/* Overlay */
.vgm-overlay{
  display:none;
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  background:rgba(0,0,0,0.75);
  z-index:2147483647;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.vgm-overlay[aria-hidden="false"]{ display:flex; }

.vgm-overlay-inner{
  width:min(1200px,100%);
  max-height:100%;
  background:#000;
  border-radius:12px;
  position:relative;
  overflow:hidden;
}

.vgm-player{ padding:0; }
.vgm-player video{
  width:100%;
  height:auto;
  max-height:calc(100vh - 110px);
  display:block;
  background:#000;
}

.vgm-close{
  position:absolute;
  top:-22px;
  right:-22px;
  width:54px;
  height:54px;
  border-radius:999px;
  border:0;
  background:rgba(0,0,0,0.85);
  color:#fff;
  font-size:34px;
  cursor:pointer;
  z-index:2147483647 !important;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}

.vgm-close:after{
  content:"";
  position:absolute;
  inset:-6px;
}

.vgm-overlay .vgm-overlay-inner,
.vgm-overlay .vgm-modal,
.vgm-overlay .vgm-player{
  position: relative;
  overflow: visible;
}


.vgm-overlay .vgm-close{
  position: absolute;
  top: -22px;
  right: -22px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(0,0,0,.85);
  color: #fff;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 34px;
  z-index: 2147483647;
}


.vgm-no-scroll{ overflow: hidden !important; }


.vgm-overlay{
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2147483647;
  background: rgba(0,0,0,.72);
  display: none;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

.vgm-overlay.is-open{
  display: flex;
}

/* Zusatzinfo (vgm-extra) immer am unteren Rand der Kachel */
.vgm-card{
  height: auto;   /* statt 100% */
  display: flex;
}

.vgm-card-btn{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;   /* statt height:100% */
  min-height: 100%;
}


/* Meta-Bereich flexibel, damit extra nach unten kann */
.vgm-meta{
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

/* Beschreibung darf wachsen (unterschiedliche Längen) */
.vgm-desc{
  flex: 1 1 auto;
}

/* Zusatzinfo am unteren Rand */
.vgm-extra{
  margin-top: auto;
  padding-top: 14px; /* optional: Abstand zur Description */
}


/* v1.4.1: Suche in eigene Zeile unter den 4 Filtern (Markup ist verschachtelt) */
.vgm-filters-row--1{
  display:flex;
  flex-wrap:wrap;
  gap: 18px;
}
.vgm-filters-row--1 > .vgm-field{
 /* flex: 1 1 220px;*/
}
.vgm-filters-row--1 > .vgm-field.vgm-search{
  flex: 1 1 100%;
  order: 99;
}
.vgm-filters-row--2{
  width: 100%;
}


/* Safari-only layout fixes */
html.is-safari .vgm-card-btn{
 /* display:block;*/
}

html.is-safari .vgm-thumb{
  background-repeat:no-repeat;
  background-position:center center;
  background-size:cover;

  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

html.is-safari .vgm-play{
    left: 40px;
    bottom: -20px;
  transform: translate3d(-50%,-50%,0);
  -webkit-transform: translate3d(-50%,-50%,0);
}

/* Safari-only: reset flex leftovers on card button */
html.is-safari .vgm-card-btn{
 /* display: block !important;*/

  /* Flex vollständig neutralisieren */
 /* flex: none !important;
  flex-direction: initial !important;*/
  align-items: initial !important;
 /* justify-content: initial !important;*/

  /* Height-Fehler beheben */
 /* height: auto !important;*/
}

html.is-safari .vgm-card{
  height: 100%;
}

html.is-safari .vgm-card > .vgm-card-btn{
  height: auto;
}
html.is-safari .video-grid-quadrat .vgm-thumb{
  /*height: 400px;*/
}

html.is-safari .video-grid-quadrat .vgm-card,
html.is-safari .video-grid-quadrat .vgm-card-btn{
  height: auto !important;
}


