/**
 * UKG Job Listings Frontend Styles
 * Updated: 2025-10-10 for proper table cell alignment and width consistency v3 - staging fixes
 */
.ukg-job-listings {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Elementor-style Section Container */
.ukg-job-listings-section {
  padding: 60px 0;
  background: #FEFBE7;
}

/* Support different theme containers */
.ukg-job-listings-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Ensure consistent styling across different themes */
.site-container .ukg-job-listings-section,
.wrapper .ukg-job-listings-section,
.content-body .ukg-job-listings-section {
  padding: 60px 0;
  background: #FEFBE7;
  width: 100%;
  box-sizing: border-box;
}

.ukg-job-listings-heading {
  margin: 0 0 40px 0;
  font-size: 36px;
  font-weight: 600;
  color: #333;
  text-align: left;
  line-height: 1.2;
}

.ukg-jobs-filter {
  margin-bottom: 24px;
  padding: 0 0 24px 0;
  background-color: transparent;
  border: none;
  border-bottom: 1px solid #e9ecef;
  border-radius: 0;
  box-shadow: none;
  width: 100%;
  box-sizing: border-box;
}

.ukg-jobs-container {
  width: 100%;
  box-sizing: border-box;
}

/* Ensure both filter and table container have the same effective layout */
.ukg-jobs-filter,
.ukg-jobs-container {
  display: block;
  width: 100%;
}

/* Remove conflicting margin/padding that might cause width differences */
.ukg-jobs-filter *,
.ukg-jobs-container * {
  box-sizing: border-box;
}

/* Make the filter form span the full width like the table */
.ukg-filter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  align-items: end;
  margin-top: 16px;
  width: 100%;
}

/* Override any theme-specific scroll wrappers and table wrappers */
.ms-scroller-x,
.ms-table__wrapper,
.mCustomScrollbar {
  width: 100% !important;
  overflow: visible !important;
}

/* Force table container to match filter width on all themes */
.ukg-jobs-container,
.ukg-jobs-container > *,
.ukg-jobs-container .ms-scroller-x,
.ukg-jobs-container .ms-table__wrapper {
  width: 100% !important;
  box-sizing: border-box !important;
}

/* Disable custom scrollbars that interfere with layout */
.ukg-jobs-container .mCustomScrollbar,
.ukg-jobs-container .mCSB_container {
  overflow: visible !important;
  width: 100% !important;
  position: static !important;
}

.ukg-jobs-container .mCSB_scrollTools {
  display: none !important;
}

/* Ensure the main containers have consistent width on different themes */
.site-container .ukg-job-listings-container,
.container .ukg-job-listings-container,
.ukg-job-listings-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 15px;
  width: 100%;
  box-sizing: border-box;
}

.ukg-filter-field {
  margin-bottom: 0;
}

.ukg-filter-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ukg-filter-field select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  background-color: #fff;
  font-size: 16px;
  transition: all 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'><path fill='%23666' d='M2 0L0 2h4zm0 5L0 3h4z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.ukg-filter-field select:focus {
  outline: none;
  border-color: #00053e;
  box-shadow: 0 0 0 3px rgba(0, 5, 62, 0.1);
}

