dialog[data-modal] {
  --width-sm: 300px;
  --width-md: 500px;
  --width-lg: 800px;
  --width-xl: 1140px;
  --margin-size: 1.75rem;
}
/* Overlay */
dialog[data-modal]::backdrop {
  /* background-color: rgba(0, 0, 0, 0.5); */
  opacity: 0;
}

/* Dialog */
dialog[data-modal] {
  border: none;
  border-radius: 0.3rem;
  /* box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); */
  box-shadow: 0 3px 5px -2px hsl(220 40% 2% / calc(25% + 3%)),
    0 7px 14px -5px hsl(220 40% 2% / calc(25% + 5%)),
    0 0 0 100vw rgba(0, 0, 0, 0.5);
  padding: 0;
  margin: var(--margin-size) auto 0 auto; 
  flex-direction: column;
  max-height: calc(100vh - var(--margin-size)); /* Limit the height of the dialog */
}

dialog[data-modal][open] {
  display: flex;
  animation: slide-down 300ms forwards, fade-in 500ms forwards;
}

dialog[data-modal] [data-body] {
  overflow-y: auto;
}
/* .modal[open]::backdrop {
  animation: fade-in 500ms forwards;
} */

dialog[data-modal][closing] {
  display: block;
  pointer-events: none;
  inset: 0;
  animation: slide-up 300ms forwards, fade-out 500ms forwards;
}

@keyframes fade-in {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes slide-down {
  0% {
    transform: translateY(-50px);
  }
  100% {
    transform: translateY(0%);
  }
}

@keyframes slide-up {
  0% {
    transform: translateY(0%);
  }
  100% {
    transform: translateY(-50px);
  }
}

dialog[data-modal].modal-sm {
  [data-header],[data-body],[data-footer] {
    width: var(--width-sm);
  }
}
dialog[data-modal].modal-md {
  [data-header],[data-body],[data-footer] {
    width: var(--width-md);
  }
}
dialog[data-modal].modal-lg {
  [data-header],[data-body],[data-footer] {
    width: var(--width-lg);
  }
}
dialog[data-modal].modal-xl {
  [data-header],[data-body],[data-footer] {
    width: var(--width-xl);
  }
}

dialog[data-modal] [data-header],
dialog[data-modal] [data-body],
dialog[data-modal] [data-footer] {
  background-color: white;
  padding: 16px 10px;
  border: none;
}
dialog[data-modal] [data-header] {
  border-bottom: solid 1px rgb(222 226 230);
  display: flex;
  align-items: center;
}
dialog[data-modal] [data-footer] {
  border-top: solid 1px rgb(222 226 230);
  display: flex;
  justify-content: flex-end;
}

dialog[data-modal] [data-btn-close] {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.25em 0.25em;
  color: #000;
  background: transparent
    url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e")
    center/1em auto no-repeat;
  border: 0;
  border-radius: 0.375rem;
  opacity: 0.5;
  margin-left: auto;
}

/* Title */
dialog[data-modal] [data-title] {
  margin-top: 0;
  font-size: 1.1rem;
  font-weight: 400;
}

/* Body */
dialog[data-modal] p {
  margin-bottom: 1rem;
}

/* Buttons */
dialog[data-modal] button {
  border: none;
  border-radius: 0.3rem;
  padding: 0.25rem 0.5rem;
  margin: 0.25rem;
  font-size: 0.875rem;
  cursor: pointer;
}

/* OK button */
dialog[data-modal] [data-btn-ok] {
  background-color: #007bff;
  color: #fff;
}

/* Cancel button */
dialog[data-modal] [data-btn-cancel] {
  background-color: #f0f0f0;
  color: #333;
}

/* Disabled OK button */
dialog[data-modal] [data-btn-ok]:disabled {
  background-color: #b0c4de; /* Light grayish-blue */
  color: #fff; /* White text */
  /* cursor: not-allowed; */
  opacity: 0.65;
}

/* Disabled Cancel button */
dialog[data-modal] [data-btn-cancel]:disabled {
  background-color: #e0e0e0; /* Light gray */
  color: #aaa; /* Light gray text */
  /* cursor: not-allowed; */
  opacity: 0.65;
}