/*
 * Filename: archive-job.css
 * File path: css/archive-job.css
*/
/* ============================================================

   archive-job.css - Modern Job Archive

   Updated: Large Fonts & 80% Column Width

   ============================================================ */


@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  /* New gradient used for active filters button in JS */
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --star-color: #fbbf24;

  --success-color: #10b981;

  --bg-gradient: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

  --card-shadow-hover: 0 20px 40px rgba(99, 102, 241, 0.15);

  --glass-bg: rgba(255, 255, 255, 0.95);

  --border-radius: 14px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --header-bg: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.05) 0%,
    rgba(139, 92, 246, 0.05) 100%
  );

  /* Text Colors for Readability */

  --text-main: #111827; /* Near Black */

  --text-secondary: #374151; /* Dark Gray */

  --text-muted: #6b7280; /* Medium Gray */

  /* Buttons */
  --btn-primary: var(--primary-gradient);
  --btn-reset-color: var(--text-muted);
}

/* ============================================================
 * BASE STYLES & LAYOUT
 * ============================================================ */

.job-archive-main {
  background: var(--bg-gradient);

  padding: 20px 0;

  min-height: 80vh;

  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;

  color: var(--text-main);
}

.job-archive-main .archive-container {
  max-width: 1320px;

  margin: 0 auto;

  padding: 0 20px;
}

.job-archive-main .archive-header {
  margin-bottom: 6px;
}

.job-archive-main .archive-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 !important;
}

.job-archive-main .archive-header-content {
  flex: 1;
  text-align: left;
}

.job-archive-main .archive-title {
  font-size: 2.6rem !important;
  font-weight: 700;
  margin: 0;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding-left: 12px;
  letter-spacing: -0.5px;
}

.job-archive-main .archive-subtitle {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-secondary);
  text-align: left;
  padding-left: 12px;
  margin-top: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.job-archive-main .btn-add-job {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 25px;
  background: var(--primary-gradient);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
  margin-right: 5px;
}

.job-archive-main .btn-add-job svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.job-archive-main .btn-add-job:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.2);
  color: white;
}

/* Create Space Helper Styling */
.job-archive-main .create-space-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-left: 12px; /* Match title padding to align with content */
}

.job-archive-main .create-space-helper {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================================
 * JOB CARDS & GRID
 * ============================================================ */

.job-grid {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));

  gap: 28px;

  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.job-card-item {
  background: white;

  border-radius: var(--border-radius);

  box-shadow: var(--card-shadow);

  transition: var(--transition);

  overflow: hidden;

  border: 1px solid #e5e7eb;

  position: relative;
}

.job-card-item::before {
  content: "";

  position: absolute;

  top: 0;

  left: 0;

  right: 0;

  height: 3px;

  background: var(--primary-gradient);

  opacity: 0;

  transition: var(--transition);
}

.job-card-item:hover::before {
  opacity: 1;
}

.job-card-item:hover {
  transform: translateY(-6px);

  box-shadow: var(--card-shadow-hover);

  border-color: transparent;
}

.job-card-link {
  text-decoration: none;

  color: inherit;

  display: flex;

  flex-direction: column;
}

.card-avatar-wrapper {
  width: 100%;

  padding-top: 30px;

  display: flex;

  justify-content: center;

  background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
}

.card-avatar-img,
.card-avatar-placeholder {
  width: 105px;

  height: 105px;

  border-radius: 50%;

  border: 4px solid white;

  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);

  object-fit: cover;

  transition: var(--transition);
}

.job-card-item:hover .card-avatar-img,
.job-card-item:hover .card-avatar-placeholder {
  transform: scale(1.05);

  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.2);
}

.card-avatar-placeholder {
  background: var(--primary-gradient);

  color: white;

  display: flex;

  align-items: center;

  justify-content: center;

  font-size: 2rem;

  font-weight: 800;
}

.card-info {
  padding: 20px;

  text-align: center;

  display: flex;

  flex-direction: column;

  align-items: center;
}

.card-name {
  font-size: 1.5rem;

  font-weight: 700;

  color: var(--text-main);

  margin: 8px 0 5px;
}

.card-rating {
  margin-bottom: 8px;

  font-size: 0.95rem;

  color: var(--star-color);

  font-weight: 600;
}

.card-location {
  display: flex;

  align-items: center;

  gap: 5px;

  font-size: 0.95rem;

  color: var(--text-muted);

  margin-bottom: 12px;
}

.card-location svg {
  width: 15px;

  height: 15px;

  stroke: #9ca3af;
}

.card-pills {
  margin-top: auto;

  display: flex;

  flex-wrap: wrap;

  justify-content: center;

  gap: 7px;
}

