/* ═══════════════════════════════════════════
   ARCHIVE JOBS PAGE — archive-jobs.css
═══════════════════════════════════════════ */

/* ─────────────────────────────────────────
   PAGE WRAPPER
───────────────────────────────────────── */
.jobs-archive-page {
  padding-bottom: var(--space-20);
  min-height: 80vh;
}

.jobs-archive-page .container {
  padding-top: var(--space-8);
}

.archive-page-heading {
  font-size: clamp(var(--text-xl), 3vw, var(--text-2xl));
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}

.archive-page-sub {
  font-size: var(--text-sm);
  color: var(--ink-4);
  margin: var(--space-1) 0 0;
}

/* ─────────────────────────────────────────
   MOBILE TOP BAR (heading + filter toggle)
───────────────────────────────────────── */
.archive-mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.archive-mobile-bar .archive-page-heading {
  font-size: var(--text-xl);
}

.filter-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-toggle-btn:hover {
  border-color: var(--tc);
  color: var(--tc);
  background: var(--tc-soft);
}

.filter-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--tc);
  color: #fff;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ─────────────────────────────────────────
   TWO-COLUMN LAYOUT
───────────────────────────────────────── */
.jobs-archive-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-8);
  align-items: start;
}

/* ─────────────────────────────────────────
   FILTER SIDEBAR
───────────────────────────────────────── */
.filter-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  max-height: calc(100vh - var(--header-h) - var(--space-10));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-l);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.filter-sidebar::-webkit-scrollbar { width: 4px; }
.filter-sidebar::-webkit-scrollbar-track { background: transparent; }
.filter-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.clear-all-btn {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--tc);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.15s;
}
.clear-all-btn:hover { opacity: 0.7; }
.clear-all-btn:disabled { color: var(--ink-4); text-decoration: none; cursor: default; }

/* Filter section blocks */
.filter-block {
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.filter-block:last-of-type { border-bottom: none; }

.filter-block-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-4);
  margin: 0 0 var(--space-4);
}

/* Keyword search */
.filter-search-wrap {
  position: relative;
}

.filter-search-input {
  width: 100%;
  padding: 0.5625rem 2.25rem 0.5625rem 0.875rem;
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.filter-search-input::placeholder { color: var(--ink-4); }

.filter-search-input:focus {
  border-color: var(--tc);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(224,92,42,0.10);
}

.filter-search-clear {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  border-radius: var(--r-xs);
  padding: 0;
  transition: color 0.15s;
}

.filter-search-clear:hover { color: var(--ink); }
.filter-search-input:not(:placeholder-shown) ~ .filter-search-clear { display: flex; }

/* Checkbox lists */
.filter-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: 2px 0;
}

.filter-checkbox-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--tc);
  flex-shrink: 0;
}

.filter-checkbox-label {
  font-size: var(--text-sm);
  color: var(--ink-2);
  flex: 1;
  line-height: 1.3;
  user-select: none;
}

.filter-checkbox-count {
  font-size: var(--text-xs);
  color: var(--ink-4);
  margin-left: auto;
  flex-shrink: 0;
}

.filter-checkbox-item:hover .filter-checkbox-label { color: var(--tc); }

/* "Show more / less" toggle */
.filter-show-more {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--tc);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  transition: opacity 0.15s;
}
.filter-show-more:hover { opacity: 0.75; }

/* Radio buttons (experience) */
.filter-radio-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-radio-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: 2px 0;
}

.filter-radio-item input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--tc);
  flex-shrink: 0;
}

.filter-radio-label {
  font-size: var(--text-sm);
  color: var(--ink-2);
  user-select: none;
  line-height: 1.3;
}

.filter-radio-item:hover .filter-radio-label { color: var(--tc); }

/* Pill toggles (job type, work mode) */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.filter-pill {
  padding: 0.3rem 0.75rem;
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-3);
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
  white-space: nowrap;
}

.filter-pill:hover {
  border-color: var(--tc);
  color: var(--tc);
  background: var(--tc-soft);
}

