/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 100000 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  position: relative;
  background: #fff;
  border-radius: 8px;
  max-width: 800px;
  width: 90%;
  max-height: 1480px;
  overflow: visible;
  transform: scale(0.7);
  transition: transform 0.3s ease-in-out;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.modal-overlay.active .modal-container {
  transform: scale(1);
}

.modal-header {
  position: relative;
  background: #46b088;
  color: #fff;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
  z-index: 1;
}

.modal-title {
  display: flex;
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  height: 29px;
  text-align: center;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  position: absolute;
  top: -20px;
  right: -15px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.modal-close svg {
  width: 24px;
  height: 24px;
}

.modal-overlay .modal-body {
  padding: 25px 0px;
  overflow-x: hidden;
  box-sizing: border-box;
  display: block !important;
  grid-template-columns: none !important;
  gap: 0 !important;
}

.wrapper-content {
  padding: 0px 30px;
  max-height: 575px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-overlay .modal-content {
  width: 740px;
  font-size: 15px;
  line-height: 1;
  max-width: 740px;
  overflow: hidden;
  margin: 0 !important;
  max-height: none;
  border-radius: unset;
}

/* Modal Content Styles */
.modal-content-inner h1,
.modal-content-inner h2,
.modal-content-inner h3,
.modal-content-inner h4,
.modal-content-inner h5,
.modal-content-inner h6 {
  color: #000000;
  font-weight: 600;
  margin: 24px 0 12px 0;
  font-size: 18px;
  line-height: 1.2;
}

.modal-content-inner h1:first-child,
.modal-content-inner h2:first-child,
.modal-content-inner h3:first-child,
.modal-content-inner h4:first-child,
.modal-content-inner h5:first-child,
.modal-content-inner h6:first-child {
  margin-top: 0;
}

.modal-content-inner p {
  margin: 0 0 16px 0;
  text-align: justify;
}

.modal-content-inner p:last-of-type {
  margin: 0;
}

.modal-content-inner ul,
.modal-content-inner ol {
  margin: 16px 0;
  padding-left: 20px;
}

.modal-content-inner li {
  margin-bottom: 8px;
}

.modal-content-inner strong {
  font-weight: 600;
  color: #000000;
}

/* Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #46b088;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.loading-spinner p {
  color: #666;
  margin: 0;
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.error-message p {
  margin: 0 0 10px 0;
}

/* Scrollbar Styling */
.wrapper-content::-webkit-scrollbar {
  width: 6px;
}

.wrapper-content::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.wrapper-content::-webkit-scrollbar-thumb {
  background: #c0c0c2;
  border-radius: 3px;
}

.wrapper-content::-webkit-scrollbar-thumb:hover {
  background: #3a9a75;
}

/* Body scroll prevention */
body.modal-open {
  overflow: hidden !important;
}

/* Ensure header stays below modal when modal is active */
body.modal-open .site-header {
  z-index: 9999 !important;
}

/* Ensure modal is always on top */
.modal-overlay.active {
  z-index: 100000 !important;
}

@media (max-width: 1439px) and (min-width: 1024px) {
  .modal-overlay .modal-body {
    padding: 24px 0;
  }

  .wrapper-content {
    padding: 0px 24px;
    max-height: 373px;
    overflow-y: auto;
    overflow-x: hidden;
    }

  .modal-overlay .modal-content {
    width: 752px;
  }
}

@media (max-width: 1023px) and (min-width: 768px) {

  .modal-container {
    width: auto;
  }
  
  .modal-overlay .modal-body {
    padding: 25px 0;
    max-width: 688px;
  }

  .wrapper-content {
    padding: 0px 30px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 611px;
    }

  .modal-overlay .modal-content {
    width: 628px;
  }
}

/* Responsive Design */
@media (max-width: 767px) {
  .modal-container {
    width: calc(100% - 32px);
    max-height: 560px;
    max-width: 343px;
  }

  .modal-header {
    gap: 10px;
    padding: 16px 0 16px 16px;
  }

  .modal-title {
    font-size: 16px;
    line-height: 100%;
    height: 19px;
  }

  .modal-overlay .modal-body {
    padding: 16px 0;
  }

  .modal-overlay .modal-content {
    font-size: 14px;
  }

  .wrapper-content {
    padding: 0px 16px;
    max-height: 477px;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .modal-overlay .modal-content {
    width: 311px;
  }

  .modal-content-inner p {
    text-align: unset;
}
}