.mini-pill {
  font-size: 0.85rem;

  font-weight: 700;

  padding: 6px 12px;

  border-radius: 18px;

  text-transform: uppercase;

  letter-spacing: 0.3px;

  transition: var(--transition);
}

.mini-pill.exp {
  background: rgba(99, 102, 241, 0.1);

  color: #6366f1;

  border: 1px solid rgba(99, 102, 241, 0.2);
}

.mini-pill.job {
  background: rgba(16, 185, 129, 0.1);

  color: #059669;

  border: 1px solid rgba(16, 185, 129, 0.2);
}

.job-card-item:hover .mini-pill {
  transform: translateY(-2px);
}

/* --- PAGINATION & NO RESULTS --- */

.archive-pagination {
  margin-top: 45px;

  text-align: center;
}

.archive-pagination .page-numbers {
  display: inline-block;

  padding: 9px 15px;

  margin: 0 4px;

  background: white;

  border: 2px solid #e5e7eb;

  border-radius: 7px;

  text-decoration: none;

  color: var(--text-muted);

  font-weight: 600;

  transition: var(--transition);

  font-size: 0.9rem;
}

.archive-pagination .page-numbers:hover {
  background: #f9fafb;

  transform: translateY(-2px);
}

.archive-pagination .page-numbers.current {
  background: var(--primary-gradient);

  color: white;

  border-color: transparent;

  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.no-results {
  text-align: center;

  padding: 60px 20px;

  color: var(--text-muted);
}

.no-results h2 {
  font-size: 1.8rem;

  font-weight: 700;

  color: var(--text-secondary);

  margin-bottom: 10px;
}

.no-results a {
  color: #6366f1;

  text-decoration: none;

  font-weight: 600;
}

.no-results a:hover {
  text-decoration: underline;
}

/* --- NEW JOB CARD STYLES --- */

.card-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
}

