/* =========================================
   GALERIE PAGE
   ========================================= */

.galerie-hero {
  padding: 50px 20px;
  text-align: center;
  background: radial-gradient(circle at 50% -20%, rgba(48,159,106,0.15) 0%, transparent 60%), #0a0a0f;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.galerie-hero h2 {
  color: #fff;
  font-size: 2.5rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 900;
  text-shadow: 0 0 20px rgba(48,159,106,0.4);
}
.galerie-hero p {
  color:#aaa;
  font-size:1.1rem;
  margin-top:10px;
  letter-spacing:1px;
}

.galerie-wrap {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
  min-height: 50vh;
}

.galerie-msg {
  margin-bottom: 20px;
}
.galerie-msg-delete {
  background: rgba(227,41,46,0.1);
  border-color: var(--dart-red);
}

.galerie-top-actions {
  text-align: right;
  margin-bottom: 20px;
}
.galerie-add-btn {
  padding: 10px 25px;
  background: rgba(48,159,106,0.1);
  color: var(--dart-green);
  border-color: var(--dart-green);
}

/* --- PREMIUM GALERIE KARTEN --- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 10px;
  align-items: start;
}
.gallery-card {
  background: linear-gradient(145deg, rgba(20,20,25,0.8), rgba(15,15,20,0.9));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
  position: relative;
}
.gallery-card:hover {
  transform: translateY(-5px);
  border-color: rgba(48,159,106,0.3);
  box-shadow: 0 15px 40px rgba(0,0,0,0.7);
}
.gallery-info {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.gallery-title {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  margin: 0 0 10px 0;
  letter-spacing: .5px;
}
.gallery-caption {
  font-size: .95rem;
  color: #aaa;
  line-height: 1.5;
  margin: 0;
}

/* --- BILDER RASTER --- */
.post-images-grid {
  display: grid;
  gap: 2px;
  background: #000;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.post-images-grid[data-count="1"] { grid-template-columns: 1fr; }
.post-images-grid[data-count="2"],
.post-images-grid[data-count="4"],
.post-images-grid[data-count="more"] { grid-template-columns: 1fr 1fr; }
.post-images-grid[data-count="3"] { grid-template-columns: 1fr 1fr; }
.post-images-grid[data-count="3"] .img-wrap:first-child {
  grid-column: span 2;
  aspect-ratio: 21/9;
}

.img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
}
.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease, filter .3s ease;
}
.img-wrap:hover img {
  transform: scale(1.08);
  filter: brightness(1.1);
}

.more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  font-weight: bold;
  transition: background .3s;
}
.img-wrap:hover .more-overlay { background: rgba(0,0,0,0.4); }

/* --- ADMIN BUTTONS IN KARTE --- */
.admin-actions {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 10;
  opacity: 0;
  transition: opacity .3s;
}
.gallery-card:hover .admin-actions { opacity: 1; }

.admin-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  opacity: .7;
  transition: opacity .2s, transform .2s;
  padding: 0 4px;
}
.admin-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}
.admin-btn.del:hover { color: var(--dart-red); }

.inline-form { margin: 0; }

/* --- MODALS --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(5px);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 10px;
}
.modal-box {
  background: #111;
  border: 1px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--dart-green);
  border-radius: 12px;
  padding: 25px;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
}
.modal-box h3 {
  color: #fff;
  margin-top: 0;
  font-size: 1.5rem;
}
.modal-box label {
  font-size: .85rem;
  margin-top: 15px;
  margin-bottom: 5px;
  display: block;
  color:#aaa;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.modal-box label.no-top {
  margin-top: 0;
}
.modal-box input[type="text"],
.modal-box input[type="file"],
.modal-box textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  background: #0a0a0f;
  border: 1px solid #333;
  border-radius: 6px;
  color: #fff;
}
.modal-box input[type="text"]:focus,
.modal-box textarea:focus {
  border-color: var(--dart-green);
  outline: none;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}
.modal-actions .btn {
  padding: 12px;
}
.modal-actions .btn.main {
  flex: 2;
}
.modal-actions .btn.alt {
  flex: 1;
  background: #333;
  border-color: #444;
  text-align: center;
  text-decoration: none;
}

/* Edit existing images box */
.edit-current-box {
  background: #0a0a0f;
  padding: 15px;
  border-radius: 6px;
  margin-top: 15px;
  border: 1px solid #333;
}
.edit-current-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.edit-thumb {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 4px;
  overflow: hidden;
}
.edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .7;
}
.edit-thumb-delete {
  position: absolute !important;
  inset: 0;
  background: rgba(227,41,46,0.8);
  color: #fff !important;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .7rem !important;
  margin: 0 !important;
  opacity: 0;
  transition: opacity .2s;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-weight: 700 !important;
}
.edit-thumb-delete input {
  margin-bottom: 3px;
}
.edit-thumb:hover .edit-thumb-delete,
.edit-thumb-delete:hover {
  opacity: 1;
}
.edit-hint {
  font-size: .75rem;
  color: #666;
  margin-top: 8px;
}
.label-accent {
  color: var(--dart-green) !important;
}

