/* ==========================================================
   Aplify – Search Form & Job Cards
   Tokens defined in aplify-tokens.css (scoped to :root)
   ========================================================== */

/* -----------------------------
   SEARCH FORM LAYOUT
--------------------------------*/

.aplify-search-form {
  display: grid;
  gap: var(--form-gap);
  padding: var(--panel-padding-top)
           var(--panel-padding-right)
           var(--panel-padding-bottom)
           var(--panel-padding-left);
  background: var(--bg);
  border-radius: var(--panel-radius);
  margin: 0 auto;
  font-family: var(--font-family);
  font-size: var(--font-size);
}

.aplify-form-group {
  display: grid;
  gap: var(--group-gap);
  min-width: 0;
  margin-bottom: 0;
}

.aplify-form-group label {
  display: var(--label-display);
  font-weight: var(--label-weight);
  font-size: var(--label-size);
  color: var(--label-color);
  margin-bottom: 0;
}

@media (min-width: 900px) {
  .aplify-search-form {
    grid-template-columns:
      repeat(var(--field-count, 2), minmax(0, 1fr))
      minmax(120px, max-content);
    align-items: end;
  }
}

/* -----------------------------
   INPUTS + SELECTS
--------------------------------*/

.aplify-form-group input,
.aplify-form-group select,
.aplify-search-form input[type="text"],
.aplify-search-form select {
  appearance: none;
  width: 100%;
  height: var(--field-h);
  padding: 0 14px;
  border: var(--field-border-w) solid var(--field-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--fg);
  box-shadow: var(--control-shadow);
  box-sizing: border-box;
  font-family: var(--font-family);
  font-size: var(--font-size);
  transition: border-color .2s, box-shadow .2s;
}

.aplify-form-group input:focus,
.aplify-form-group select:focus,
.aplify-search-form input[type="text"]:focus,
.aplify-search-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgb(from var(--primary) r g b / 0.15);
}

/* Placeholder */
.aplify-form-group input::placeholder,
.aplify-search-form input[type="text"]::placeholder {
  color: var(--placeholder-color);
  opacity: var(--placeholder-opacity);
}

/* -----------------------------
   LOCATION AUTOCOMPLETE
--------------------------------*/

.aplify-location-autocomplete .location-input-wrapper {
  position: relative;
}

.location-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--input-bg);
  border: var(--field-border-w) solid var(--field-border);
  border-top: none;
  max-height: var(--menu-max-height);
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--panel-shadow);
  border-radius: 10px;
}

.suggestion-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid var(--panel-border);
  color: var(--fg);
  font-family: var(--font-family);
  font-size: var(--font-size);
  transition: background-color .2s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover {
  background-color: var(--dropdown-hover);
}

.suggestion-item:active {
  background-color: var(--bg);
}

.suggestion-loading {
  padding: 15px;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-family);
}

/* -----------------------------
   SEARCH BUTTON
--------------------------------*/

.aplify-search-form button[data-testid="search-button"] {
  height: var(--field-h);
  padding: 0 22px;
  border: none;
  border-radius: var(--btn-radius);
  background: var(--highlight);
  color: #fff;
  font-weight: var(--button-weight);
  font-family: var(--font-family);
  font-size: var(--font-size);
  text-transform: var(--btn-text-transform);
  box-shadow: var(--button-shadow);
  cursor: pointer;
  transition: background .2s, box-shadow .2s, transform .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hover */
.aplify-search-form button[data-testid="search-button"]:hover {
  background: var(--primary-hover);
  box-shadow: var(--button-shadow-hover);
  transform: translateY(-1px);
}

/* Active */
.aplify-search-form button[data-testid="search-button"]:active {
  background: var(--primary);
  transform: translateY(0);
}

/* -----------------------------
   USE MY LOCATION BUTTON
--------------------------------*/

.aplify-location-autocomplete .use-my-location-btn {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);

  display: inline-flex;
  align-items: center;
  gap: 6px;

  background: none !important;   
  border: none;
  outline: none;

  color: var(--muted);
  font-size: 0.65rem !important;
  font-weight: 400;
  font-family: var(--font-family);

  cursor: pointer;
  padding: 0;
  line-height: 1;

  transition: color .2s ease;
}

