.modal-container {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 30;

  &.dark {
    background-color: var(--fg);
  }

  &[hidden] {
    display: none;
  }
}

.modal {
  z-index: 35;
  position: relative;
  padding: var(--crotchet);
  border-radius: var(--quaver);
  background: var(--bg);
  width: min(90%, 400px);
  max-height: min(80vh, 800px);
  overflow: auto;
}

.modal-title {
  font-family: var(--font-sans);
  margin-right: auto;
  margin-bottom: var(--minim);
}

.modal-bottom {
  display: flex;
  justify-content: end;
  gap: var(--quaver);
  position: sticky;
  background-color: var(--bg);
  padding-top: var(--crotchet);
  bottom: 0;
}

.modal-close-button {
  margin-right: auto;
  font-family: var(--font-sans);
  letter-spacing: 0.08em;
}

/* Image Viewer Modal */
.modal-container.image-viewer {
  background: rgba(0, 0, 0, 0.9);
  z-index: 100;
  cursor: zoom-out;
}

.modal-image-wrapper {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-image-content {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--quaver);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  cursor: default;
}

.modal-close-icon {
  position: absolute;
  top: -40px;
  right: -40px;
  background: transparent;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
}

@media (max-width: 768px) {
  .modal-close-icon {
    top: -40px;
    right: 0;
  }
}