/* Disable body scrolling when modal is open */
body.modal-open {
  overflow: hidden;
  /* Don't add padding - we'll handle scrollbar compensation in JS */
}

/* The Modal (background) */
.modal {
  display: none;
  /* Hidden by default */
  position: fixed;
  /* Stay in place */
  padding-bottom: 80px;
  padding-top: 1%;
  z-index: 100;
  /* Sit on top */
  left: 0;
  top: 0;
  width: 100%;
  /* Full width */
  height: 100%;
  /* Full height */
  overflow: auto;
  /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.4);
  /* Black w/ opacity */
  -webkit-overflow-scrolling: touch;
  /* Enables momentum scrolling on iOS */
  opacity: 0;
  transition: opacity 0.3s ease;
  will-change: opacity;
  /* Optimize for animation */
  backface-visibility: hidden;
  /* Prevent flickering */
  -webkit-backface-visibility: hidden;
}

/* Modal visible state */
.modal.visible {
  opacity: 1;
}

/* iOS-style pull bar */
.modal__pull--bar {
  position: sticky;
  top: 0;
  width: 100%;
  height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  cursor: pointer;
  z-index: 101;
  margin-bottom: -10px;
  padding-top: 10px;
}

.modal__pull--indicator {
  width: 36px;
  height: 5px;
  background-color: #e0e0e0;
  border-radius: 3px;
  transition: background-color 0.2s ease;
}

.modal__pull--bar:hover .modal__pull--indicator {
  background-color: #c0c0c0;
}

/* Modal Content/Box */
.modal__content {
  background-color: #ffffff;
  margin: 0 auto;
  padding: 0 48px 48px 48px;
  border: 1px solid #e2e2e2;
  border-radius: 28px;
  width: fit-content;
  /* Width will be determined by content */
  max-width: 99%;
  /* Prevent overflow on small screens */
  position: relative;
  /* For positioning the pull bar */
  overflow-x: hidden;
  /* Prevent horizontal scrolling */
  overflow-y: auto;
  /* Allow vertical scrolling */
  transform: translateY(100%);
  /* Start from bottom of screen */
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  /* Use a nice easing curve, no opacity transition */
  will-change: transform;
  /* Optimize for animation */
  backface-visibility: hidden;
  /* Prevent flickering */
  -webkit-backface-visibility: hidden;
}

/* Animation for modal content when modal is visible */
.modal.visible .modal__content {
  transform: translateY(0);
}


/* Round close button at the bottom of modal */
.modal__close--button {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #333336;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  opacity: 1; /* Always visible */
  transition: opacity 0.3s ease, transform 0.3s ease;
  margin-top: 20px;
  /* Add space between modal content and close button */
}

.modal.visible .modal__close--button {
  opacity: 1;
}

.modal__close--button:hover {
  transform: translateX(-50%) scale(1.1);
}

.modal__close--icon {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  transition: transform 0.3s ease;
}


@media (max-width: 768px) {
  .modal__content {
    padding: 0 24px 24px 24px;
  }

}
