/* Overlay mit Glassmorphismus */
#wfsn-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--background-color-overlay);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
  box-shadow: inset 0 0 50px rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
#wfsn-overlay.active {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Modal Container */
.wfsn-modal,
.wfsn-share-modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 1rem;
  transition: opacity 0.3s ease;
  background-color: transparent; /* Modal-Hintergrund transparent */
}
.wfsn-modal.active,
.wfsn-share-modal.active {
  display: flex;
}
/* Boxed Variante (Standard) */
.wfsn-modal-style-boxed .wfsn-modal-dialog {
  max-width: 800px;
  max-height: 90vh; /* Maximale Höhe begrenzen */
  width: 100%;
  border-radius: var(--border-radius-default);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Verhindert Overflow außerhalb */
}

/* Fullwidth Variante */
.wfsn-modal-style-fullwidth .wfsn-modal-dialog {
  max-width: calc(100vw - 3vw - 10px);
  width: calc(100vw - 3vw - 10px);
  height: calc(100vh - 3vw - 10px);
  max-height: calc(100vh - 3vw - 10px);
  margin: 0;
  border-radius: var(--border-radius-default);
  box-shadow: var(--glass-shadow);
  display: flex;
  flex-direction: column;
  overflow: auto;
}

/* Modal Box */
.wfsn-modal-dialog {
  background: var(--modal-bg-primary);
  border-radius: var(--border-radius-default);
  max-width: 800px;
  width: 100%;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
  animation: wfsn-fadeIn 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Modal Header (fixiert) */
.wfsn-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--modal-bg-secondary);
  padding: var(--padding-small) var(--padding-normal);
  border-bottom: 1px solid var(--highlight-white-15);
  border-top-left-radius: var(--border-radius-default);
  border-top-right-radius: var(--border-radius-default);
  flex-shrink: 0;
  z-index: 1;
}

.wfsn-modal-header .title {
  color: var(--text-color);
  font-size: 18px;
  font-weight: 600;
}

/* Modal Content Container (scrollt) - für alle Varianten */
.wfsn-modal-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0; /* Wichtig für Flexbox-Scrolling */
}

/* Scrollbarer Body-Inhalt */
.wfsn-modal-body {
  padding: 2rem;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
}

/* Modal Footer (optional, fixiert) */
.wfsn-modal-footer {
  background: var(--modal-bg-secondary);
  padding: var(--padding-small) var(--padding-normal);
  border-top: 1px solid var(--highlight-white-15);
  border-bottom-left-radius: var(--border-radius-default);
  border-bottom-right-radius: var(--border-radius-default);
  flex-shrink: 0;
}

/* Schließen-Button */
.wfsn-close-button,
.wfsn-close-button:hover,
.wfsn-close-button:focus {
  width: 50px;
  height: 50px;
  top: 0;
  right: 0;
  font-size: 40px;
  padding: 0;
  line-height: 0;
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  z-index: 10;
  box-shadow: none;
}

/* Share Modal Close Button (anders positioniert) */
.wfsn-share-modal .wfsn-close-button {
  top: 1rem;
  right: 1rem;
  color: #fff;
  z-index: 1002;
}

/* Share Modal Close Text (ersetzt den Button) */
.wfsn-share-close-text {
  background: var(--highlight-white-10);
  border-radius: var(--border-radius-default);
  padding: var(--padding-small);
  text-align: center;
  margin-top: 2rem;
  color: #fff;
  font-size: 25px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  user-select: none;
}

.wfsn-share-close-text:hover {
  opacity: 0.7;
}

.wfsn-share-close-text i {
  margin-right: 0.5rem;
}

/* Share Safe Zone (Container der Icons) */
.wfsn-share-safezone {
  background-color: transparent;
  padding: 1rem 2rem;
  border-radius: var(--border-radius-default);
}

/* Share-Icons */
.wfsn-share-icons {
  display: flex;
  gap: 1.5rem;
  background-color: transparent;
  padding: 0;
  border-radius: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  justify-content: center;
}

.wfsn-share-title {
  text-align: center;
  color: var(--primary-color);
  font-size: 30px;
  margin-bottom: 25px;
  font-weight: 600;
}

.wfsn-share-icons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1.2rem;
  justify-items: center;
  align-items: center;
  margin-bottom: 1rem;
}

.wfsn-share-icon {
  font-size: 2rem;
  color: #fff;
  text-decoration: none;
  transition: transform 0.2s ease;
  user-select: none;
}

.wfsn-share-icon:hover {
  transform: scale(1.2);
}

/* Mobile Optimierung */
@media (max-width: 600px) {
  .wfsn-modal-style-boxed .wfsn-modal-dialog {
    max-width: 95vw;
    max-height: 85vh; /* Auf Mobile etwas kleiner */
  }
  .wfsn-modal-header,
  .wfsn-modal-footer {
    padding: 1rem 1.5rem;
  }
  .wfsn-modal-body {
    padding: 1.5rem;
  }
  .wfsn-share-icons-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Animation */
@keyframes wfsn-fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
