* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f8fafc;
  color: #1e293b;
  padding: 3rem 1.5rem;
}

.gallery-container {
  max-width: 1320px;
  margin: 0 auto;
}

.gallery-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.gallery-header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #0f172a;
}

.subtitle {
  color: #64748b;
  margin-top: 0.5rem;
  font-size: 0.95rem;
}

/* Steuerelemente Leiste */
.gallery-controls {
  margin-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #334155;
  font-weight: 500;
}

.control-group input[type="search"],
.control-group select {
  padding: 0.55rem 0.9rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #ffffff;
  color: #1e293b;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.control-group input[type="search"]:focus,
.control-group select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.selection-actions {
  display: flex;
  gap: 0.75rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease, opacity 0.2s ease;
}

.btn-primary {
  background-color: #2563eb;
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background-color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-secondary {
  background-color: #e2e8f0;
  color: #334155;
}

.btn-secondary:hover {
  background-color: #cbd5e1;
}

/* Grid Layout */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.gallery-item {
  position: relative;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -3px rgba(0, 0, 0, 0.1);
}

/* Checkbox Styling */
.checkbox-container {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  cursor: pointer;
}

.checkbox-container input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.custom-checkbox {
  display: block;
  width: 22px;
  height: 22px;
  background-color: rgba(255, 255, 255, 0.85);
  border: 2px solid #64748b;
  border-radius: 6px;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.checkbox-container input:checked ~ .custom-checkbox {
  background-color: #2563eb;
  border-color: #2563eb;
}

.checkbox-container input:checked ~ .custom-checkbox::after {
  content: "";
  display: block;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(2px, -1px);
  margin: 2px auto;
}

/* Video- & Bild-Bereich (Einheitliche Kachelgröße) */
.video-wrapper,
.image-wrapper {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9; /* Erzwingt überall das einheitliche 16:9 Format */
  background-color: #020617;
  cursor: pointer;
}

/* Gilt für Bilder UND Videos im Grid */
.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Verhindert Verzerrung und füllt die Kachel bündig aus */
  display: block;
  transition: transform 0.3s ease;
}

/* Hover-Zoom */
.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.04);
}

/* Play-Overlay für Videos */
.video-overlay,
.image-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  pointer-events: none; /* Leitet Klicks direkt weiter */
}

.play-btn {
  background-color: rgba(37, 99, 235, 0.9);
  color: #ffffff;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.video-wrapper:hover .play-btn {
  transform: scale(1.06);
  background-color: #2563eb;
}
/* Bildunterschrift */
figcaption {
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  background-color: #ffffff;
  border-top: 1px solid #f1f5f9;
}

.caption-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #64748b;
  background-color: #f1f5f9;
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.btn-icon:hover {
  color: #2563eb;
  background-color: #e0e7ff;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.92);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  backdrop-filter: blur(8px);
}

.lightbox-modal.active {
  display: flex !important;
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  font-size: 2.5rem;
  color: #ffffff;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  z-index: 100000;
  transition: transform 0.2s ease;
}

.lightbox-close:hover {
  transform: scale(1.2);
}

.lightbox-content {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 100000;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  margin-top: 1rem;
  color: #f8fafc;
  font-size: 1.1rem;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  background-color: #ffffff;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}