.filter-pill.active {
  background: var(--tc);
  border-color: var(--tc);
  color: #fff;
}

/* ─────────────────────────────────────────
   SALARY RANGE SLIDER
───────────────────────────────────────── */
.salary-values {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: var(--space-4);
}

.salary-values span { color: var(--tc); }

.salary-slider-wrap {
  position: relative;
  height: 28px;
  margin: 0 2px;
}

.salary-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  transform: translateY(-50%);
}

.salary-range-fill {
  position: absolute;
  height: 4px;
  background: var(--tc);
  border-radius: 2px;
  top: 0;
}

.salary-handle {
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  outline: none;
}

.salary-handle::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tc);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.1s;
}

.salary-handle::-webkit-slider-thumb:hover,
.salary-handle:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

.salary-handle::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tc);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  cursor: pointer;
  pointer-events: all;
}

/* ─────────────────────────────────────────
   MAIN CONTENT AREA
───────────────────────────────────────── */
.jobs-main { min-width: 0; }

/* Desktop heading */
.archive-heading-wrap {
  margin-bottom: var(--space-5);
}

/* Top bar */
.jobs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.jobs-count-text {
  font-size: var(--text-sm);
  color: var(--ink-3);
  margin: 0;
}

.jobs-count-num {
  font-weight: 700;
  color: var(--ink);
}

.jobs-sort-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sort-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-4);
  white-space: nowrap;
}

.jobs-sort-select {
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-s);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238A8A8A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  outline: none;
  transition: border-color 0.15s;
}
.jobs-sort-select:focus { border-color: var(--tc); }

/* ─────────────────────────────────────────
   JOBS GRID
───────────────────────────────────────── */
.jobs-results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  min-height: 300px;
  position: relative;
  transition: opacity 0.2s;
}

.jobs-results-grid.is-loading {
  opacity: 0.35;
  pointer-events: none;
}

/* ─────────────────────────────────────────
   SKELETON CARDS
───────────────────────────────────────── */
@keyframes skeleton-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--r-l);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.skel {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--border) 50%, var(--bg-2) 75%);
  background-size: 400px 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.skel-avatar  { width: 44px; height: 44px; border-radius: var(--r-m); }
.skel-title   { height: 16px; width: 75%; }
.skel-sub     { height: 13px; width: 50%; }
.skel-meta    { height: 11px; width: 40%; }
.skel-footer  { height: 32px; border-radius: var(--r-pill); }

/* ─────────────────────────────────────────
   LOAD MORE
───────────────────────────────────────── */
.load-more-wrap {
  text-align: center;
  margin-top: var(--space-10);
}

.load-more-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.75rem 2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.load-more-btn:hover {
  border-color: var(--tc);
  color: var(--tc);
  background: var(--tc-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-m);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.load-more-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--tc);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.load-more-btn.is-loading .spinner { display: block; }
.load-more-btn.is-loading .btn-label { display: none; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Drawer close button — desktop hidden, mobile shown */
.drawer-close-elem {
  display: none;
}

/* ─────────────────────────────────────────
   MOBILE FILTER DRAWER (bottom sheet)
───────────────────────────────────────── */
.filter-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.25s;
}

.filter-overlay.active {
  display: block;
  opacity: 1;
}

/* On mobile the sidebar becomes a bottom drawer */
@media (max-width: 900px) {

  .archive-mobile-bar {
    display: flex;
  }

  .jobs-archive-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .filter-sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    max-height: 85vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-bottom: none;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));

    /* override sticky */
    top: auto;
    overflow-y: auto;
  }

  .filter-sidebar.drawer-open {
    transform: translateY(0);
  }

  /* Show close button inside open drawer */
  .drawer-close-elem {
    display: flex;
  }

  /* Drag handle */
  .filter-sidebar::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto var(--space-5);
    flex-shrink: 0;
  }

  /* Sticky apply/clear footer inside drawer */
  .sidebar-drawer-footer {
    display: flex !important;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    margin: var(--space-4) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  }

  /* Archive page heading hidden on mobile (shown in mobile bar) */
  .archive-heading-wrap { display: none; }
}

