/* ===========================================================
    JOBS.CSS - MAIN STYLESHEET
    Common features, layout, sidebars, footers, and shared components
    =========================================================== */

/* ===========================================================
    1) DESIGN TOKENS / ROOT VARIABLES
    =========================================================== */
:root {
  /* Skill pill palette (used site-wide) */
  --pill-bg: linear-gradient(135deg, #010080 0%, #0056b3 100%);
  --pill-text: #ffffff;
  --pill-border: rgba(0, 0, 0, 0.18);
  --pill-hover-bg: #334a9a;
  --pill-active-bg: #1f2f63;
  --pill-alt-bg: #eef2ff;
  --pill-alt-text: #283b7d;
  --pill-alt-border: #dfe3ff;
  --pill-alt-hover-bg: #e7ebff;
  --pill-alt-active-bg: #dee4ff;
  --primary-color-hover: #000066;

  /* Common fallbacks */
  --font-family-body: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-family-heading: "Montserrat", serif;

  --card-bg: #fff;
  --card-shadow-pro: 0 4px 12px rgba(0, 0, 0, 0.05);
  --hover-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  --border-color-pro: #e0e0e0;

  --text-color-primary: #212121;
  --text-color-secondary: #5a5a5a;
  --text-color-subtle: #8a8a8a;

  --primary-color: #010080;
  --primary-color-dark: #0056b3;
  --primary-color-light: #0100801f;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --danger-color-rgb: 220, 53, 69;

  --light-color: #ffffff;

  /* Layout helpers */
  --header-height: 64px;
}

/* ===========================================================
    2) PAGE HEADER SECTION
    =========================================================== */
.page-header-section {
  margin-bottom: 1.5rem;
}

#job-card-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.job-card-header .btn:hover {
  background: var(--light-color);
  color: var(--primary-color);
  text-decoration: none;
}

@media (max-width: 991.98px) {
  #job-card-header .label-heading {
    font-size: 1.4rem;
    flex-grow: 1;
    align-items: center;
  }

  #job-card-header .d-flex.align-items-center {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  #job-card-header .d-flex.align-items-center .btn {
    flex: 1;
    margin: 0 5px;
  }

  #mobile-filter-toggle {
    flex-shrink: 0;
    margin-left: 0;
    white-space: nowrap;
  }
}

/* ===========================================================
    3) LABEL HEADING COMPONENT
    =========================================================== */
.label-heading {
  position: relative;
  display: flex;
  align-items: baseline;
  padding-bottom: 0.8em;
  margin-bottom: 0;
  font-weight: 700;
  font-family: var(--font-family-heading);
  --label-heading-accent-color-start: #010080;
  --label-heading-accent-color-end: #0056b3;
  --label-heading-text-color: var(--secondary-color, #212121);
  --label-heading-count-bg: #e9ecef;
  --label-heading-count-color: var(--secondary-color, #212121);
}

.label-heading::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--label-heading-accent-color-start),
    var(--label-heading-accent-color-end)
  );
  transition: width 0.3s ease-in-out;
}

.label-heading:hover::before {
  width: 100px;
}

.label-heading__text {
  font-size: 2rem;
  color: var(--label-heading-text-color);
  letter-spacing: -0.75px;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.08);
}

.label-heading__count {
  display: inline-block;
  margin-left: 1em;
  padding: 0.25em 0.7em;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  color: var(--label-heading-count-color);
  background-color: var(--label-heading-count-bg);
  border-radius: 2em;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ===========================================================
    4) LAYOUT / GRID SYSTEM (MOBILE OPTIMIZED)
    =========================================================== */
.job-cards-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-left: 0;
  margin-right: 0;
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
}

