/* Reset und Basis-Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

/* Performance: Optimierungen für schnelleres Rendering */
img, video {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

body {
  font-family: var(--public-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
  background-color: #fff;
  color: #333;
  line-height: 1.6;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* Loading Spinner */
.loading-spinner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.loading-spinner.hidden {
  opacity: 0;
  visibility: hidden;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2c3e50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  will-change: transform; /* Performance-Optimierung für Animation */
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Obere Linie - wird dynamisch gestylt */
.public-top-line {
  width: 100%;
  height: var(--public-line-thickness, 3px);
  background: var(--public-line-color, #2c3e50);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: none; /* Wird per JavaScript aktiviert */
}

/* Sprachauswahl oben rechts */
.language-selector-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.language-selector-top label {
  font-weight: 500;
  color: #555;
  font-size: 0.9rem;
}

.language-icon-label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  cursor: pointer;
  transition: color 0.2s;
}

.language-icon-label:hover {
  color: #333;
}

.language-icon-label svg {
  width: 20px;
  height: 20px;
  display: block;
}

.language-selector-top select {
  padding: 0.5rem 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.2s;
}

.language-selector-top select:hover {
  border-color: #999;
}

.language-selector-top select:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Hauptcontainer */
main {
  max-width: 960px;
  margin: var(--public-line-thickness, 3px) auto 0; /* Abstand oben für fixierte obere Linie */
  padding: 0 1rem 2rem;
  flex: 1; /* Nimmt verfügbaren Platz ein, damit Footer unten bleibt */
}

/* Fehlermeldung */
.error-message {
  background-color: #fee;
  border: 1px solid #fcc;
  border-radius: 8px;
  padding: 0;
  margin-top: 2rem;
  margin-bottom: 2rem;
  color: #c33;
}

.error-message p {
  margin: 0;
}

/* Exponat-ID Formular */
.exponat-form {
  max-width: 500px;
  margin: 4rem auto 2rem;
  padding: 2rem;
  background-color: #f9f9f9;
  border-radius: 8px;
  text-align: center;
}

.exponat-form h2 {
  margin-bottom: 1rem;
  color: #222;
}

.exponat-form p {
  margin-bottom: 1.5rem;
  color: #666;
}

.exponat-form-error {
  background-color: #fee;
  border: 1px solid #fcc;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: #c33;
  font-size: 0.9rem;
}

#exponat-id-form {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
}

#exponat-id-input {
  padding: 0.75rem 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
  width: 200px;
  text-align: center;
}

#exponat-id-input:focus {
  outline: none;
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

#exponat-id-form button {
  padding: 0.75rem 1.5rem;
  background-color: #0066cc;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

#exponat-id-form button:hover {
  background-color: #0052a3;
}

#exponat-id-form button:active {
  background-color: #003d7a;
}

/* Hero-Bereich (Hauptmedium) */
.hero {
  margin-bottom: 2rem;
}

#hero-media {
  width: 100%;
  background-color: #fff;
}

/* Media-Container für Bild/Video */
#hero-media > img,
#hero-media > video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  /* Border-Radius wird per inline-Style gesetzt, aber hier als Fallback */
  border-radius: 12px !important;
}

#hero-media iframe,
#hero-media a {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#hero-media iframe {
  border: none;
  display: block;
}

#hero-media a {
  display: block;
  text-decoration: none;
  position: relative;
}

.hero-placeholder {
  color: #999;
  text-align: center;
  padding: 0;
}

/* Bildunterschrift (Caption) */
.media-caption {
  margin: 0.75rem 0 0 0;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: #666;
  text-align: center;
  background-color: #fff;
  line-height: 1.5;
  border-radius: 0 0 12px 12px;
  font-family: var(--public-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
}

/* AI-Kennzeichnung */
.ai-badge {
  font-size: 12px;
  color: #666;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #f9f9f9;
  cursor: pointer;
  display: inline-block;
  transition: background-color 0.2s;
}

.ai-badge:hover {
  background-color: #f0f0f0;
}

.ai-badge svg {
  vertical-align: middle;
  margin-right: 4px;
}

/* Info-Bereich */
.info {
  margin-bottom: 2rem;
}

/* Überschrift-Bereich (separat steuerbar) */
.info-title {
  margin-bottom: 0;
}

.info-title h2 {
  font-size: 2rem;
  margin-bottom: 0; /* Wird dynamisch aus Einstellungen gesetzt */
  color: #222;
  font-family: var(--public-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
}

.info h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: #222;
  font-family: var(--public-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
}

.info h3 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
  color: #444;
  font-weight: 400;
}

.teaser {
  font-size: 1.1rem;
  color: #555;
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

/* Galerie */
.gallery {
  margin-bottom: 2rem;
}

.gallery h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: #222;
}

.gallery-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

@media (min-width: 600px) {
  .gallery-items {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

.gallery-item {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.gallery-item-title {
  padding: 0;
  font-size: 0.9rem;
  color: #333;
  text-align: center;
}

.gallery-empty {
  color: #999;
  font-style: italic;
  padding: 0;
  text-align: center;
}

/* Beschreibung */
.description {
  margin-bottom: 2rem;
}

#body-text {
  font-size: 1rem;
  line-height: 1.8;
  color: #444;
  font-family: var(--public-font-family, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
}

/* HTML-Formatierungen im Body-Text */
#body-text strong,
#body-text b {
  font-weight: 600;
  color: #222;
}

#body-text em,
#body-text i {
  font-style: italic;
}

#body-text u {
  text-decoration: underline;
}

#body-text p {
  margin-bottom: 1rem;
}

#body-text p:last-child {
  margin-bottom: 0;
}

/* Footer */
footer {
  background-color: #fff;
  padding: 1.5rem 1rem;
  margin-top: auto; /* Wird nach unten geschoben */
  border-top: 1px solid #eee;
  text-align: center;
  color: #666;
  font-size: 0.9rem;
  width: 100%;
}

footer p {
  max-width: 960px;
  margin: 0 auto;
}

footer a {
  color: #666;
  text-decoration: underline;
}

footer a:hover {
  color: #333;
}

/* Impressum Modal */
.impressum-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.impressum-modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 0;
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.impressum-modal-content h2 {
  margin-top: 0;
  margin-bottom: 1.5rem;
  color: #222;
}

.impressum-close {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 2rem;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  line-height: 1;
}

.impressum-close:hover {
  color: #333;
}

#impressum-content,
#privacy-content,
#ai-info-content {
  line-height: 1.8;
  color: #444;
}

#impressum-content p {
  margin-bottom: 1rem;
}

#impressum-content p:last-child {
  margin-bottom: 0;
}

/* Mobile-Optimierungen */
@media (max-width: 600px) {
  .language-selector-top {
    padding: 0.75rem 0;
  }

  .language-selector-top label {
    font-size: 0.85rem;
  }

  .language-selector-top select {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
  }

  .info-title h2 {
    font-size: 1.6rem;
  }

  .info h2 {
    font-size: 1.6rem;
  }

  .info h3 {
    font-size: 1.1rem;
  }

  .teaser {
    font-size: 1rem;
  }

  .gallery-items {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
}