.sidebar-drawer-footer {
  display: none; /* shown only on mobile via media query above */
}

/* ─────────────────────────────────────────
   RESPONSIVE GRID
───────────────────────────────────────── */
@media (max-width: 1100px) {
  .jobs-archive-layout { grid-template-columns: 260px 1fr; gap: var(--space-6); }
}

@media (max-width: 900px) {
  .jobs-results-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .jobs-results-grid { grid-template-columns: 1fr; }
  .jobs-topbar { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
}

/* ─────────────────────────────────────────
   MOBILE SIDEBAR — FULL-SCREEN DRAWER
   Renders as an overlay drawer below 768px.
   The toggle button, overlay, and close button
   are already in the HTML — this wires the CSS.
───────────────────────────────────────── */
@media (max-width: 767px) {

  /* Drawer base — positioned off-screen left */
  .filter-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0;
    width: min(320px, 90vw);
    max-height: 100dvh;
    overflow-y: auto;
    background: var(--bg);
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s ease;
    box-shadow: none;
    padding: 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
  }

  /* Drawer open state (JS adds .drawer-open) */
  .filter-sidebar.drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 32px rgba(0, 0, 0, 0.15);
  }

  /* Overlay — covers the content behind the drawer */
  .filter-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 1199;
    pointer-events: none;
    transition: background 0.3s ease;
  }
  /* JS adds .active class on open */
  .filter-overlay.active {
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;
  }

  /* Sidebar header inside drawer */
  .sidebar-header {
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  /* Filter content gets padding */
  .filter-sidebar .filter-block {
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Close button: always 44×44 touch target */
  .drawer-close-elem {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--r-s);
    background: var(--bg-2);
    border: 1px solid var(--border);
    cursor: pointer;
    flex-shrink: 0;
  }
  .drawer-close-elem:hover { background: var(--border); }

  /* Filter toggle button: 44px height */
  .filter-toggle-btn {
    min-height: 44px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--r-s);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--ink-2);
    cursor: pointer;
    font-family: var(--font-sans);
  }
  .filter-toggle-btn:hover { border-color: var(--ink-3); }

  /* Sticky Apply/Clear footer at bottom of drawer */
  .sidebar-drawer-footer {
    display: flex !important;
    position: sticky;
    bottom: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    gap: 12px;
    z-index: 2;
    margin-top: auto;
  }
  .sidebar-drawer-footer .btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  /* Mobile archive bar: space between heading and filter button */
  .archive-mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
  }

  /* Job sort: full width on very small screens */
  .jobs-sort-wrap { width: 100%; }
  .jobs-sort-select { width: 100%; }
}

/* ─────────────────────────────────────────
   MOBILE — TOUCH TARGET AUDIT
   All interactive archive elements ≥ 44px
───────────────────────────────────────── */
.load-more-btn  { min-height: 44px; }
.filter-pill    { min-height: 44px; }
.filter-checkbox-item,
.filter-radio-item {
  min-height: 44px;
  display: flex;
  align-items: center;
}
.clear-all-btn  { min-height: 44px; }
.filter-show-more { min-height: 44px; }

/* ─────────────────────────────────────────
   LAZY LOADING — JOB CARD IMAGES
───────────────────────────────────────── */
.job-card-logo img,
.job-card img {
  loading: lazy; /* Fallback hint — actual attr set in PHP render */
}

/* ─────────────────────────────────────────
   SMALL PHONE FIXES (320–374px)
───────────────────────────────────────── */
@media (max-width: 374px) {
  .archive-page-heading { font-size: var(--text-lg); }
  .archive-page-sub     { font-size: var(--text-xs); }
  .jobs-count-text      { font-size: var(--text-xs); }
  .job-card             { padding: var(--space-4); }
  .jobs-results-grid    { gap: var(--space-3); }
}