@media (min-width: 992px) {
  .job-cards-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

/* Ensure single card per row on mobile */
@media (max-width: 991.98px) {
  .job-cards-row {
    grid-template-columns: 1fr !important;
    gap: 1.5rem;
  }
}

.job-cards-row > [class*="col-"] {
  padding: 0 !important;
  width: auto !important;
  max-width: none !important;
  flex: initial !important;
  align-self: stretch;
}

.job-cards-row .flip {
  height: 100%;
}

/* CRITICAL: Override Bootstrap row negative margins */
.row.job-cards-row {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* ===========================================================
    5) FLIP CARD FUNCTIONALITY
    =========================================================== */
.flip {
  perspective: 1000px;
  position: relative;
  width: 100%;
  min-height: 520px;
  transform-style: preserve-3d;
  display: grid;
}

.flip .front,
.flip .back {
  position: relative;
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform 0.6s ease-in-out;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.flip .front {
  z-index: 2;
  transform: rotateY(0deg);
}

.flip .back {
  z-index: 1;
  transform: rotateY(180deg);
}

.flip.flipped .front {
  transform: rotateY(-180deg);
}

.flip.flipped .back {
  transform: rotateY(0deg);
  z-index: 2;
}

/* ===========================================================
    6) CARD HOVER EFFECTS
    =========================================================== */
.job-cards-row .col-12 .flip {
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.job-cards-row .col-12 .flip.dimmed {
  opacity: 0.3;
}

.job-cards-row .col-12 .flip.highlighted {
  opacity: 1;
  transform: translateY(-4px) scale(1.02);
  z-index: 10;
  position: relative;
}

.job-cards-row .col-12 .flip.highlighted .job-card-pro {
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15);
}

.job-cards-row .col-12 .flip.highlighted {
  filter: drop-shadow(0 0 4px rgba(1, 0, 128, 0.1));
}

/* ===========================================================
    7) SELECTED FILTERS
    =========================================================== */
.selected-filters {
  margin-bottom: 1rem;
}

.selected-filters .pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 15px 30px;
  border: 1px solid #198754;
  border-radius: 999px;
  font-size: 0.875rem;
  text-decoration: none;
  line-height: 1;
  color: #198754;
  background-color: rgba(255, 255, 255, 0.2);
}

.selected-filters .pill:hover,
.selected-filters .pill:focus-visible {
  background: #198754;
  color: var(--light-color);
}

.selected-filters .pill span {
  font-weight: 700;
  line-height: 1;
}

.selected-filters .pill--sub {
  border-style: dashed;
}

.selected-filters .pill--clear {
  background: #010080;
  border-color: #010080;
  color: var(--light-color);
}

.selected-filters .pill--clear:hover,
.selected-filters .pill--clear:focus-visible {
  background: var(--light-color);
  color: #010080;
}

/* ===========================================================
    8) SKILL PILLS / TAGS
    =========================================================== */
.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-pill {
  margin: 0;
}

.job-tags-pro .skill-pills {
  gap: 6px;
}

.job-tags-pro .skill-pill {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.2;
  padding: 5px 10px;
  border-radius: 12px;
  background: var(--pill-bg);
  color: var(--pill-text);
  border: 1px solid var(--pill-border);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}

.job-tags-pro .skill-pill:hover {
  background: var(--pill-hover-bg);
  transform: translateY(-1px);
}

.job-tags-pro .skill-pill:active {
  background: var(--pill-active-bg);
  transform: translateY(0);
}

.job-tags-pro .skill-pill[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.job-tags-pro .skill-pill:focus-visible {
  outline: 2px solid rgba(40, 59, 125, 0.45);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(40, 59, 125, 0.12);
}

.job-tags-pro .skill-pill.active,
.job-tags-pro .skill-pill.is-selected {
  background: #3b82f6;
  border-color: #2f6bd7;
}

.job-tags-pro .skill-pill--more {
  background: var(--pill-alt-bg);
  color: var(--pill-alt-text);
  border: 1px solid var(--pill-alt-border);
}

.job-tags-pro .skill-pill--more:hover {
  background: var(--pill-alt-hover-bg);
}

.job-tags-pro .skill-pill--more:active {
  background: var(--pill-alt-active-bg);
}

.job-tags-pro .skill-pill--more:focus-visible {
  outline-color: rgba(40, 59, 125, 0.45);
  box-shadow: 0 0 0 4px rgba(40, 59, 125, 0.12);
}

@media (min-width: 992px) {
  .job-tags-pro .skill-pill {
    font-size: 0.9rem;
    padding: 6px 12px;
  }
}

/* ===========================================================
    9) BUTTONS / LINKS
    =========================================================== */
a.btn-primary.btn-small,
a.btn-primary.btn-small * {
  color: var(--light-color) !important;
}

a.btn-primary.btn-small:hover,
a.btn-primary.btn-small:hover * {
  color: var(--primary-color) !important;
}

.read-more-link {
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.read-more-link:hover {
  color: var(--primary-color-dark);
  text-decoration: underline;
}

/* ===========================================================
    10) EMPTY STATE
    =========================================================== */
.empty-state-card {
  padding: 60px 20px;
  background-color: var(--card-bg);
  border: 1px dashed var(--border-color-pro);
  border-radius: 20px;
  text-align: center;
  color: var(--text-color-secondary);
}

.empty-state-card .bi {
  font-size: 3rem;
  color: var(--text-color-subtle);
  margin-bottom: 1rem;
}

/* ===========================================================
    11) PAGINATION
    =========================================================== */
.pagination-container {
  margin-top: 2rem;
}

.pagination {
  gap: 4px;
}

.page-link {
  font-size: 0.85rem;
  padding: 6px 10px;
}

/* ===========================================================
    12) MOBILE FILTER DRAWER
    =========================================================== */
.drawer-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.drawer-backdrop.show {
  display: block;
  opacity: 1;
}

.mobile-filters-drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 85vh;
  max-height: 85vh;
  background: #ffffff;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.3, 1);
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-filters-drawer.open{
  transform: translateY(0%);
}
@media (max-width: 991.98px) {
  .mobile-filters-drawer {
    display: flex;
    flex-direction: column;
  }
  #mobile-filters-drawer aside{
    height: 100% !important;
  }
}

.mobile-filters-drawer.open {
  transform: translateY(0);
}

.mobile-filters-drawer .drawer-header {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 10;
  padding: 1.2rem 1.5rem 0.8rem;
  border-bottom: 2px solid #e5e5e5;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-filters-drawer .drawer-header h5 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color, #010080);
  margin: 0;
}

.mobile-filters-drawer .btn-close {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: #666;
  opacity: 0.7;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.mobile-filters-drawer .btn-close:hover {
  opacity: 1;
}

.mobile-filters-drawer .drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem 2rem;
}

.mobile-filters-drawer .sidebar-filters,
.mobile-filters-drawer #sidebar-filters {
  display: block !important;
  position: static !important;
  width: 100% !important;
  max-width: 100% !important;
  transform: none !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  background: transparent !important;
}

.mobile-filters-drawer .sidebar-close-btn,
.mobile-filters-drawer .desktop-only {
  display: none !important;
}

.mobile-filters-drawer .filter-pod {
  margin-bottom: 1.5rem;
}

.mobile-filters-drawer .sidebar-content,
.mobile-filters-drawer .pod-content {
  display: block !important;
  visibility: visible !important;
}

.filter-count-badge {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #dc3545;
  color: white;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 8px;
}

.mobile-filters-drawer .mt-4.d-grid {
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #ffffff 80%, rgba(255, 255, 255, 0));
  padding: 1rem 0 0;
  margin-top: 2rem !important;
}

body.drawer-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

@media (min-width: 992px) {
  .mobile-filters-drawer,
  .drawer-backdrop,
  #mobile-filter-toggle {
    display: none !important;
  }
}

