/*
 * Job portal - Screen 1 (job listing) and Screen 2 (job details).
 * Additive polish only. Every rule is scoped to .jobsListingPage / .jobDetailsPage and uses the
 * existing theme variables from web-style.css (--theme-secondary, --border-color, --text-muted ...).
 *
 * Motion (two effects only):
 *   1. Card hover   - translateY(-4px) + light shadow, 220ms
 *   2. Screen entrance - fade-in + 10px upward slide, 300ms
 * Both are disabled under prefers-reduced-motion.
 */

/* ───────────── Animation 2: screen entrance ───────────── */
@keyframes jpScreenEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* "backwards" applies the start state only before the animation runs; afterwards the normal
   styles apply again, so the hover transform below is never blocked and nothing shifts. */
.jobsListingPage .left-col,
.jobsListingPage .jp-results,
.jobDetailsPage .jp-enter {
  animation: jpScreenEnter 300ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}

/* ───────────── Screen 1: search bar ───────────── */
.jobsListingPage .jp-searchbar {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  padding: 10px;
  margin-bottom: 20px;
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.jobsListingPage .jp-field {
  position: relative;
  display: block;
  margin: 0;
}

.jobsListingPage .jp-field i {
  position: absolute;
  top: 50%;
  left: 13px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.jobsListingPage .jp-field input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 38px;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.jobsListingPage .jp-field input:focus {
  outline: none;
  border-color: var(--theme-secondary);
  box-shadow: 0 0 0 3px rgba(var(--primary-blue-rgb), 0.15);
}

.jobsListingPage .jp-searchbar button[type="submit"] {
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  background: var(--theme-secondary);
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.2s;
}

.jobsListingPage .jp-searchbar button[type="submit"]:hover {
  filter: brightness(0.92);
}

.jobsListingPage .jp-searchbar button[type="submit"]:focus-visible,
.jobDetailsPage .btn-apply:focus-visible,
.jobsListingPage .btn-apply:focus-visible,
.jobDetailsPage .jp-back:focus-visible {
  outline: 2px solid var(--theme-secondary);
  outline-offset: 2px;
}

/* ───────────── Screen 1: result bar + job cards ───────────── */
.jobsListingPage .result-bar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 10px;
}

.jobsListingPage .sort-wrap select {
  min-height: 34px;
  border-radius: var(--radius-sm);
  border-color: var(--border-color);
}

.jobsListingPage .jp-results .job-card-items {
  padding: 18px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  /* Animation 1: hover */
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

@media (hover: hover) {

  .jobsListingPage .jp-results .job-card-items:hover,
  .jobsListingPage .jp-results .job-card-items:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
    border-color: #d3dcee;
  }

  .jobsListingPage .jp-results .job-card-items.jp-empty:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
    border-color: var(--border-color);
  }
}

.jobsListingPage .job-title-link {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.jobsListingPage .job-title-link:focus-visible {
  outline: 2px solid var(--theme-secondary);
  outline-offset: 2px;
  border-radius: 2px;
}

.jobsListingPage .company-name {
  font-size: 13px;
  color: var(--text-dark);
}

.jobsListingPage .meta-row {
  gap: 6px 0;
  margin-top: 10px;
}

.jobsListingPage .meta-item--type {
  padding: 2px 10px;
  font-weight: 600;
  color: var(--theme-secondary);
  background: rgba(var(--primary-blue-rgb), 0.08);
  border-radius: 999px;
}

.jobsListingPage .desc-row {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 10px;
  line-height: 1.55;
}

.jobsListingPage .skills-row {
  margin-top: 10px;
}

.jobsListingPage .jp-results .bottom-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #eef1f6;
}

.jobsListingPage .btn-apply {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  transition: background 0.2s, color 0.2s, transform 0.12s;
}

.jobsListingPage .btn-apply:active {
  transform: translateY(1px);
}

