@use "../../../styles/abstracts/variables" as *;
@use "../../../styles/abstracts/mixins" as *;

@import url('https://fonts.googleapis.com/css2?family=Onest:wght@100..900&display=swap');

/* ===============================
   Modal Backdrop
=============================== */
.modalBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 1rem;
  backdrop-filter: blur(3px);
  overflow-y: auto; // allow scroll if modal taller than viewport
}

/* ===============================
   Modal Content
=============================== */
.modalContent {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh; // prevent modal from exceeding viewport
  padding: 2rem;
  position: relative;
  font-family: 'Onest', sans-serif;
  animation: fadeIn 0.25s ease;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow-y: auto; // enable scrolling inside modal

  /* smooth scroll on mobile */
  -webkit-overflow-scrolling: touch;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===============================
   Header
=============================== */
.modalHeader {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  position: relative;

  h2 {
    font-weight: 700;
    font-size: 1.3rem;
    color: $text-dark;
  }

  p {
    @include sectionDescription;
  }

  .closeBtn {
    position: absolute;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #374151;

    &:hover {
      color: $text-dark;
    }
  }
}

/* ===============================
   Form
=============================== */
.modalForm {
  display: flex;
  flex-direction: column;
  gap: 1rem;

  .formGroup {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;

    label {
      font-weight: 600;
      font-size: 0.85rem;
      color: $text-dark;
    }

    input,
    select,
    textarea {
      padding: 0.6rem 0.8rem;
      border-radius: 8px;
      border: 1px solid #D1D5DB;
      font-size: 0.9rem;
      background: #fff;
      color: $text-dark;

      &:focus {
        outline: none;
        border: 2px solid $green;
        outline: 1px solid $green;
        outline-offset: 2px;
        box-shadow: 0 0 6px rgba($green, 0.4);
      }
    }

    textarea {
      min-height: 100px;
      resize: none;
    }

    small.error {
      color: #DC2626;
      font-size: 0.75rem;
    }
  }

  .submitBtn {
    margin-top: 0.5rem;
    background: $green;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;

    &:hover {
      background: $text-dark;
    }

    &:disabled {
      background: lighten($green, 25%);
      cursor: not-allowed;
    }
  }
}

/* ===============================
   Responsive
=============================== */
@media (max-width: 600px) {
  .modalContent {
    padding: 1.5rem;
    max-width: 95%;
    max-height: 95vh;
  }
}