.modal-content.custom-popup {
  border: none;
  border-radius: 10px;
  overflow: hidden;
}

.modal-small {
  max-width: 380px;
}

.modal-header.custom-header {
  background-color: #800080;
  border-bottom: none;
  justify-content: center;
  position: relative;
  padding: 0.8rem;
}

.custom-header .logo-img {
  max-height: 30px;
}

.close-btn-custom {
  position: absolute;
  top: -15px;
  right: -15px;
  background-color: #ddd;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #800080;
  font-weight: bold;
  cursor: pointer;
  z-index: 1056;
  /* Higher than modal */
  border: 2px solid white;
}

.modal-body.custom-body {
  padding: 15px 20px;
}

.custom-body h4 {
  text-align: center;
  font-weight: bold;
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.2rem;
  font-size: 0.85rem;
}

.form-control.custom-input,
.form-select.custom-input {
  background-color: #ffffff;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.9rem;
}

.form-control.custom-input:focus {
  background-color: #ffffff;
  border-color: #800080;
  box-shadow: none;
}

/* Fix for Input Group Joining */
.input-group .custom-input:not(:last-child),
.input-group .custom-select-wrapper:not(:last-child) .custom-select-trigger {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group .custom-input:not(:first-child),
.input-group .custom-select-wrapper:not(:first-child) .custom-select-trigger {
  border-top-left-radius: 10;
  border-bottom-left-radius: 10;
}

/* Ensure wrapper works in input group */
.input-group .custom-select-wrapper {
  flex: 0 0 20%;
  width: auto;
  border-radius: 20px;
}

.submit-btn-custom {
  background-color: #800080;
  color: white;
  width: 100%;
  padding: 8px;
  font-weight: bold;
  border: none;
  border-radius: 5px;
  margin-top: 10px;
  font-size: 0.95rem;
}

.submit-btn-custom:hover {
  background-color: #660066;
  color: white;
}

/* Custom Select Styles (Adapted for Global Use in Popup) */
.custom-select-wrapper {
  position: relative;
  user-select: none;
  width: 100%;
}

.custom-select-wrapper .custom-select-trigger {
  position: relative;
  display: block;
  background-color: #e0e0e0;
  /* Match custom-input */
  border-radius: 5px;
  padding: 0 5px;
  font-weight: 400;
  color: #333;
  cursor: pointer;
  min-height: 50px;
  /* Ensure sufficient height */
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}

.custom-select-wrapper .custom-select-trigger:after {
  content: "▼";
  font-size: 10px;
  position: absolute;
  right: 10px;
  color: #666;
}

.custom-select-wrapper.open .custom-select-trigger:after {
  content: "▲";
}

.custom-options {
  position: absolute;
  display: block;
  top: 100%;
  left: 0;
  right: 0;
  border: 1px solid #ddd;
  border-top: 0;
  background: #fff;
  transition: all 0.3s;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 1050;
  /* Ensure it floats above other inputs */
  border-radius: 0 0 5px 5px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
}

.custom-select-wrapper.open .custom-options {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.custom-option {
  position: relative;
  display: block;
  padding: 10px;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  cursor: pointer;
  transition: all 0.2s;
}

.custom-option:hover {
  background-color: #f2f2f2;
  color: #800080;
}

.custom-option.selected {
  background-color: #800080;
  color: #fff;
}

/* Mobile Responsiveness for Popup */
@media (max-width: 576px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: 100%;
  }

  .modal-content.custom-popup {
    border-radius: 0;
    /* maximize space on distinct mobile view */
    border-radius: 10px;
    /* actually keep rounded looks better */
  }

  .custom-body h4 {
    font-size: 1.25rem;
  }

  /* Adjust input group for very small screens if needed */
  .input-group .custom-select-wrapper {
    flex: 0 0 35%;
    /* Give consistent space to flag on mobile */
  }

  .close-btn-custom {
    right: -10px;
    top: -10px;
    width: 25px;
    height: 25px;
    font-size: 14px;
  }
}