/* ───────────── Screen 1: loading, empty and message states ───────────── */
.jobsListingPage .jp-loading-note {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.jobsListingPage .jp-loading-note[hidden] {
  display: none;
}

.jobsListingPage.is-loading .jp-results .job-card-items,
.jobsListingPage.is-loading .jp-results .pag-wrap {
  opacity: 0.55;
  pointer-events: none;
}

.jobsListingPage .jp-empty .jp-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.jp-flash {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.jp-flash--error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.jp-flash--warning {
  color: #92400e;
  background: #fffbeb;
  border-color: #fde68a;
}

.jp-flash--info {
  color: #1e40af;
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* ───────────── Screen 2: job details ───────────── */
.jobDetailsPage .jp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--theme-secondary);
  text-decoration: none;
}

.jobDetailsPage .jp-back:hover {
  text-decoration: underline;
}

.jobDetailsPage .card {
  border: 1px solid var(--border-color);
}

.jobDetailsPage .card-body {
  padding: 18px 20px;
}

.jobDetailsPage .jp-job-title {
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.jobDetailsPage .jp-company {
  font-size: 15px;
}

/* Key facts shown as light chips instead of a pipe-separated line */
.jobDetailsPage .jp-meta {
  gap: 8px;
}

.jobDetailsPage .jp-meta .job-meta-separator {
  display: none;
}

.jobDetailsPage .jp-meta>span:not(.job-meta-separator) {
  padding: 4px 12px;
  font-size: 13px;
  color: #374151;
  background: #f3f6fb;
  border-radius: 999px;
}

.jobDetailsPage .jp-meta>span.jp-meta--type {
  font-weight: 600;
  color: var(--theme-secondary);
  background: rgba(var(--primary-blue-rgb), 0.08);
}

.jobDetailsPage h2.h6 {
  font-size: 16px;
}

/* Long descriptions stay readable */
.jobDetailsPage .card-body .text-dark p {
  max-width: 80ch;
  font-size: 14.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

/* Apply Now: one clear primary action, with light hover / press feedback */
.jobDetailsPage .btn-apply:not(.disabled) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 30px;
  font-size: 14px;
  color: var(--white) !important;
  background: var(--theme-secondary) !important;
  transition: filter 0.2s, transform 0.12s, box-shadow 0.2s;
}

.jobDetailsPage .btn-apply:not(.disabled):hover {
  filter: brightness(0.92);
  box-shadow: 0 4px 12px rgba(var(--primary-blue-rgb), 0.25);
}

.jobDetailsPage .btn-apply:not(.disabled):active {
  transform: translateY(1px) scale(0.98);
  box-shadow: none;
}

.jobDetailsPage .btn-apply.disabled {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 24px;
  color: var(--text-muted);
  border-color: var(--border-color);
  cursor: not-allowed;
}

/* ───────────── Responsive ───────────── */
@media (max-width: 991px) {
  .jobDetailsPage .jp-sidebar-col {
    margin-top: 0;
  }
}

@media (max-width: 767px) {
  .jobsListingPage .jp-searchbar {
    grid-template-columns: 1fr;
  }

  .jobsListingPage .jp-searchbar button[type="submit"] {
    width: 100%;
  }

  .jobsListingPage .jp-results .job-card-items {
    padding: 14px 14px;
  }

  .jobsListingPage .jp-results .bottom-row>.d-flex {
    width: 100%;
  }

  .jobsListingPage .jp-results .bottom-row .btn-apply {
    flex: 1 1 auto;
  }

  .jobDetailsPage .card-body {
    padding: 14px;
  }

  .jobDetailsPage .jp-header-row {
    flex-wrap: wrap;
    gap: 12px;
  }

  .jobDetailsPage .jp-apply-row>.btn-apply,
  .jobDetailsPage .jp-apply-row>span.btn-apply {
    width: 100%;
  }
}

/* ───────────── Reduced motion ───────────── */
@media (prefers-reduced-motion: reduce) {

  .jobsListingPage .left-col,
  .jobsListingPage .jp-results,
  .jobDetailsPage .jp-enter {
    animation: none;
  }

  .jobsListingPage .jp-results .job-card-items,
  .jobsListingPage .btn-apply,
  .jobDetailsPage .btn-apply,
  .jobsListingPage .jp-searchbar button[type="submit"],
  .jobsListingPage .jp-field input {
    transition: none;
  }

  .jobsListingPage .jp-results .job-card-items:hover,
  .jobsListingPage .jp-results .job-card-items:focus-within,
  .jobDetailsPage .btn-apply:not(.disabled):active,
  .jobsListingPage .btn-apply:active {
    transform: none;
  }
}
