/* ---------- Generic utility used by JS ---------- */
.hidden {
  display: none !important;
}

/* ---------- Floating "Apply for Loan" button ---------- */
#openModal {
  position: fixed;
  bottom: 5rem;               /* keep some space above scroll-to-top */
  right: 1.5rem;
  z-index: 1000;
  
  background: #2563eb;        /* blue */
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;

  display: flex;
  align-items: center;
  gap: 0.5rem;

  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

#openModal i {
  font-size: 1rem;
}

#openModal:hover {
  background: #1d4ed8;
}

/* On very small screens, hide text and keep only icon */
@media (max-width: 640px) {
  #openModal span {
    display: none;
  }
}

/* ---------- Modal overlay (dark background) ---------- */
#modalOverlay {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0 */
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
}

/* ---------- Modal container ---------- */
#loanModal {
  position: fixed;
  inset: 0;
  z-index: 950;

  display: flex;              /* will be hidden by .hidden class until opened */
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

/* ---------- Modal inner box ---------- */
#loanModal > div {
  background: #ffffff;
  border-radius: 0.75rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);

  width: 95%;
  max-width: 780px;           /* wider than Tailwind max-w-md */
  position: relative;

  padding: 1.5rem 1.75rem;
  animation: fadeIn 0.2s ease-out;
}

/* ---------- Close button (X) ---------- */
#closeModal {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 1.1rem;
  cursor: pointer;
}

#closeModal:hover {
  color: #ef4444;
}

/* ---------- Heading ---------- */
#loanModal h2 {
  margin: 0 0 1rem;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: #1d4ed8;
}

/* ---------- Form layout ---------- */
#loanForm {
  margin-top: 0.5rem;
}

/* mimic "grid grid-cols-1 sm:grid-cols-2 gap-4" */
#loanForm .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  #loanForm .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Inputs & selects ---------- */
#loanForm .input {
  display: block;
  width: 100%;
  box-sizing: border-box;

  padding: 0.6rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #d1d5db;

  background-color: #ffffff;
  color: #111827;
  font-size: 0.9rem;

  outline: none;
  transition: border-color 0.15s ease,
              box-shadow 0.15s ease,
              background-color 0.15s ease;
}

#loanForm .input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

#loanForm .input::placeholder {
  color: #9ca3af;
}

/* Force text visible even if some global CSS makes inputs white */
#loanForm input,
#loanForm select,
#loanForm textarea {
  color: #111827 !important;
  background-color: #ffffff !important;
}

/* ---------- Error messages under fields ---------- */
#loanForm .error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #dc2626;
}

/* ---------- Submit button ---------- */
#loanForm button[type="submit"] {
  margin-top: 1rem;
  width: 100%;
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;

  background: #1d4ed8;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

#loanForm button[type="submit"]:hover {
  background: #1e40af;
}

/* ---------- Small note text ---------- */
#loanForm p {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
}

/* ---------- Fade-in animation ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