/* ===========================================================
    13) SIDEBAR FILTERS
    =========================================================== */
@media (min-width: 992px) {
  .sidebar-filters select,
  .sidebar-filters .form-select {
    width: auto !important;
    display: inline-block;
    flex: 0 0 auto;
  }

  .sidebar-filters .select2-container .select2-dropdown {
    width: max-content !important;
    min-width: 0 !important;
  }

  .sidebar-filters .select2-results__options {
    max-width: 60ch;
    overflow-x: hidden;
  }
}

@media (max-width: 992px) {
  .sidebar-filters .select2-container {
    width: 100% !important;
    min-width: 100% !important;
  }
}

/* ===========================================================
    14) ACCESSIBILITY / FOCUS
    =========================================================== */
.skip-link {
  position: absolute;
  top: -999px;
  left: -999px;
  padding: 10px;
  background: #fff;
  color: #000;
  z-index: 9999;
  font-weight: bold;
  border: 2px solid #000;
}

.skip-link:focus {
  top: 10px;
  left: 10px;
}

/* ===========================================================
    15) RESPONSIVE UTILITIES (MOBILE OPTIMIZED)
    =========================================================== */
@media (max-width: 767.98px) {
  /* Match content with header padding */
  .col-lg-9 {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* Keep what you already have */
  .container-fluid {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }

  .job-cards-row {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .job-cards-row > [class*="col-"],
  .job-cards-row > .col-12,
  .job-cards-row > .col-lg-6 {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .flip,
  .job-card-pro {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
}


@media (max-width: 375px) {
  .label-heading__text {
    font-size: 1.3rem !important;
  }

  .flip {
    min-height: 480px;
  }
}

@media (max-width: 767.98px) and (orientation: landscape) {
  .flip {
    min-height: 450px !important;
  }
}