/* Empty state */
.galerie-empty {
  text-align: center;
  padding: 50px;
  background: rgba(255,255,255,0.02);
  border-radius: 12px;
  border: 1px dashed #333;
}
.galerie-empty .icon {
  font-size: 3rem;
  opacity: .5;
  margin-bottom: 10px;
}
.galerie-empty p {
  color: #888;
  font-size: 1.1rem;
  margin: 0;
}

/* --- LIGHTBOX --- */
#lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background-color: rgba(0,0,0,0.95);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
#lightbox-img {
  margin: auto;
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 8px;
  box-shadow: 0 0 40px rgba(0,0,0,0.9);
}
.lb-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: 300;
  cursor: pointer;
  z-index: 10000;
  transition: color .3s;
}
.lb-close:hover { color: var(--dart-red); }

.lb-prev, .lb-next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  padding: 20px;
  transform: translateY(-50%);
  color: #fff;
  font-weight: 300;
  font-size: 30px;
  user-select: none;
  z-index: 10000;
  transition: color .3s;
}
.lb-prev { left: 20px; }
.lb-next { right: 20px; }
.lb-prev:hover, .lb-next:hover { color: var(--dart-green); }

#lb-counter {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  color: #888;
  font-size: 1rem;
  letter-spacing: 3px;
  font-weight: bold;
}

/* =========================================
   LIGHT MODE OVERRIDES
   ========================================= */
html[data-theme="light"] .galerie-hero {
  background: radial-gradient(circle at 50% -20%, rgba(48,159,106,0.10) 0%, transparent 60%), #f6f9ff;
  border-bottom: 1px solid #d8e3f2;
}
html[data-theme="light"] .galerie-hero h2 {
  color: #0f172a;
  text-shadow: none;
}
html[data-theme="light"] .galerie-hero p { color: #64748b; }

html[data-theme="light"] .gallery-card {
  background: linear-gradient(145deg, #ffffff, #f8fbff);
  border: 1px solid #d6e1ef;
  box-shadow: 0 10px 26px rgba(15,23,42,.08);
}
html[data-theme="light"] .gallery-card:hover {
  border-color: #9bc8ae;
  box-shadow: 0 14px 30px rgba(15,23,42,.12);
}
html[data-theme="light"] .gallery-title { color: #0f172a; }
html[data-theme="light"] .gallery-caption { color: #475569; }

html[data-theme="light"] .post-images-grid {
  background: #e2e8f0;
  border-bottom: 1px solid #d6e1ef;
}
html[data-theme="light"] .more-overlay { background: rgba(15,23,42,.45); }

html[data-theme="light"] .admin-actions {
  background: rgba(255,255,255,.8);
  border-color: #d6e1ef;
}
html[data-theme="light"] .admin-btn { color: #0f172a; opacity: .8; }
html[data-theme="light"] .admin-btn:hover { opacity: 1; }
html[data-theme="light"] .admin-btn.del:hover { color: #b91c1c; }

html[data-theme="light"] .modal-overlay {
  background: rgba(15,23,42,.55);
}
html[data-theme="light"] .modal-box {
  background: #fff;
  border-color: #d6e1ef;
  box-shadow: 0 20px 45px rgba(15,23,42,.20);
}
html[data-theme="light"] .modal-box h3 { color: #0f172a; }
html[data-theme="light"] .modal-box label { color: #475569; }
html[data-theme="light"] .modal-box input[type="text"],
html[data-theme="light"] .modal-box input[type="file"],
html[data-theme="light"] .modal-box textarea {
  background: #f8fbff;
  border-color: #cfdced;
  color: #0f172a;
}

html[data-theme="light"] .modal-actions .btn.alt {
  background: #eef3fb;
  border-color: #bfd0e6;
  color: #0f172a;
}

html[data-theme="light"] .edit-current-box {
  background: #f8fbff;
  border-color: #d6e1ef;
}
html[data-theme="light"] .edit-hint { color: #64748b; }

html[data-theme="light"] .galerie-empty {
  background: #f8fbff;
  border-color: #d6e1ef;
}
html[data-theme="light"] .galerie-empty p { color: #64748b; }

/* Mobile */
@media (max-width: 768px) {
  .galerie-hero h2 { font-size: 2rem; }

  .galerie-wrap {
    padding: 0 12px;
  }

  .admin-actions { opacity: 1; } /* mobile immer sichtbar */

  .modal-actions {
    flex-direction: column;
  }
}
.galerie-period-title{
  margin: 28px 0 14px;
  color:#fff;
  font-size:1.25rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom:1px solid #2a3555;
  padding-bottom:8px;
}
html[data-theme="light"] .galerie-period-title{
  color:#0f172a;
  border-bottom-color:#d6e1ef;
}