/* Hover */
.aplify-location-autocomplete .use-my-location-btn:hover {
  color: var(--primary);
}

/* Active state */
.aplify-location-autocomplete .use-my-location-btn.active {
  color: var(--highlight);
  font-weight: 600;
}

/* Icon before text */
.aplify-location-autocomplete .use-my-location-btn::before {
  content: "";
  flex-shrink: 0;
  width: 14px;
  height: 14px;

  background-color: currentColor;
  transition: background-color .2s ease; /* 🔥 smooth */

  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8 2 5 5 5 9c0 5 7 13 7 13s7-8 7-13c0-4-3-7-7-7z' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='9' r='2.5' fill='none' stroke='black' stroke-width='2'/></svg>") no-repeat center / contain;

          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 2C8 2 5 5 5 9c0 5 7 13 7 13s7-8 7-13c0-4-3-7-7-7z' fill='none' stroke='black' stroke-width='2'/><circle cx='12' cy='9' r='2.5' fill='none' stroke='black' stroke-width='2'/></svg>") no-repeat center / contain;
}

/* =========================================
   APLIFY SELECTIFY STYLING
========================================= */

.aplify-search-form .selectify {
  position: relative;
  width: 100%;
}

/* Hide original select */
.aplify-search-form .selectify > select {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

/* Trigger button (styled like input, not CTA) */
.aplify-search-form .selectify__button {
  position: relative;
  width: 100%;
  height: var(--field-h);
  padding: 0 42px 0 14px;
  border: var(--field-border-w) solid var(--field-border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--fg);
  font-family: var(--font-family);
  font-size: var(--font-size);
  text-align: left;
  box-shadow: var(--control-shadow);
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

/* Kill theme hover/focus overrides */
.aplify-search-form .selectify__button:hover,
.aplify-search-form .selectify__button:focus,
.aplify-search-form .selectify__button:active,
.aplify-search-form .selectify__button:focus-visible {
  outline: none;
  background: var(--input-bg);
  color: var(--fg);
  border-color: var(--field-border);
  box-shadow: var(--control-shadow);
}

/* When dropdown is open */
.aplify-search-form .selectify[aria-expanded="true"] .selectify__button {
  border-color: var(--primary);
}

/* Chevron (uses currentColor so it always matches text) */
.aplify-search-form .selectify__button::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-size: contain;
  background-repeat: no-repeat;
}

/* Dropdown panel */
.aplify-search-form .selectify__list {
  position: absolute;
  z-index: 9999;
  left: 0;
  width: 100%;
  margin-top: 6px;
  background: var(--input-bg);
  border: 1px solid var(--field-border);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  padding: 6px;
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

/* Open state */
.aplify-search-form .selectify[aria-expanded="true"] .selectify__list {
  display: block;
}

/* Options */
.aplify-search-form .selectify__option {
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--font-family);
  font-size: var(--font-size);
  color: var(--fg);
  transition: background .15s ease;
}

/* Hover */
.aplify-search-form .selectify__option:hover,
.aplify-search-form .selectify__option[data-highlighted="true"] {
  background: rgb(from var(--primary) r g b / 0.08);
}

/* Selected */
.aplify-search-form .selectify__option[aria-selected="true"] {
  background: rgb(from var(--highlight) r g b / 0.12);
  font-weight: 600;
}
/* ==========================================================
   JOB LIST GRID
   ========================================================== */

.aplify-job-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--tiles-gap);
  margin-top: clamp(16px, 3vw, 24px);
}

.aplify-job-list {
    transition: opacity 250ms ease-out, transform 250ms ease-out;
    opacity: 1;
    transform: translateY(0);
}

.aplify-job-list.is-loading {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}


@media (prefers-reduced-motion: reduce) {
    .aplify-job-list,
    .aplify-job-list.is-loading {
        transition: none;
        transform: none;
    }
}

@media (max-width: 1024px) {
  .aplify-job-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .aplify-job-list {
    grid-template-columns: 1fr;
    padding: 0;
  }
}

