/* Grundlegende Struktur für sticky Header und Footer */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Verhindert, dass der Inhalt unter dem Header und Footer verschwindet */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Hauptinhalt */
#page, #content, .site-content {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  overflow: auto; /* Stellt sicher, dass der Inhalt scrollen kann */
}

/* Elementor-Container sollen den verfügbaren Platz einnehmen */
.elementor-section-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Sticky Header */
header, .site-header {
  position: sticky;
  top: var(--admin-bar-height, 0);
  width: 100%;
  z-index: 999;
  background-color: #fff; /* Sicherstellen, dass der Header sichtbar bleibt */
}

/* Anpassung für eingeloggte Benutzer */
.admin-bar header, 
.admin-bar .site-header {
  top: var(--admin-bar-height, 0);
}

/* Spezifischer Footer-Selector basierend auf Ihrem HTML */
#footer.site-footer, 
footer.site-footer, 
.site-footer-wrap,
.site-footer {
  flex-shrink: 0;
  margin-top: auto; /* Drückt den Footer nach unten bei kurzem Inhalt */
  width: 100%;
  position: relative;
  z-index: 998;
}

/* Für Elementor-Container mit vh100, die Header, Footer und Admin-Bar berücksichtigen */
.elementor-section-height-full {
  height: calc(100vh - var(--total-header-height, 0) - var(--footer-height, 0)) !important;
  min-height: calc(100vh - var(--total-header-height, 0) - var(--footer-height, 0)) !important;
}

.elementor {
  padding-bottom: 50px;
}

/* Scrollverhalten verbessern */
html {
  scroll-padding-top: var(--total-header-height, 0);
  scroll-padding-bottom: var(--footer-height, 0);
}

/* Mobile-Version (Smartphones) */
@media (max-width: 1023px) {
  /* Header für Mobile */
  header, .site-header {
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 999;
    background-color: #fff;
  }

  /* Footer für Mobile */
  #footer.site-footer, 
  footer.site-footer, 
  .site-footer-wrap,
  .site-footer {
    position: relative;
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
    z-index: 998;
  }

  /* Elementor Container für Mobile mit Header und Footer */
  .elementor-section-height-full {
    height: calc(100vh - var(--total-header-height, 0) - var(--footer-height, 50px)) !important;
    min-height: calc(100vh - var(--total-header-height, 0) - var(--footer-height, 50px)) !important;
  }

  /* Footer-Höhe anpassen */
  .elementor {
    padding-bottom: 50px; /* Passt den Footer-Platz für Smartphones an */
  }
}

/* Spezifische Regel für die Archivseite Aktuell */
@media (min-width: 992px) {
  .archive-aktuell .content-area {
    width: 100% !important;
    max-width: 100vw;
  }

  #primary.content-area {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
}
