/* =========================================================
   PESO JOB MODALS
========================================================= */
body.job-modal-open { overflow: hidden; }

.job-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 11000;
  padding: 24px;
  align-items: center;
  justify-content: center;
  background: rgba(13, 42, 24, .55);
  backdrop-filter: blur(5px);
}
.job-modal-overlay.show { display: flex; }

/* Keep the public homepage details dialog centered in the browser viewport.
   The ID selector and hard height cap also protect it from page-level styles. */
#jobDetailsModal.job-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  display: none;
  box-sizing: border-box !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 24px !important;
  align-items: center !important;
  justify-content: center !important;
}
#jobDetailsModal.job-modal-overlay.show { display: flex !important; }
#jobDetailsModal .job-modal-shell {
  width: min(920px, 100%) !important;
  max-height: calc(100vh - 48px) !important;
  max-height: calc(100dvh - 48px) !important;
  margin: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.job-modal-shell {
  position: relative;
  box-sizing: border-box;
  flex: 0 1 auto;
  margin: auto;
  width: min(920px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid #dfe9e2;
  border-radius: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,.24);
  animation: jobModalIn .18s ease-out;
}
.apply-job-modal-shell { width: min(560px, 100%); }

.job-modal-close {
  position: absolute;
  z-index: 5;
  top: 15px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  color: #31523f;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.job-modal-close:hover { background: #eaf3ed; }

.job-modal-content { min-height: 120px; }

.job-modal-loading,
.job-modal-error {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 35px;
  text-align: center;
  color: #65736b;
}
.job-modal-loading p { margin: 12px 0 0; }

.job-modal-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #dce9df;
  border-top-color: #2d8035;
  border-radius: 50%;
  animation: jobModalSpin .7s linear infinite;
}
.job-modal-error h3 { margin: 0 0 8px; color: #173d27; }
.job-modal-error p { margin: 0 0 20px; }

.modal-job-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 34px 38px;
  background: linear-gradient(135deg,#eaf7ee 0%,#f8fcf9 58%,#fff 100%);
  border-bottom: 1px solid #e2eee6;
}
.modal-job-icon {
  width: 70px;
  height: 70px;
  min-width: 70px;
  display: grid;
  place-items: center;
  background: #2d8035;
  border-radius: 19px;
  font-size: 31px;
  box-shadow: 0 9px 20px rgba(45,128,53,.2);
}
.modal-job-kicker {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.8px;
  color: #2d8035;
  margin-bottom: 5px;
}
.modal-job-heading h2 {
  margin: 0 0 7px;
  color: #123d24;
  font-size: 29px;
  line-height: 1.15;
}
.modal-job-heading p { margin: 0; color: #53635a; font-size: 15px; font-weight: 600; }

.modal-job-info-grid {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 12px;
  margin: 22px 28px 14px;
}
.modal-job-info {
  min-height: 82px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #f8fbf9;
  border: 1px solid #e2ebe5;
  border-radius: 14px;
}
.modal-job-info span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: #718078;
  font-weight: 800;
}
.modal-job-info strong { margin-top: 4px; color: #173d27; font-size: 13px; line-height: 1.35; }
.modal-job-info small { display: block; margin-top: 3px; color: #6d7c74; font-size: 10px; }

.modal-job-section {
  margin: 0 28px 13px;
  padding: 20px 23px;
  border: 1px solid #e3ebe6;
  border-radius: 16px;
}
.modal-job-section h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 11px;
  color: #185b35;
  font-size: 16px;
}
.modal-job-section h3:before {
  content: "";
  width: 4px;
  height: 19px;
  border-radius: 4px;
  background: #2d8035;
}
.modal-job-section p { margin: 0; color: #52615a; font-size: 14px; line-height: 1.7; }

.modal-job-actions,
.apply-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 28px 28px;
}
.modal-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-sizing: border-box;
}
.modal-btn.primary { background: #2d8035; color: #fff; border-color: #2d8035; }
.modal-btn.primary:hover { background: #246b2c; }
.modal-btn.secondary { background: #f0f4f1; color: #31523f; border-color: #d8e3dc; }
.modal-btn.secondary:hover { background: #e5eee8; }

.apply-modal-content { padding: 38px 34px 32px; text-align: center; }
.apply-modal-icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 15px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8f4ec;
  font-size: 29px;
}
.apply-modal-content h2 { margin: 0 0 9px; color: #173d27; font-size: 26px; }
.apply-question { margin: 0 auto 20px; color: #65736b; line-height: 1.5; }
.apply-job-box {
  text-align: left;
  padding: 16px;
  margin-bottom: 16px;
  background: #f7f9fa;
  border: 1px solid #e1e7eb;
  border-radius: 13px;
}
.apply-job-box strong { display: block; margin-bottom: 4px; color: #173d27; font-size: 19px; }
.apply-job-box span { color: #687581; }
.apply-note,
.apply-warning {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  text-align: left;
  font-size: 13px;
  line-height: 1.5;
}
.apply-note { background: #f3f8f4; border: 1px solid #cfe4d6; color: #31563e; }
.apply-warning { background: #fff8e8; border: 1px solid #f0d9a0; color: #765818; }
.apply-inline-form { display: contents; }
.apply-modal-actions { padding: 0; justify-content: stretch; }
.apply-modal-actions .modal-btn { flex: 1; }

@keyframes jobModalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes jobModalSpin { to { transform: rotate(360deg); } }

@media (max-width:760px) {
  .job-modal-overlay { padding: 12px; }
  .job-modal-shell {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 19px;
  }
  #jobDetailsModal.job-modal-overlay { padding: 12px !important; }
  #jobDetailsModal .job-modal-shell {
    max-height: calc(100vh - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }
  .modal-job-hero { padding: 25px 20px; gap: 13px; }
  .modal-job-icon { width: 56px; height: 56px; min-width: 56px; font-size: 24px; border-radius: 15px; }
  .modal-job-heading h2 { font-size: 22px; }
  .modal-job-info-grid { grid-template-columns: repeat(2,minmax(0,1fr)); margin: 17px 16px 12px; }
  .modal-job-section { margin: 0 16px 11px; padding: 17px; }
  .modal-job-actions { padding: 8px 16px 20px; }
  .apply-modal-content { padding: 30px 20px 25px; }
}
@media (max-width:430px) {
  .modal-job-info-grid { grid-template-columns: 1fr; }
  .modal-job-actions,
  .apply-modal-actions { flex-direction: column; }
  .modal-btn { width: 100%; }
}