/* ==========================================================
   JOB CARD
   ========================================================== */

.aplify-job-card {
  display: flex;
  flex-direction: column;
  border: var(--panel-border-w) solid var(--panel-border);
  border-radius: 16px;
  background: var(--input-bg);
  padding: clamp(16px, 1.6vw, 24px) clamp(20px, 2vw, 32px);
  box-shadow: var(--panel-shadow);
  position: relative;
  transition: box-shadow .2s, transform .2s;
}

.aplify-job-card:hover {
  box-shadow: 0 12px 32px rgba(2, 6, 23, .10);
  transform: translateY(-1px);
}

.job-card-header {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.job-title-link {
  color: var(--primary);
  font-size: clamp(1rem, 0.95rem + .2vw, 1.2rem)!important;
  font-weight: 700;
  text-decoration: none;
  margin-bottom: 2px;
  display: inline-block;
  font-family: var(--font-family);
}

.job-title-link:hover {
  text-decoration: underline;
}

.job-company-location {
  color: var(--fg);
  font-size: 1rem;
  margin-top: 2px;
  font-family: var(--font-family);
}

.job-company {
  font-weight: 700;
  display: none;
}

.job-location,
.job-region,
.job-distance {
  color: var(--muted);
  font-weight: 400;
	font-size: 1rem;
}

.job-distance {
  color: var(--brand-option-clr);
  font-size: .95em;
  margin-left: 2px;
	font-weight: 600;
}

.job-salary-cta {
  min-width: 220px;
}

.job-salary {
  color: var(--highlight);
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 4px;
  font-family: var(--font-family);
	line-height: 1.2em;
}

.job-card-meta {
  margin: 8px 0;
}

.job-category-badge {
  background: rgb(from var(--primary) r g b / 0.08);
  color: var(--primary);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: .7rem;
  font-weight: 500;
  margin-right: 8px;
  display: inline-block;
  font-family: var(--font-family);
}

.job-hours-badge {
  background: #e5e7eb;
  color: var(--fg);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .7rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-family);
}

.job-card-desc {
  color: var(--fg);
  font-size: 0.8rem;
  margin-bottom: 16px;
  margin-top: 15px;
  line-height: 1.5;
  width: 100%;
  text-overflow: ellipsis;
  font-family: var(--font-family);
}

.job-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 16px;
}

.job-closing-date {
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--font-family);
}

.job-apply-btn {
  color: #fff;
  border: none;
  background: var(--primary);
  border-radius: var(--radius);
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: var(--button-weight);
  font-family: var(--font-family);
  text-decoration: none;
  box-shadow: var(--button-shadow);
  transition: background .15s, box-shadow .15s;
  cursor: pointer;
  display: inline-block;
}

.job-apply-btn:hover {
  background: var(--primary-hover);
  box-shadow: var(--button-shadow-hover);
  color: #fff;
}

/* ==========================================================
   PAGINATION
   ========================================================== */

.aplify-pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 60px;
}

.aplify-pagination button {
  border: 1px solid var(--panel-border);
  background: var(--input-bg);
  color: var(--primary);
  border-radius: 12px;
  padding: 10px 18px!important;
  font-size: .95rem;
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s, border-color .2s;
}

.aplify-pagination button:hover:not(:disabled),
.aplify-pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(0, 89, 148, .25);
}

.aplify-pagination button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ==========================================================
   JOB COUNT / STATUS STATES
   ========================================================== */

.job-count,
.aplify-loading,
.aplify-no-results {
  display: block;
  width: 100%;
  margin: 30px auto 0;
  text-align: center;
  color: var(--fg);
  font-weight: 500;
  font-family: var(--font-family);
}
.aplify-no-results {
     background: rgb(from var(--primary) r g b / 0.08);
    padding: 20px;
    border-radius: var(--panel-radius);
	max-width: 500px;
    margin-top: 10px;
}

/* -----------------------------
   JOB TITLE / COMPANY WRAPPER
--------------------------------*/

.job-title-company {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 600px) {
  .aplify-search-form {
    padding: 20px 20px;
  }

  .aplify-form-group input,
  .aplify-form-group select {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}