.ukg-filter-submit button {
  padding: 0.5rem 1rem;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.ukg-filter-submit button:hover {
  background-color: #555;
}

/* Card View Styles */
.ukg-jobs-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.ukg-job-card {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 30px;
  background-color: #fff;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.ukg-job-card:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.ukg-job-title {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 600;
}

.ukg-job-title a {
  color: #007cba;
  text-decoration: none;
  transition: color 0.2s ease;
}

.ukg-job-title a:hover {
  color: #005a87;
}

.ukg-job-meta {
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: #6c757d;
}

.ukg-job-meta > div {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.ukg-meta-label {
  font-weight: 600;
  margin-right: 8px;
  color: #495057;
  min-width: 80px;
}

.ukg-job-excerpt {
  margin-bottom: 25px;
  font-size: 0.95rem;
  color: #495057;
  line-height: 1.6;
}

.ukg-job-link {
  text-align: right;
}

.ukg-apply-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  background: #FCC80B;
  color: #00053e;
  text-decoration: none;
  border-radius: 9999px;
  font-family: fatfrank, sans-serif;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 3px 0 0 rgba(0,0,0,0.15);
  white-space: nowrap;
}

.ukg-apply-button:hover {
  background: #e6b600;
  text-decoration: none;
  color: #00053e;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 0 rgba(0,0,0,0.15);
}

.ukg-job-action-cell {
  text-align: center;
  min-width: 120px;
}

.ukg-no-jobs-found {
  text-align: center;
  padding: 60px 40px;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  color: #6c757d;
  margin: 40px 0;
}

.ukg-no-jobs-found p {
  font-size: 18px;
  margin-bottom: 20px;
}

.ukg-reset-filters {
  display: inline-block;
  padding: 12px 24px;
  background: #007cba;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.ukg-reset-filters:hover {
  background: #005a87;
  color: white;
  text-decoration: none;
}

@media (max-width: 768px) {
  .ukg-job-listings-container {
    padding: 0 20px;
  }

  .ukg-job-listings-heading {
    font-size: 28px;
    margin-bottom: 30px;
  }

  .ukg-jobs-filter {
    padding: 20px;
    margin-bottom: 30px;
  }

  .ukg-filter-form {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .ukg-view-toggle {
    flex-direction: column;
    gap: 8px;
  }

  .ukg-view-btn {
    width: 100%;
    justify-content: center;
  }

  .ukg-jobs-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ukg-job-card {
    padding: 20px;
  }

  .ukg-jobs-table {
    font-size: 14px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .ukg-jobs-table th,
  .ukg-jobs-table td {
    padding: 12px 8px;
    min-width: 120px;
  }

  .ukg-job-pagination .page-numbers {
    gap: 6px;
  }

  .ukg-job-pagination .page-numbers a,
  .ukg-job-pagination .page-numbers span {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .ukg-no-jobs-found {
    padding: 40px 20px;
  }
}

@media (max-width: 480px) {
  .ukg-job-listings-section {
    padding: 40px 0;
  }

  .ukg-job-listings-heading {
    font-size: 24px;
  }

  .ukg-jobs-filter {
    padding: 15px;
  }

  .ukg-job-card {
    padding: 15px;
  }

  .ukg-jobs-table th,
  .ukg-jobs-table td {
    padding: 8px 6px;
    font-size: 12px;
  }
}

/* View Toggle Styles */
.ukg-view-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  gap: 8px;
}

.ukg-view-btn {
  padding: 8px 20px;
  background: transparent;
  border: 2px solid #00053e;
  border-radius: 9999px;
  cursor: pointer;
  color: #00053e;
  font-family: fatfrank, sans-serif;
  font-size: 13px;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ukg-view-btn.active {
  background: #00053e;
  border-color: #00053e;
  color: white;
}

.ukg-view-btn:hover:not(.active) {
  background: rgba(0, 5, 62, 0.06);
  border-color: #00053e;
  color: #00053e;
}

/* Table View Styles */
.ukg-jobs-table-container {
  overflow-x: auto; /* fallback for very small screens */
}

.ukg-jobs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 40px !important; /* Override theme margin */
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  font-size: 14px !important; /* Override theme font-size */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

/* Override any theme-specific table containers and wrappers */
.ms-scroller-x .ukg-jobs-table,
.ms-table__wrapper .ukg-jobs-table,
.mCustomScrollbar .ukg-jobs-table {
  width: 100% !important;
  min-width: auto !important;
  max-width: none !important;
}

.ukg-jobs-table th,
.ukg-jobs-table td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid #e9ecef;
  vertical-align: top;
}

.ukg-jobs-table th:nth-child(5),
.ukg-jobs-table td:nth-child(5),
.ukg-jobs-table .ukg-job-action-cell {
  white-space: nowrap;
}
  overflow-wrap: break-word;
}

.ukg-jobs-table th {
  background: #00053e;
  color: #FCC80B;
  border-bottom: none;
  font-family: fatfrank, sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ukg-jobs-table tbody tr {
  transition: all 0.2s ease;
}

.ukg-jobs-table tbody tr:hover {
  background: #f8f9fa;
}

.ukg-jobs-table tbody tr:last-child td {
  border-bottom: none;
}

.ukg-jobs-table .ukg-job-title-cell {
  font-weight: 500;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ukg-jobs-table .ukg-job-title-cell a {
  color: #00053e;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
  flex: 1;
}

.ukg-jobs-table .ukg-job-title-cell a:hover {
  color: #0034ba;
  text-decoration: underline;
}

.ukg-job-company {
  font-weight: 500;
  color: #555;
}

.ukg-job-expand-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: #6c757d;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.ukg-job-expand-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.ukg-job-expand-btn .dashicons,
.ukg-job-expand-btn .ukg-chevron {
  transition: transform 0.3s ease;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ukg-job-expand-btn[aria-expanded="true"] .dashicons,
.ukg-job-expand-btn[aria-expanded="true"] .ukg-chevron {
  transform: rotate(180deg);
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ukg-job-description-row {
  display: none;
  background: #f8f9fa;
}

.ukg-job-description-row.expanded {
  display: table-row;
}

.ukg-job-description-row td {
  padding: 30px !important;
  color: #495057;
  line-height: 1.6;
  border-top: 1px solid #e9ecef;
}

.ukg-job-description {
  max-width: 800px;
  font-size: 15px;
}

/* Loading State */
/* Override theme's DaisyUI .loading class which would render a spinner */
.ukg-job-listings.loading {
  pointer-events: auto;
  display: block;
  aspect-ratio: auto;
  background-color: transparent;
  mask-image: none;
}
.ukg-job-listings.loading .ukg-jobs-container {
  opacity: 0.3;
  pointer-events: none;
}

/* Clear Filters Button */
.ukg-clear-filters {
  display: inline-block;
  margin: 1rem 0;
  padding: 0.5rem 1rem;
  background: none;
  border: 1px solid #666;
  border-radius: 3px;
  color: #666;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.ukg-clear-filters:hover {
  background: #666;
  color: white;
}

/* Remove Filter Button */
.ukg-filter-submit {
  display: none;
}

/* Pagination Styles */
.ukg-job-pagination {
  margin-top: 40px;
  text-align: center;
}

.ukg-job-pagination .page-numbers {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  list-style: none !important;
  padding: 0 !important;
  margin: 20px 0;
  flex-wrap: wrap;
}

.ukg-job-pagination .page-numbers li {
  display: inline-block;
  margin: 0;
  list-style: none !important;
}

.ukg-job-pagination .page-numbers a,
.ukg-job-pagination .page-numbers span {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  text-decoration: none;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  color: #6c757d;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.ukg-job-pagination .page-numbers span.current {
  background: #00053e;
  border-color: #00053e;
  color: white;
  font-weight: 600;
}

.ukg-job-pagination .page-numbers a:hover {
  background: #00053e;
  border-color: #00053e;
  color: white;
  transform: translateY(-1px);
}

.ukg-job-pagination .prev,
.ukg-job-pagination .next {
  font-weight: 600;
  padding: 0 16px !important;
}

.ukg-job-pagination .dots {
  border: none !important;
  background: transparent !important;
  color: #6c757d !important;
  cursor: default;
}

@media (max-width: 768px) {
  .ukg-job-listings-container {
    padding: 0 20px;
  }

  .ukg-job-listings-heading {
    font-size: 28px;
    margin-bottom: 30px;
  }

  .ukg-jobs-filter {
    padding: 20px;
    margin-bottom: 30px;
  }

  .ukg-filter-form {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .ukg-view-toggle {
    flex-direction: column;
    gap: 8px;
  }

  .ukg-view-btn {
    width: 100%;
    justify-content: center;
  }

  .ukg-jobs-list {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .ukg-job-card {
    padding: 20px;
  }

  .ukg-jobs-table {
    font-size: 14px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .ukg-jobs-table th,
  .ukg-jobs-table td {
    padding: 12px 8px;
    min-width: 120px;
  }

  .ukg-job-pagination .page-numbers {
    gap: 6px;
  }

  .ukg-job-pagination .page-numbers a,
  .ukg-job-pagination .page-numbers span {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .ukg-no-jobs-found {
    padding: 40px 20px;
  }
}
