/* Dialog styles for stimulus-components/dialog */

/* Prevent scrolling while dialog is open */
body:has(dialog[data-dialog-target="dialog"][open]) {
  overflow: hidden;
}

/* Customize the dialog backdrop - this creates the overlay effect */
dialog {
  box-shadow: 0 0 0 100vw rgb(0 0 0 / 0.5);
}

/* Position dialog in the center */
dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

/* Add fade-in animation */
@keyframes fade-in {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}

/* Add animations */
dialog[data-dialog-target="dialog"][open] {
  animation: fade-in 200ms forwards;
}

dialog[data-dialog-target="dialog"][closing] {
  animation: fade-out 200ms forwards;
}

/* Reset default dialog styles */
dialog {
  border: none;
  border-radius: 0.5rem;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
}

/* Center the dialog */
dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
