/* Modal Styles for IHRA Theme (Mobile First) */

.modal-dialog {
  width: 100%;
  max-width: 100%;
  margin: 0.5rem;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  max-width: 100%;
  border-radius: 8px;
  padding: 15px;
  max-height: 95vh;
  overflow-y: auto;
  margin-top: 2rem;
  margin-bottom: 2rem;
}

#purchaseModal .modal-content {
  overflow-y: unset;
}

.modal-header {
  padding: 0;
  border: 0;
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

.modal-header button {
  background: none;
  border: none;
  font-size: 16px;
  font-weight: 900;
  color: #333;
  cursor: pointer;
  padding: 0;
}

.modal-header button:hover {
  color: #007bff;
}

.modal-title {
  font-size: 18px;
  text-align: center;
  font-weight: 900;
  color: #333;
  margin: 10px 0 15px 0;
  width: 100%;
  max-width: 100%;
  position: sticky;
  top: 50px;
  background: #fff;
  z-index: 9;
  padding: 10px 0;
}

.modal-body {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-height: calc(95vh - 200px);
  overflow-y: auto;
  padding: 0;
  align-items: flex-start;
  margin-top: 10px;
}

.modal__card {
  min-width: 100%;
  max-width: 100%;
  margin-top: 20px;
}

.modal__card-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
  background: #fff;
  flex-grow: 1;
}

.modal__card-header > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal__card-header .btn {
  margin-top: 20px;
  justify-self: flex-end;
}

.modal__card-header-price {
  color: #007bff;
  font-weight: 900;
  font-size: 18px;
  padding: 5px 10px;
  border-radius: 9999px;
  background: rgba(0, 123, 255, 0.1);
}

.modal__card-header-title {
  font-size: 20px;
  font-weight: 900;
  color: #333;
  text-align: center;
  margin-top: 10px;
}

.modal__card-body {
  padding: 16px;
  background: #f8f9fa;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal__card-wrapper {
  border-radius: 10px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: hidden;
  height: 100%;
}

/* Password Modal Specific Styles */
#PasswordModal .modal-dialog {
  max-width: 100%;
  height: auto;
  margin: 0.5rem;
}

#PasswordModal .modal-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: auto;
  width: 100%;
  margin: 0;
  padding: 20px;
  background: #fff;
  max-height: 95vh;
  overflow-y: auto;
}

#PasswordModal .modal-details {
  width: 100%;
  padding-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #dee2e6;
  margin-bottom: 20px;
}

#PasswordModal .modal-details h2 {
  width: 100%;
  font-size: 24px;
  margin-top: 20px;
  color: #007bff;
  text-align: center;
}

#PasswordModal .modal-details img {
  width: 120px;
  height: auto;
  border-radius: 8px;
}

#PasswordModal .modal-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#PasswordModal .modal-form .modal-title {
  max-width: 100%;
  margin: 0 0 20px 0;
  display: block;
  font-size: 16px;
  text-align: center;
}

#PasswordModal .error {
  color: #dc3545;
  text-align: center;
  margin-bottom: 15px;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#PasswordModal input {
  width: 100%;
  max-width: 220px;
  padding: 10px;
  font-size: 16px;
  margin-bottom: 20px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

#PasswordModal input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#PasswordModal .btn {
  margin-top: 10px;
}

.modal-backdrop {
  backdrop-filter: blur(5px);
  background: rgba(0, 0, 0, 0.5);
}

.modal-backdrop.show {
  opacity: 1;
}

/* Ensure modal is properly centered and scrollable */
.modal.show {
  display: block;
  overflow-y: auto;
}

/* Fix for Bootstrap 4 modal positioning */
.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}

/* Tablet and up */
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
    min-height: auto;
    align-items: center;
  }

  .modal-content {
    margin-top: 0;
    margin-bottom: 0;
  }

  .modal-title {
    position: static;
    top: auto;
    background: transparent;
    z-index: auto;
    padding: 0;
  }

  #PasswordModal .modal-dialog {
    max-width: 400px;
    margin: 1.75rem auto;
  }
}

/* Desktop and up */
@media (min-width: 1440px) {
  .modal-dialog {
    max-width: 800px;
  }

  #PasswordModal .modal-dialog {
    max-width: 600px;
  }

  .modal__card {
    min-width: 300px;
    max-width: 400px;
    margin-top: 0;
  }

  .modal-body {
    gap: 20px;
    align-items: flex-start;
  }
}