.mini-pill.mode {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.mini-pill.salary {
  background: rgba(107, 114, 128, 0.1);
  color: #4b5563;
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.mini-pill.urgency {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.mini-pill.urgency.urgent {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.mini-pill.urgency.immediate-hire {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
  font-weight: 800;
}

/* ============================================================================
   FILTER UI (Replicated from Event/Space Archive)
   ============================================================================ */

.filter-space-wrapper {
  margin: 0 0 30px 0;
  padding: 14px 16px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e6e8ec;
  font-family: "Inter", sans-serif;
}

/* Top Bar */
.filter-space-wrapper .filter-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Filter Button */
.filter-space-wrapper .filter-toggle-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.filter-space-wrapper .filter-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

/* Scroll row */
.filter-space-wrapper .filter-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: scroll; /* Always show scrollbar */
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #6366f1 transparent; /* Firefox */
  padding-top: 4px;
}

/* Custom Horizontal Scrollbar */
.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar {
    height: 6px;
}

.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar-track {
    background: transparent;
}

.filter-space-wrapper .filter-scroll-row::-webkit-scrollbar-thumb {
    background-color: #6366f1; /* Primary color */
    border-radius: 4px;
}

.filter-col {
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Labels */
.filter-space-wrapper label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 4px;
}

/* Inputs (Material style) */
.filter-space-wrapper input[type="number"],
.filter-space-wrapper input[type="text"],
.filter-space-wrapper input[type="date"],
.filter-space-wrapper select {
  width: 100% !important;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  font-size: 0.95rem;
  background: #fff;
  transition: 0.25s ease;
  box-sizing: border-box;
  display: block;
}

.filter-space-wrapper input:focus,
.filter-space-wrapper select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

/* Create Space Helper */

.create-space-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center; /* Centered alignment */
}

.create-space-helper {
    font-size: 0.9rem; /* Increased size */
    font-weight: 500; /* Medium weight */
    color: #4b5563; /* Darker gray for better contrast */
    margin-top: 6px;
    letter-spacing: 0.01em; /* Slight spacing for quality */
}


/* Buttons */
.filter-space-wrapper .filter-actions {
  display: flex;
  gap: 10px;
}

.filter-space-wrapper .btn-apply {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  padding: 8px 20px;
  border-radius: 25px;
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-space-wrapper .btn-apply:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.4);
}

.filter-space-wrapper .btn-reset {
  border: 2px solid #e5e7eb;
  padding: 8px 20px;
  border-radius: 25px;
  background: #fff;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-space-wrapper .btn-reset:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #d1d5db;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  padding: 6px 0;
}

.toggle-switch span {
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

.toggle-switch .toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: #e5e7eb;
  border-radius: 24px;
  transition: background-color 0.3s ease;
  display: inline-block;
}

.toggle-switch .toggle-slider::after {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-slider {
  background-color: #6366f1;
}

.toggle-switch.active .toggle-slider::after {
  transform: translateX(20px);
}

/* ============================================================================
   DESKTOP SIDEBAR LAYOUT (Ported from Event/Space Archive)
   ============================================================================ */
@media (min-width: 1024px) {
  /* 1. Main Grid Container */
  .job-archive-main {
    display: grid !important;
    grid-template-columns: minmax(0, 800px) 260px !important; /* Content | Sidebar */
    gap: 40px;
    justify-content: center;
    align-items: start;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 40px;
    margin: 0 auto;
    position: relative;
    box-sizing: border-box;
  }

  /* Flatten structure for grid */
  .job-archive-main .archive-container {
      display: contents;
  }

  .job-archive-main .archive-header {
      display: contents;
  }

  /* 2. Grid Item Placement */

  /* Header Row */
  .job-archive-main .archive-header-top {
    grid-column: 1;
    grid-row: 1;
    margin-top: 20px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* Desktop Header Font Sizes */
  .job-archive-main .archive-title {
    font-size: 3rem;
    padding-left: 10px;
  }

  .job-archive-main .archive-subtitle {
    font-size: 1.8rem;
    padding-left: 10px;
    margin-top: 0;
  }

  .job-archive-main .btn-add-job {
    font-size: 1rem;
    padding: 10px 24px;
    flex-shrink: 0;
  }

  /* Ensure Header Content takes only needed width */
  .job-archive-main .archive-header-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 0 1 auto;
  }

  /* Create Space wrapper for desktop */
  .job-archive-main .create-space-wrapper {
    margin-left: 0;
    align-items: center; /* Center both button and helper text */
  }

  .job-archive-main .create-space-helper {
    text-align: center;
    margin-left: -4px; /* Slight nudge to the left */
  }

  /* Main Content (Job Grid) */
  .job-grid {
    grid-column: 1;
    grid-row: 2;
    margin-top: 10px;
    max-width: 100%;
  }

  .archive-pagination,
  .no-results {
    grid-column: 1;
    grid-row: 3;
  }

  /* 3. Filter Sidebar */
  .filter-space-wrapper {
    grid-column: 2;
    grid-row: 1 / span 10;
    position: sticky;
    top: 80px; /* Adjusted for sticky menu */
    margin: 0;

    /* Layout for vertical stack */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    padding: 10px 4px 10px 10px;
    transition: none; /* remove transition to prevent jitter */
  }

  /* 4. Filter Internals - Vertical Transformation */

  /* Hide Mobile Toggle */
  .filter-space-wrapper .filter-toggle-btn {
    display: none !important;
  }

  /* Ensure form takes available space */
  #job-filter-form {
      display: flex;
      flex-direction: column;
      flex: 1;
      overflow: hidden;
      min-height: 0;
      width: 100%;
  }

  /* Always Show Panel */
  #job-filter-panel,
  .filter-space-wrapper .filter-panel {
    display: flex !important;
    flex-direction: column;
    animation: none;
    flex: 1;
    overflow: hidden;
    margin-top: 10px;
    min-height: 0;
    padding: 0;
    width: 100%;
  }

  /* Vertical Scroll Area */
  .filter-space-wrapper .filter-scroll-row {
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    gap: 16px;
    padding-bottom: 10px;
    padding-right: 6px;
    height: 100%;
    width: 100%;
  }

  /* Columns fill width */
  .filter-col {
    width: 100%;
    min-width: 0;
  }

  /* Filter Top Actions */
  .filter-space-wrapper .filter-top {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 0;
  }

  .filter-space-wrapper .filter-actions {
    width: 100%;
    justify-content: space-between;
  }

  .filter-space-wrapper .btn-apply,
  .filter-space-wrapper .btn-reset {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

/* ============================================================================
   MOBILE EDGE-TO-EDGE FILTER
   ============================================================================ */
@media (max-width: 1023px) {
  /* Remove container padding for edge-to-edge layout */
  /* Keep top/bottom padding, only remove left/right for edge-to-edge */
  .job-archive-main .archive-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Edge-to-edge filter container */
  .filter-space-wrapper {
    margin: 0 0 20px 0;
    padding: 12px 16px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    
    /* Make Sticky */
    position: sticky;
    top: 75px; /* Matches Profile Archive */
    z-index: 99;
    background: #ffffff;
  }

  /* Mobile edge-to-edge styling */
  .job-archive-main {
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow-x: visible;
  }
}
