

/* =========================
   LIGHTBOX (CLEAN)
   ========================= */
.lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;

  --lbThumbH: 80px;
  --lbPad: 18px;
  --lbGap: 10px;
  --lbCapH: 34px;
}
.lightbox.open{ display:flex; }

.lb-inner{
  width: 100%;
  height: 100%;
  max-width: 96vw;
  max-height: 96vh;
  position: relative;
}

/* STAGE (großes Bild) */
#lbStage{
  position: relative; /* wichtig für Spinner */
  width: 95vw;
  height: 92vh;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Platz für Caption + Thumbs */
  padding-bottom: calc(var(--lbPad) + var(--lbThumbH) + var(--lbGap) + var(--lbCapH) + 10px);
  box-sizing: border-box;

  z-index: 10;
}

/* Bild */
#lbImg{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display:block;
}

/* Skeleton NUR im Stage */
#lbStage.img-skeleton{
  background: rgba(0,0,0,.35);
  transition: background .2s ease;
}
#lbStage.img-skeleton #lbImg{
  opacity: 0;
  transition: opacity .18s ease;
}
#lbStage.img-skeleton.is-loaded #lbImg{ opacity: 1; }
#lbStage.img-skeleton.is-loaded{ background: none; }

/* Spinner */
.lb-spinner{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  z-index: 12;
  pointer-events:none;
}
.lb-spinner.is-on{ display:flex; }
.lb-spinner::before{
  content:"";
  width:48px;height:48px;border-radius:50%;
  border:4px solid rgba(255,255,255,.35);
  border-top-color: rgba(255,255,255,.95);
  animation: lbspin .9s linear infinite;
}
@keyframes lbspin{ to{ transform: rotate(360deg); } }

/* Navigation + Close (oben/mitte) */
.lb-prev, .lb-next, .lb-close{
  position: absolute;
  z-index: 30;
  border: 0;
  background: rgba(0,0,0,.65);
  color:#fff;
  opacity: 1;
  cursor: pointer;
  transition: background .2s ease;
}
.lb-prev:hover, .lb-next:hover, .lb-close:hover{ background: rgba(0,0,0,.85); }

.lb-prev, .lb-next{
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-size: 22px;
}
.lb-prev{ left: 12px; }
.lb-next{ right: 12px; }

.lb-close{
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-size: 18px;
}

/* Caption (Counter + Title) über den Thumbs */
.lb-caption{
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--lbPad) + var(--lbThumbH) + var(--lbGap));
  z-index: 40;

  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;

  background: rgba(0,0,0,0.35);
  color: #fff;
  border-radius: 999px;
  line-height: 1.2;

  pointer-events: none; /* darf nicht Thumbs blocken */
}

/* Thumb-Leiste unten */
#lbThumbs.lb-thumbs{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 80px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background: rgba(0,0,0,0.35);
  border-radius: 10px;
  padding: 8px 10px;
  z-index: 50;
}
          
.lb-bar{
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;                 /* wird gleich überschrieben */
  bottom: calc(12px + 80px + 10px); /* 12px pad + thumbs 80 + gap 10 */
  z-index: 60;

  background: rgba(0,0,0,.45);
  border-radius: 10px;
  padding: 10px 12px;

  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}

/* Thumbs selbst */
#lbThumbs .lb-thumb{
  flex: 0 0 auto;
  height: 100%;
  width: 120px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.08);
  cursor: pointer;
  pointer-events: auto;
}
#lbThumbs .lb-thumb img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
  pointer-events: none; /* Klick soll auf Button gehen */
}
#lbThumbs .lb-thumb.is-active{
  border-color: rgba(255,255,255,0.95);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.35) inset;
}

/* Desktop Thumb-Navi (optional) */
.lb-thumb-nav{
  position: absolute;
  bottom: var(--lbPad);
  width: 44px;
  height: var(--lbThumbH);
  border: 0;
  color: #fff;
  background: rgba(0,0,0,0.45);
  cursor: pointer;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.lb-thumb-prev{ left: 10px; border-radius: 12px; }
.lb-thumb-next{ right: 10px; border-radius: 12px; }

@media (hover:hover) and (pointer:fine){
  .lb-thumb-nav{ display:flex; }
  #lbThumbs.lb-thumbs{ margin: 0 54px; }
}

@media (max-width: 768px){
  #lbStage{ padding-bottom: 140px; }
  #lbThumbs.lb-thumbs{ height: 72px; }
  #lbThumbs .lb-thumb{ width: 108px; }
}
          
          #lbClose2{
  background: rgba(0,0,0,.65);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 6px; 
  font-size: 14px;
  cursor: pointer;
  transition: background .2s ease;
}

#lbClose2:hover{
  background: #464646;
}