@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* Main Container */
.humanitae-filter-container {
  margin: 30px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  max-width: 1260px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  width: 100% !important;
}

/* Header with title, search and filter */
.humanitae-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.humanitae-filter-title {
  color: var(--UI-Cornerstone-Navy, #111740);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 38px !important;
  font-style: normal;
  font-weight: 600;
  line-height: 120%;
  letter-spacing: -0.95px;
  margin: 0;
}

.humanitae-filter-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}

.humanitae-results-count-container {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  top: -26px;
  right: 0;
  z-index: 1;
  background: transparent; 
  padding: 0;
  margin: 0;
}

.humanitae-search-row {
  display: flex;
  align-items: center;
  gap: 16px;
  width: auto;
  position: relative;
  margin-top: 8px;
}

.humanitae-search-container {
  position: relative;
  display: inline-block;
  width: 500px;
  max-width: 100%;
}

.humanitae-search-container .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 2;
}

/* More specific selector to override WordPress defaults */
.humanitae-filter-container input.humanitae-filter-search-input {
  display: block !important;
  width: 500px !important;
  height: auto !important;
  padding: 8px 12px 12px 44px !important;
  border-radius: 8px !important;
  border: 1px solid #e0e0e0 !important;
  background: var(--UI-White, #FFF) !important;
  color: var(--UI-Cornerstone-Navy, #111740) !important;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
  font-size: 16px !important;
  font-style: normal !important;
  font-weight: 400 !important;
  line-height: 150% !important;
  letter-spacing: 0.16px !important;
  outline: none !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Placeholder styling */
.humanitae-filter-container input.humanitae-filter-search-input::placeholder {
  color: var(--UI-Cornerstone-Navy, #111740) !important;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
  font-size: 16px !important;
  font-style: normal !important;
  font-weight: 400 !important;
  line-height: 150% !important;
  letter-spacing: 0.16px !important;
  opacity: 1 !important;
}

.humanitae-filter-toggle-button {
  display: flex;
  padding: 12px 24px 12px 20px;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border: none;
  border-radius: 8px;
  background-color: #4956F3;
  color: var(--UI-White, #FFF);
  cursor: pointer;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%;
  letter-spacing: 0.16px;
  transition: background-color 0.2s;
}

.humanitae-filter-toggle-button:hover {
  background-color: #3730c2;
}

.filter-icon, .search-icon {
  width: 24px;
  height: 24px;
}

/* Filter Results Count */
.humanitae-filter-results-count {
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: 0.16px;
  text-align: right;
}

.humanitae-filter-results-count strong {
  font-weight: 700;
}

/* Remove any margin or padding from original results count */
.humanitae-filter-results-count:not(:first-child) {
  margin: 0;
  padding: 0;
}

/* Filter Modal */
.humanitae-filter-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.humanitae-filter-modal.open {
  display: block;
}

.humanitae-filter-modal-content {
  position: relative;
  background-color: #fff;
  margin: 50px auto;
  padding: 40px 48px;
  width: 1100px;
  max-width: 1120px;
  border-radius: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.humanitae-filter-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.humanitae-filter-modal-header h3 {
  margin: 0;
  color: #4956F3;
  /* Desktop/H5 */
  font-family: Poppins;
  font-size: 24px;
  font-style: normal;
  font-weight: 600;
  line-height: 130%; /* 31.2px */
  letter-spacing: -0.24px;
  text-align: left;
  width: auto;
}

.humanitae-filter-toggle-button {
  display: flex;
  padding: 12px 24px 12px 20px;
  justify-content: center;
  align-items: center;
  gap: 12px;
  border: none;
  border-radius: 8px;
  background-color: #4956F3;
  color: var(--UI-White, #FFF);
  cursor: pointer;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%;
  letter-spacing: 0.16px;
  transition: background-color 0.2s;
}

.humanitae-filter-toggle-button:hover {
  background-color: #3730c2;
}

/* Filter Options */
.humanitae-filter-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

/* Top row with 3 filters */
.humanitae-filter-top-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Bottom row for Institution Context */
.humanitae-filter-bottom-row {
  width: 100%;
  /* margin-top: 5px;
  padding-top: 10px; */
}

.humanitae-filter-group {
  margin-bottom: 15px;
}

.humanitae-filter-group-title {
  margin: 0 0 10px 0;
  color: #111740 !important;
  font-family: Poppins !important;
  font-size: 17px !important;
  font-style: normal !important;
  font-weight: 600 !important;
  line-height: 130% !important; /* 22.1px */
  letter-spacing: -0.17px !important;
}

.humanitae-filter-group-items {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 10px;
}

/* Institution Context specific styles - horizontal layout */
.humanitae-filter-group[data-taxonomy="institution_context"] {
  width: 100%;
  margin-top: 10px;
}

.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-title {
  margin-bottom: 15px;
  position: relative;
}

.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background-color: #111740;
  margin-top: 10px;
}

.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  grid-gap: 12px 24px;
  max-height: none;
  overflow-y: visible;
  width: 100%;
}

.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-checkbox {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  display: flex;
  align-items: center;
  padding: 3px 0;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

/* Ensure checkbox appearance is preserved while preventing wrapping */
.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-checkbox input {
  margin-right: 8px;
  margin-top: 0;
  flex-shrink: 0;
  /* Do not modify other checkbox properties */
}

/* Make the wrapper around the text wider */
.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-checkbox label {
  width: auto;
  white-space: nowrap;
  overflow: visible;
}

/* Custom styling for disabled filter checkboxes */
.humanitae-filter-checkbox.humanitae-filter-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: #888;
}

.humanitae-filter-checkbox.humanitae-filter-disabled input {
  cursor: not-allowed;
}

.humanitae-filter-checkbox.humanitae-filter-disabled .humanitae-filter-count {
  color: #888;
}

/* Regular filter checkbox styling */
.humanitae-filter-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: 0.16px;
  cursor: pointer;
  width: auto;
}

.humanitae-filter-checkbox input {
  margin-right: 10px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  border: 1px solid #FFF;
}

.humanitae-filter-count {
  margin-left: 5px;
  color: #666;
  font-weight: 400;
}

.humanitae-filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  width: 100%;
}

.humanitae-filter-action-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

.humanitae-clear-all {
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%; /* 24px */
  letter-spacing: 0.16px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  outline: none;
}

.humanitae-clear-all:hover {
  text-decoration: underline;
  background: transparent;
  color: #111740;
  outline: none;
  box-shadow: none;
}

.humanitae-clear-all:active,
.humanitae-clear-all:focus {
  outline: none;
  box-shadow: none;
  background: transparent;
  color: #111740;
  border: none;
}

.humanitae-search-button {
  display: flex;
  padding: 14px 25px 15px 25px;
  justify-content: center;
  align-items: center;
  gap: 0;
  border-radius: 10px;
  background: #111740;
  color: var(--UI-White, #FFF);
  border: none;
  cursor: pointer;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%;
  transition: background-color 0.2s;
}

.search-button-icon {
  width: 24px;
  height: 24px;
  margin-right: 8px;
}

.humanitae-search-button:hover {
  background: #4956F3;
}

.humanitae-cancel-button {
  display: flex;
  padding: 14px 25px 15px 25px;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  border: 1px solid var(--UI-White, gray);
  background: transparent;
  color: #111740D9;
  cursor: pointer;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%;
  transition: background-color 0.2s;
}

.humanitae-cancel-button:hover {
  background: #4956F3;
}

/* Results Section */
.humanitae-filter-results-wrapper {
  width: 100% !important;
  max-width: 1260px !important; /* Match table width */
  margin: 0 auto !important;
  position: relative !important;
  overflow: visible !important; /* Allow content to be visible */
}

.humanitae-filter-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.humanitae-filter-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4e46dc;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: humanitae-spin 1s linear infinite;
}

@keyframes humanitae-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Results Table Styles - DIV-based structure */
.humanitae-results-table {
  width: 100%;
  margin-bottom: 20px;
  /* border: 1px solid #dee2e6; */
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 0; /* Eliminate any whitespace between elements */
  min-width: 1212px; /* Set minimum width to prevent wrapping */
  overflow-x: auto; /* Add horizontal scrolling for small screens */
}

/* DIV Table Structure */
.humanitae-results-table .thead,
.humanitae-results-table .tbody {
  width: 100%;
  font-size: 0; /* Eliminate any whitespace between elements */
}

.humanitae-results-table .tr {
  display: flex;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  align-items: stretch; /* Changed from center to stretch */
}

/* Header styles */
.humanitae-results-table .thead {
  border-radius: 5px;
  margin: 0;
  padding: 0;
  background: #111740;
}

.humanitae-results-table .th {
  padding: 10px 10px;
  color: var(--UI-White, #FFF);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 700;
  line-height: 155%;
  text-align: left;
  position: relative;
}

/* Sort button styles */
.humanitae-sort-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 5px;
  cursor: pointer;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
}

/* Override default WordPress button hover styles */
.humanitae-results-table .th .humanitae-sort-button:hover,
.humanitae-results-table .th .humanitae-sort-button:focus {
  background: none !important;
  color: inherit !important;
}

.humanitae-sort-button .sort-icon {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease-in-out, filter 0.2s ease-in-out;
}

.humanitae-sort-button:hover .sort-icon {
  filter: drop-shadow(0 0 1px #4e46dc) brightness(1.1);
}

.humanitae-sort-button.asc .sort-icon,
.humanitae-sort-button.desc .sort-icon {
  filter: drop-shadow(0 0 2px #4e46dc) brightness(1.2);
}

.humanitae-sort-button.asc .sort-icon {
  transform: rotate(0deg);
}

.humanitae-sort-button.desc .sort-icon {
  transform: rotate(180deg);
}

/* Cell widths */
.humanitae-results-table .title-col {
  flex: 2;
  min-width: 300px;
  max-width: 402px;
}

.humanitae-results-table .authors-col,
.humanitae-results-table .organization-col,
.humanitae-results-table .topic-col {
  flex: 1;
  min-width: 150px;
}

.humanitae-results-table .stages-col {
  flex: 1;
  min-width: 250px; /* Increase min-width to fit all icons */
}

/* Row styles */
.humanitae-results-table .tbody .tr.humanitae-result-row {
  border-bottom: 1px solid #dee2e6; /* Default border for all rows */
  background-color: #fff;
  margin: 0;
  padding: 0;
  border-top: none;
  display: flex;
  width: 100%;
}

/* Apply alternating background colors to rows */
.humanitae-results-table .tbody .tr.humanitae-result-row:nth-child(4n+1),
.humanitae-results-table .tbody .tr.humanitae-result-row:nth-child(4n+2),
.humanitae-results-table .tbody .tr.humanitae-result-details:nth-child(4n+2),
.humanitae-results-table .tbody .tr.humanitae-result-details:nth-child(4n+3) {
  background-color: #fff;
}

.humanitae-results-table .tbody .tr.humanitae-result-row:nth-child(4n+3),
.humanitae-results-table .tbody .tr.humanitae-result-row:nth-child(4n+4),
.humanitae-results-table .tbody .tr.humanitae-result-details:nth-child(4n+4),
.humanitae-results-table .tbody .tr.humanitae-result-details:nth-child(4n+5) {
  background-color: #F8F8F9;
}

.humanitae-results-table .tbody .tr.humanitae-result-row:hover {
  background-color: #f0f0f0;
}

.humanitae-results-table .td {
  padding: 14px 10px;
  font-size: 16px; /* Consistent font size */
  vertical-align: top;
  box-sizing: border-box;
}

/* Expandable details */
.humanitae-result-details {
  display: none;
  margin: 0;
  padding: 0;
  border-top: 0;
  border-bottom: 1px solid #dee2e6;
  width: 100%;
}

.humanitae-result-details.tr {
  display: none;
  width: 100%;
}

/* When details row is visible, remove the border from the previous row */
.humanitae-results-table .tbody .tr.humanitae-result-details:not([style*="display: none"]) {
  border-top: 0;
  display: block; /* Changed from flex to block for better layout */
  width: 100%;
}

.humanitae-results-table .thead .tr,
.humanitae-results-table .tbody .tr.humanitae-result-row {
  display: flex;
}

.humanitae-result-details > td,
.humanitae-result-details > .td {
  padding: 0;
}

.humanitae-result-details-content {
  margin: 0;
  padding-top: 20px;
  padding-left: 40px; /* Reduced padding to match header alignment */
  padding-bottom: 48px;
  width: 100%;
}

/* Results Table Styles */
.humanitae-results-table {
  width: 100%;
  margin-bottom: 20px;
  /* border: 1px solid #dee2e6; */
  border-radius: 5px;
  overflow: hidden;
}

/* Row toggle button styles */
.humanitae-result-row td.title-col,
.humanitae-result-row td.organization-col,
.humanitae-result-row td.topic-col {
  position: relative;
  padding-left: 40px;
  padding-top: 14px;
  padding-right: 10px;
  padding-bottom: 12px;
}

.humanitae-results-table .tbody .tr.humanitae-result-row .td.title-col {
  position: relative;
  padding-left: 40px;
  padding-top: 14px;
  padding-right: 10px;
  padding-bottom: 12px;
  /* border-bottom: 1px solid var(--UI-Cornerstone-Navy, #111740); */
}

.humanitae-toggle-details {
  position: absolute;
  left: 5px;
  top: 14px;
  transform: none;
  background: none !important;
  border: none !important;
  border-radius: 10px !important;
  /* width: 32px !important;
  height: 32px !important; */
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  padding: 0 !important;
  color: #6c757d !important;
  box-shadow: none !important;
  outline: none !important;
}

.humanitae-toggle-details:hover,
.humanitae-toggle-details:active,
.humanitae-toggle-details:focus {
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.humanitae-expand-icon,
.humanitae-collapse-icon {
  width: 28px !important;
  height: 28px !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.humanitae-expand-icon {
  background-image: url('../images/down-arrow.png');
}

.humanitae-collapse-icon {
  background-image: url('../images/up-arrow.png');
}

.humanitae-result-title {
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 700;
  line-height: 150%; /* 24px */
  letter-spacing: 0.16px;
}

/* Specific styling for experts table to remove the underline and link behavior */
.experts-table .td.organization-col .humanitae-result-title {
  text-decoration: none !important;
  color: #111740 !important;
  display: inline-flex;
  align-items: center;
  cursor: default;
  margin-left: 35px !important; /* Add more space to the left of the title to prevent overlap */
  position: relative !important;
}

/* Ensure consistent styling for the title when hovered */
.experts-table .td.organization-col .humanitae-result-title:hover {
  text-decoration: none !important;
  color: #111740 !important;
}

/* Fix toggle button position to prevent overlap with title */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 50 !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Fix organization title spacing */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-result-title {
  margin-left: 30px !important; /* Provide space for the toggle button */
  display: inline-flex !important;
  align-items: center !important;
  white-space: normal !important;
  word-wrap: break-word !important;
  position: relative !important;
  max-width: calc(100% - 35px) !important;
}

/* Stage Icons */
.humanitae-stages-icons {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.humanitae-stage-icon {
  display: inline-block;
  width: 35px;
  height: 35px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  margin-right: 0;
  flex-shrink: 0; /* Prevent icons from shrinking */
}

.stage-lay-the-groundwork {
  background-image: url('../images/icon-groundwork.png');
  order: 1; /* First in sequence */
}

.stage-start-the-process {
  background-image: url('../images/icon-process.png');
  order: 2; /* Second in sequence */
}

.stage-sharpen-the-focus {
  background-image: url('../images/icon-focus.png');
  order: 3; /* Third in sequence */
}

.stage-act-with-purpose {
  background-image: url('../images/icon-purpose.png');
  order: 4; /* Fourth in sequence */
}

.stage-sustain-and-evolve {
  background-image: url('../images/icon-evolve.png');
  order: 5; /* Fifth in sequence */
}

/* Remove table structure and use regular divs for better control */
.humanitae-results-table table,
.humanitae-results-table thead,
.humanitae-results-table tbody,
.humanitae-results-table tr,
.humanitae-results-table th,
.humanitae-results-table td {
  display: block;
  box-sizing: border-box;
}

/* Header styles */
.humanitae-results-table thead {
  margin-bottom: 0;
}

.humanitae-results-table tr {
  display: flex;
  width: 100%;
}

.humanitae-results-table thead tr {
  background: var(--UI-Cornerstone-Navy, #111740);
  padding: 0;
  margin: 0;
  gap: 5px;
}

.authors-col, .topic-col {
  color: var(--UI-Cornerstone-Navy, #111740);
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%; /* 24px */
  letter-spacing: 0.16px;
}

.humanitae-results-table thead th {
  padding: 10px 10px;
  color: var(--UI-White, #FFF);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 18px;
  font-style: normal;
  font-weight: 700;
  line-height: 155%;
  text-align: left;
}

/* Row styles */
.humanitae-results-table tbody tr.humanitae-result-row {
  border-bottom: 1px solid #dee2e6;
  background-color: #fff;
  padding: 0;
  margin: 0;
  gap: 5px;
}

/* Remove flexbox gap and use margins if needed */
.humanitae-results-table tbody tr.humanitae-result-row:nth-child(odd) {
  background-color: #fff;
}

.humanitae-results-table tbody tr.humanitae-result-row:nth-child(even) {
  background-color: #F8F8F9;
}

/* Cell widths */
.humanitae-results-table th.title-col,
.humanitae-results-table td.title-col {
  flex: 2;
  max-width: 402px;
}

.humanitae-results-table th.authors-col,
.humanitae-results-table td.authors-col,
.humanitae-results-table th.organization-col,
.humanitae-results-table td.organization-col,
.humanitae-results-table th.topic-col,
.humanitae-results-table td.topic-col {
  flex: 1;
}

.humanitae-results-table th.stages-col,
.humanitae-results-table td.stages-col {
  flex: 1;
  min-width: 200px;
}

.humanitae-results-table td {
  padding: 14px 10px;
  font-size: 16px; /* Consistent font size */
  vertical-align: top;
  box-sizing: border-box;
}

/* Apply hover effect to rows */
.humanitae-results-table tbody tr.humanitae-result-row:hover {
  background-color: #f0f0f0;
}

/* Expandable details styles */
.humanitae-result-excerpt {
  margin-bottom: 20px;
}

.humanitae-result-excerpt h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 600;
}

.humanitae-read-more {
  display: inline-block;
  margin-top: 10px;
  text-decoration: none !important;
  font-weight: 700 !important;
  color: #4956F3 !important;
  font-family: "IBM Plex Sans" !important;
  font-size: 14px !important;
  font-style: normal !important;
  line-height: 150% !important; /* 21px */
}

.humanitae-read-more:hover {
  text-decoration: underline !important;
}

.humanitae-result-taxonomies {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}

.humanitae-taxonomy-group {
  display: block;
  margin-bottom: 12px;
}

.humanitae-taxonomy-group h4 {
  margin: 0 0 8px 0;
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 155%; /* 21.7px */
  letter-spacing: 0.14px;
  white-space: nowrap;
  display: block;
}

.humanitae-taxonomy-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.humanitae-taxonomy-term {
  display: flex;
  padding: 2.5px 10px 2px 10px;
  align-items: center;
  gap: 24px;
  border-radius: 30px;
  background: linear-gradient(0deg, rgba(17, 23, 64, 0.15) 0%, rgba(17, 23, 64, 0.15) 100%), var(--UI-White, #FFF);
  color: var(--UI-Cornerstone-Navy, #111740);
  font-family: "IBM Plex Sans";
  font-size: 12px;
  font-style: normal;
  font-weight: 600;
  line-height: 155%; /* 18.6px */
  letter-spacing: 0.12px;
}

/* Expert Specific Styles */
.humanitae-expert-info {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  margin-top: 0;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
}

.humanitae-expert-logo {
  flex: 0 0 150px;
  width: 150px;
  height: 92px;
  max-width: 150px;
  border-radius: 5px;
  border: 1px solid #F7F7F9;
  background: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 10px;
  box-sizing: border-box;
}

.humanitae-expert-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  height: auto;
  display: block;
}

.humanitae-expert-description {
  width: 396px;
  max-width: 396px;
  /* flex: 1; */
}

/* Taxonomy section within expert info */
.experts-table .humanitae-expert-info .humanitae-result-taxonomies {
  position: absolute !important;
  top: 0 !important;
  left: 780px !important; /* Fine-tuned for exact alignment with type column */
  width: 510px !important; /* Increased width to prevent wrapping */
  max-width: 510px !important;
  padding-left: 0 !important;
  padding-right: 15px !important;
  margin-top: 0 !important;
}

/* Base styles for result taxonomies */
.humanitae-result-taxonomies {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 16px;
}

/* Remove the old margin-top styling for experts table */
.experts-table .humanitae-result-taxonomies {
  margin-top: 0;
}

/* Media query for mobile responsiveness */
@media (max-width: 1200px) {
  .humanitae-expert-info {
    flex-direction: column;
    gap: 15px;
  }
  
  .experts-table .humanitae-expert-info .humanitae-result-taxonomies {
    width: 100%;
    max-width: 100%;
    margin-top: 15px;
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .humanitae-expert-info {
    flex-direction: column;
  }
  
  .humanitae-expert-logo {
    margin-bottom: 15px;
  }
  
  .humanitae-expert-description, 
  .experts-table .humanitae-expert-info .humanitae-result-taxonomies {
    width: 100%;
    max-width: 100%;
  }
}

/* Pagination */
.humanitae-filter-pagination {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.humanitae-pagination-links {
  display: flex;
  gap: 5px;
}

.humanitae-pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  color: #4e46dc;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.humanitae-pagination-link:hover:not(.disabled):not(.current) {
  background-color: #f8f9fa;
  border-color: #4e46dc;
}

.humanitae-pagination-link.current {
  background-color: #4e46dc;
  border-color: #4e46dc;
  color: white;
  font-weight: 500;
}

.humanitae-pagination-link.disabled {
  color: #6c757d;
  pointer-events: none;
  background-color: #f8f9fa;
}

.humanitae-pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  color: #6c757d;
}

/* Media queries for mobile responsiveness */
@media (max-width: 1024px) {
  .humanitae-filter-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .humanitae-filter-controls {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }
  
  .humanitae-results-count-container {
    position: static;
    width: 100%;
    text-align: right;
  }
  
  .humanitae-filter-results-count {
    width: 100%;
  }
  
  .humanitae-search-row {
    width: 100%;
  }
  
  .humanitae-search-container {
    width: 100%;
  }
  
  .humanitae-filter-container input.humanitae-filter-search-input {
    width: 100% !important;
  }
  
  .humanitae-modal-results-count {
    font-size: 16px;
  }
}

@media (max-width: 1200px) {
  .humanitae-filter-modal-content {
    width: 95%;
    max-width: 95%;
    padding: 30px;
  }
  
  .humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-items {
    grid-template-columns: repeat(3, minmax(300px, 1fr));
  }
}

@media (max-width: 980px) {
  .humanitae-filter-modal-content {
    width: 95%;
    max-width: 95%;
    padding: 25px;
  }
  
  /* Ensure top row filter options display properly on medium screens */
  .humanitae-filter-top-row {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }
  
  /* Keep regular filter groups vertical */
  .humanitae-filter-group-items {
    max-height: 200px;
    overflow-y: auto;
    flex-direction: column;
  }
  
  /* But maintain Institution Context items in a grid layout */
  .humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-items {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    grid-gap: 12px 24px;
  }
}

@media (max-width: 768px) {
  .humanitae-search-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .humanitae-filter-toggle-button {
    width: 100%;
    margin-top: 10px;
  }
  
  .humanitae-filter-modal-content {
    padding: 20px;
  }
  
  .humanitae-modal-results-count {
    font-size: 14px;
  }
  
  /* Stack all filter options in a single column on mobile */
  .humanitae-filter-top-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  /* Ensure consistent vertical scrolling for all groups except Institution Context */
  .humanitae-filter-group-items {
    max-height: 150px; /* Slightly reduced for mobile */
  }
  
  /* Switch to single column on small mobile */
  .humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-group-items {
    grid-template-columns: repeat(1, 1fr);
    grid-gap: 10px;
  }
  
  .humanitae-results-table {
    font-size: 14px;
  }
  
  .humanitae-expert-info {
    flex-direction: column;
  }
  
  .humanitae-expert-logo {
    margin-bottom: 15px;
  }
  
  .humanitae-filter-actions {
    flex-direction: column;
    gap: 20px;
  }
  
  .humanitae-filter-action-buttons {
    width: 100%;
  }
  
  .humanitae-clear-all {
    align-self: flex-start;
  }
}

/* Body styles when modal is open */
body.modal-open {
  overflow: hidden;
}

/* Traditional table styles (for backward compatibility) */
.humanitae-results-table tbody tr.humanitae-result-row:nth-child(odd),
.humanitae-results-table tbody tr.humanitae-result-details:nth-child(even) {
  background-color: #fff;
}

.humanitae-results-table tbody tr.humanitae-result-row:nth-child(even),
.humanitae-results-table tbody tr.humanitae-result-details:nth-child(odd) {
  background-color: #F8F8F9;
}

/* Add standardized cell styles */
.humanitae-results-table .th,
.humanitae-results-table .td {
  box-sizing: border-box;
  overflow: hidden;
}

/* Override existing styles for consistent header padding */
.humanitae-results-table .thead .tr .th {
  padding: 10px 10px;
}

/* Fix data cells to match header alignment */
.humanitae-results-table .tbody .tr .td {
  padding: 14px 10px;
}

/* Special styling for title column to ensure alignment with header */
.humanitae-results-table .tbody .tr.humanitae-result-row .td.title-col {
  padding-left: 40px;
}

/* Ensure content within cells is properly aligned */
.humanitae-results-table .tbody .tr .td > *,
.humanitae-results-table .thead .tr .th > * {
  vertical-align: middle;
}

/* Fix stages icons display */
.humanitae-results-table .stages-col {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
}

.humanitae-stages-icons {
  display: flex;
  flex-direction: row;
  gap: 5px;
}

.humanitae-stage-icon {
  display: inline-block;
  width: 30px;
  height: 30px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  margin-right: 0;
  flex-shrink: 0; /* Prevent icons from shrinking */
}

/* Ensure consistent header and body alignment with fixed width title column */
.humanitae-results-table .thead .tr .th.title-col,
.humanitae-results-table .tbody .tr .td.title-col {
  width: 450px;
  max-width: 450px;
  flex: none;
}

/* Ensure title text doesn't overflow */
.humanitae-results-table .tbody .tr .td.title-col a {
  display: inline-block;
  /* max-width: 350px; */
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
  line-height: 1.4;
  word-wrap: break-word;
}

.insights-table .humanitae-result-title {
  width: 402px !important;
}

/* Ensure title text doesn't overflow */
.experts-table .humanitae-result-title {
  max-width: 350px !important; /* Account for toggle button space */
}

/* Fix for the Field Experts and Insights tables */
.humanitae-result-details > td,
.humanitae-result-details > .td {
  padding: 0;
}

.humanitae-result-details .td.colspan-3,
.humanitae-result-details .td.colspan-4 {
  flex: 1 0 100%;
  width: 100%;
  display: block;
  box-sizing: border-box;
}

/* Updated Result Row Styles (td/th -> div) */
.humanitae-result-row td.title-col,
.humanitae-result-row td.organization-col,
.humanitae-result-row td.topic-col,
.humanitae-result-row .td.title-col,
.humanitae-result-row .td.organization-col,
.humanitae-result-row .td.topic-col {
  position: relative;
  padding-left: 40px;
  padding-top: 14px;
  padding-right: 10px;
  padding-bottom: 12px;
}

/* Fix for experts-table specific issues */
.experts-table .tr.humanitae-result-row {
  align-items: center;
}

.experts-table .th.organization-col,
.experts-table .td.organization-col,
.experts-table .th.type-col,
.experts-table .td.type-col,
.experts-table .th.purpose-col,
.experts-table .td.purpose-col {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
  padding: 14px 10px;
}

.experts-table .td.organization-col {
  padding-left: 40px;
}

.experts-table .tr .td {
  font-size: 16px;
}

/* Fix organization name cell for proper alignment */
.experts-table .td.organization-col a.humanitae-result-title {
  display: block;
  white-space: normal;
  line-height: 1.4;
  word-wrap: break-word;
  overflow: visible;
}

/* Fix for the expanded content */
.experts-table .tr.humanitae-result-details:not([style*="display: none"]) {
  display: block; /* Changed from flex to block for expert table details */
  width: 100%;
}

.experts-table .tr.humanitae-result-details .td.colspan-3 {
  width: 100% !important;
  min-width: 1260px !important; /* Match the wider table width */
  display: block !important;
}

/* Fix for the toggle button in the experts table */
.experts-table .humanitae-toggle-details {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 5;
  margin: 0;
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Fix text alignment and overflow */
.experts-table .td.organization-col {
  position: relative !important;
  padding-left: 20px !important; /* Increase left padding to make space for toggle */
  display: flex !important;
  align-items: center !important;
}

.experts-table .td.type-col, .experts-table .td.purpose-col {
  color: #111740  ;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: 0.16px;
}

/* Ensure the text doesn't overlap with the toggle button */
.experts-table .td.organization-col a.humanitae-result-title {
  position: relative;
  display: inline-block;
  margin-left: 5px;
  max-width: calc(100% - 15px);
  z-index: 1;
  white-space: normal;
  line-height: 1.4;
  word-wrap: break-word;
  overflow: visible;
}

/* Fix for the detail section borders */
.humanitae-results-table .tbody .tr.humanitae-result-details:not([style*="display: none"]) + .tr.humanitae-result-row {
  border-top: none;
}

/* Ensure consistent padding in detail content */
.humanitae-result-details-content {
  padding-top: 20px;
  padding-left: 45px; /* Match the padding of the organization col */
  padding-right: 20px;
  padding-bottom: 30px;
}

/* Clear duplicate style and fix font size issues */
.humanitae-results-table .tbody {
  font-size: initial; /* Reset the font size */
}

/* Override for the main container */
.humanitae-results-table {
  font-size: initial; /* Reset the font size */
}

/* Additional fix for expandable content */
.humanitae-result-details-content {
  padding-left: 40px; /* Reduced padding to match header alignment */
}

.experts-table .td.organization-col a.humanitae-result-title {
  margin-left: 5px; /* Add a bit of space after the toggle button */
}

/* Specific style for the expert info section */
.humanitae-expert-info {
  margin-top: 0;
}

.experts-table .humanitae-result-taxonomies {
  margin-top: 24px;
}

/* Set specific width for topic-col and authors-col in Insights table */
.insights-table .topic-col,
.insights-table .authors-col {
  width: 240px;
  min-width: 240px;
  flex: 0 0 240px;
}

/* Ensure title column doesn't get cut off in Insights table */
.insights-table .title-col {
  width: 402px;
  min-width: 402px;
  flex: 0 0 402px;
  overflow: visible;
  padding-right: 20px; /* Add more padding to the right */
}

/* Ensure authors column respects spacing with title column */
.insights-table .authors-col {
  width: 240px;
  min-width: 240px;
  flex: 0 0 240px;
  margin-left: 10px; /* Add margin to create space */
  padding-left: 10px;
}

/* For topic column, keep the same width but ensure consistent spacing */
.insights-table .topic-col {
  width: 240px;
  min-width: 240px;
  flex: 0 0 240px;
}

/* Ensure title text displays properly */
.insights-table .td.title-col a.humanitae-result-title {
  white-space: normal;
  overflow: visible;
  word-wrap: break-word;
  display: block; /* Ensure block display for proper spacing */
  width: 100%;
}

/* Reduce stages column width in Insights table to make room */
.insights-table .stages-col {
  padding-left: 30px !important;
  min-width: 240px;
  flex: 0 0 180px;
}

/* Results Count Container - New Style */
.humanitae-results-count-container {
  display: flex;
  justify-content: flex-end;
  position: absolute;
  top: -26px;
  right: 0;
  z-index: 1;
  background: transparent; 
  padding: 0;
  margin: 0;
}

.humanitae-filter-results-count {
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 150%;
  letter-spacing: 0.16px;
  text-align: right;
}

.humanitae-filter-results-count strong {
  font-weight: 700;
}

/* Remove any margin or padding from original results count */
.humanitae-filter-results-count:not(:first-child) {
  margin: 0;
  padding: 0;
}

@media (max-width: 1200px) {
  .humanitae-search-container {
    width: 350px;
  }
  
  .humanitae-filter-container input.humanitae-filter-search-input {
    width: 350px !important;
  }
}

/* Modal loading state */
.humanitae-filter-modal-content.loading {
  position: relative;
}

.humanitae-filter-modal-content.loading:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  z-index: 10;
}

.humanitae-filter-modal-content.loading:before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin-top: -20px;
  margin-left: -20px;
  border-radius: 50%;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #4e46dc;
  animation: humanitae-spin 1s linear infinite;
  z-index: 11;
}

.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-checkbox input {
  margin-right: 8px;
  margin-top: 0;
  flex-shrink: 0;
}

/* Make the entire label text stay on one line */
.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-checkbox > span:not(.humanitae-filter-count) {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  display: inline;
  font-size: 15px;
  max-width: none;
}

/* Style the count to ensure it stays with the label */
.humanitae-filter-group[data-taxonomy="institution_context"] .humanitae-filter-count {
  white-space: nowrap;
  margin-left: 4px;
  color: #777;
}

.humanitae-modal-results-count {
  color: #111740;
  font-family: Poppins;
  font-size: 20px;
  font-style: normal;
  font-weight: 600;
  line-height: 130%; /* 26px */
  letter-spacing: -0.3px;
  text-align: right;
}

/* Case Studies and Tools tables styles - match Insights styles */
.case-studies-table .humanitae-result-title,
.tools-table .humanitae-result-title {
  max-width: 350px !important;
  font-family: "IBM Plex Sans" !important;
  font-size: 16px !important;
  font-style: normal !important;
  font-weight: 700 !important;
  line-height: 150% !important; /* 24px */
  letter-spacing: 0.16px !important;
  text-decoration-line: underline !important;
}

.case-studies-table .title-col,
.tools-table .title-col {
  min-width: 280px;
  padding-left: 40px;
  position: relative;
  vertical-align: top;
  padding-left: 45px; /* Slightly increased to give more space for the toggle button */
}

.case-studies-table .authors-col,
.tools-table .authors-col {
  min-width: 150px;
  vertical-align: top;
  padding-left: 10px;
  padding-right: 10px;
}

.case-studies-table .td.title-col a.humanitae-result-title,
.tools-table .td.title-col a.humanitae-result-title {
  display: block;
  white-space: normal;
  line-height: 1.4;
  word-wrap: break-word;
  overflow: visible;
  margin-left: 5px; /* Add a bit of space after the toggle button */
}

.case-studies-table .stages-col,
.tools-table .stages-col {
  min-width: 200px;
  vertical-align: top;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.humanitae-institution-info {
  margin-top: 10px;
  font-family: "IBM Plex Sans";
  font-size: 14px;
  color: var(--UI-Cornerstone-Navy, #111740);
}

.humanitae-institution-type {
  font-style: italic;
  margin-left: 5px;
}

/* ULTIMATE EXPERT TABLE FIX - START */
/* These ultra-specific selectors with !important override all other styles */

/* Fix the organization column */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col {
  position: relative !important;
  padding-left: 20px !important; /* Increase padding to make space for toggle */
  padding-right: 10px !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
}

/* Fix the toggle button position precisely */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  background: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Fix the icon display - default state (collapsed) */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details .humanitae-expand-icon {
  width: 28px !important;
  height: 28px !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  display: block !important;
  background-image: url('../images/down-arrow.png') !important;
}

/* Fix the icon display - expanded state */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details .humanitae-collapse-icon {
  width: 24px !important;
  height: 24px !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  display: none !important; /* Hide by default */
  background-image: url('../images/up-arrow.png') !important;
}

/* Ensure initial state has expand icon visible, collapse icon hidden */
body .humanitae-results-table.experts-table .humanitae-toggle-details .humanitae-expand-icon {
  display: block !important;
}

body .humanitae-results-table.experts-table .humanitae-toggle-details .humanitae-collapse-icon {
  display: none !important;
}

/* Fix the title display */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col a.humanitae-result-title {
  display: inline-block !important;
  max-width: calc(100% - 20px) !important;
  white-space: normal !important;
  overflow: visible !important;
  word-wrap: break-word !important;
  line-height: 1.4 !important;
}

/* Reset any padding that might interfere with our layout */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td {
  box-sizing: border-box !important;
}

/* Force the column to have enough width */
body .humanitae-results-table.experts-table .th.organization-col,
body .humanitae-results-table.experts-table .td.organization-col {
  min-width: 300px !important;
  width: auto !important;
  flex: 2 !important;
}

/* ULTIMATE EXPERT TABLE FIX - END */

/* EXPERT TOGGLE ICONS - MORE SPECIFIC */
/* These rules ensure the proper display of the toggle icons */

/* Default state - DOWN arrow visible, UP arrow hidden */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details .humanitae-expand-icon {
  display: block !important;
  width: 28px !important;
  height: 28px !important;
  background-image: url('../images/down-arrow.png') !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details .humanitae-collapse-icon {
  display: none !important;
  width: 24px !important;
  height: 24px !important;
  background-image: url('../images/up-arrow.png') !important;
  background-size: contain !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

/* Ensure proper positioning of the toggle button */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col .humanitae-toggle-details {
  position: absolute !important;
  left: 10px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: 1000 !important;
  background: none !important;
  border: none !important;
  outline: none !important;
  cursor: pointer !important;
}

/* Ensure there's space for the toggle and adequate padding */
body .humanitae-results-table.experts-table .tbody .tr.humanitae-result-row .td.organization-col {
  padding-left: 16px !important;
  position: relative !important;
}

/* Experts Table Sort Button Styles - Specific to experts-table */
.experts-table .humanitae-sort-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 5px;
  cursor: pointer;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
}

/* Override default WordPress button hover styles */
.experts-table .th .humanitae-sort-button:hover,
.experts-table .th .humanitae-sort-button:focus {
  background: none !important;
  color: inherit !important;
}

.experts-table .humanitae-sort-button .sort-icon {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease-in-out, filter 0.2s ease-in-out;
}

.experts-table .humanitae-sort-button:hover .sort-icon {
  filter: drop-shadow(0 0 1px #4e46dc) brightness(1.1);
}

.experts-table .humanitae-sort-button.asc .sort-icon,
.experts-table .humanitae-sort-button.desc .sort-icon {
  filter: drop-shadow(0 0 2px #4e46dc) brightness(1.2);
}

.experts-table .humanitae-sort-button.asc .sort-icon {
  transform: rotate(0deg);
}

.experts-table .humanitae-sort-button.desc .sort-icon {
  transform: rotate(180deg);
}

/* Ensure organization header has padding for the sort button */
.experts-table .th.organization-col {
  display: flex;
  align-items: center;
}

/* Preferred Partner Icon */
.experts-table .preferred-icon {
  padding-left: 8px;
  /* width: 27px; */
  height: 24px;
  /* aspect-ratio: 9/8; */
  vertical-align: middle;
  display: inline-block !important; /* Force display */
  position: relative;
  top: -1px; /* Slight adjustment to align with text */
  margin-right: 2px; /* Add a slight margin to the right */
  z-index: 100; /* Ensure it's above other elements */
  visibility: visible !important; /* Force visibility */
  opacity: 1 !important; /* Ensure full opacity */
}

/* Make sure the icon stays with the text */
.experts-table .td.organization-col a.humanitae-result-title {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  max-width: calc(100% - 15px) !important; /* Ensure enough space for the text and icon */
}

/* Responsive styles for preferred icon */
@media (max-width: 768px) {
  .experts-table .preferred-icon {
    /* width: 24px; */
    height: 21px;
    padding-left: 4px;
  }
  
  .experts-table .td.organization-col a.humanitae-result-title {
    font-size: 14px !important;
  }
}

/* Added preferred partner icon - 2024-06-25 */

/* Update column widths for Field Experts table - 2024-06-26 */
.experts-table .th.organization-col,
.experts-table .td.organization-col {
  width: 780px !important; /* Increased from 720px */
  min-width: 780px !important;
  max-width: 780px !important;
  flex: 0 0 780px !important;
}

.experts-table .th.type-col,
.experts-table .td.type-col {
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  flex: 0 0 240px !important;
}

.experts-table .th.purpose-col,
.experts-table .td.purpose-col {
  width: 240px !important;
  min-width: 240px !important;
  max-width: 240px !important;
  flex: 0 0 240px !important;
}

/* Set table to a minimum width to prevent wrapping */
.experts-table {
  min-width: 1260px !important; /* Increased from 1200px */
  width: 100% !important;
  overflow: visible !important;
}

/* Container for the experts table to allow full width */
.humanitae-filter-results-wrapper {
  width: 100% !important;
  max-width: 1260px !important; /* Match table width */
  margin: 0 auto !important;
  position: relative !important;
  overflow: visible !important; /* Allow content to be visible */
}

/* Added specific column widths for Field Experts table - 2024-06-26 */

/* Update positioning for toggle button with new column widths */
.experts-table .td.organization-col .humanitae-toggle-details {
  position: absolute !important;
  left: 15px !important; /* Increase left position slightly for better visibility in wider column */
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 50 !important;
}

/* Ensure title has enough padding with new column width */
.experts-table .td.organization-col a.humanitae-result-title {
  padding-left: 15px !important;
  margin-left: 20px !important; /* Add more margin for the wider column */
}

/* Added specific column widths for Field Experts table - 2024-06-26 */

/* Responsive styles for smaller screens */
@media (max-width: 1280px) {
  .humanitae-filter-container {
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow-x: hidden !important;
  }
  
  .humanitae-filter-results-wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
  }
  
  .experts-table {
    min-width: 1260px !important; /* Keep the minimum width */
    overflow-x: visible !important;
  }
}

/* Added specific column widths for Field Experts table - 2024-06-26 */

/* Expert taxonomy styling - vertical layout */
.experts-table .humanitae-taxonomy-group {
  display: block;
  margin-bottom: 12px;
}

.experts-table .humanitae-taxonomy-group h4 {
  margin: 0 0 8px 0;
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 155%; /* 21.7px */
  letter-spacing: 0.14px;
  white-space: nowrap;
  display: block;
}

.experts-table .humanitae-taxonomy-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
/* Retain the horizontal layout for the humanitae-taxonomy-group */
.humanitae-taxonomy-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  /* margin-bottom: 12px; */
}

.humanitae-taxonomy-group h4 {
  margin: 0 12px 0 0;
  color: #111740;
  font-family: "IBM Plex Sans";
  font-size: 14px;
  font-style: normal;
  font-weight: 700;
  line-height: 155%; /* 21.7px */
  letter-spacing: 0.14px;
  white-space: nowrap;
}

.humanitae-taxonomy-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}

/* STRUCTURED ALIGNMENT FIX - 2024-06-27 */
/* Uses the existing HTML structure but positions elements to match table columns */

/* Remove the grid display as it doesn't work with the existing HTML structure */
.experts-table .humanitae-result-details-content {
  position: relative !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-top: 20px !important;
  margin: 0 !important;
  width: 100% !important;
  display: block !important;
}

/* Position the expert info to align with the organization column */
.experts-table .humanitae-result-details-content .humanitae-expert-info {
  position: relative !important;
  display: block !important;
  padding-left: 20px !important;
  padding-right: 20px !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Float the logo and description to match organization column */
.experts-table .humanitae-expert-logo,
.experts-table .humanitae-expert-description {
  float: left !important;
  margin-right: 20px !important;
}

.experts-table .humanitae-expert-logo {
  width: 150px !important;
  max-width: 150px !important;
}

.experts-table .humanitae-expert-description {
  width: 396px !important;
  max-width: 396px !important;
}

/* Position the taxonomies to align with the type column */
.experts-table .humanitae-expert-info .humanitae-result-taxonomies {
  position: absolute !important;
  top: 0 !important;
  left: 780px !important; /* Fine-tuned for exact alignment with type column */
  width: 510px !important; /* Increased width to prevent wrapping */
  max-width: 510px !important;
  padding-left: 0 !important;
  padding-right: 15px !important;
  margin-top: 0 !important;
}

/* Mobile responsiveness */
@media (max-width: 1200px) {
  .experts-table .humanitae-expert-logo,
  .experts-table .humanitae-expert-description {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 20px !important;
  }
  
  .experts-table .humanitae-expert-info .humanitae-result-taxonomies {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    left: auto !important;
    margin-top: 20px !important;
  }
}

/* Add clearfix to handle floated elements */
.experts-table .humanitae-expert-info::after {
  content: "" !important;
  display: table !important;
  clear: both !important;
}

/* Position the taxonomies to align with the type column - final adjustment */
.experts-table .humanitae-expert-info .humanitae-result-taxonomies {
  position: absolute !important;
  top: 0 !important;
  left: 780px !important; /* Fine-tuned for exact alignment with type column */
  width: 510px !important; /* Increased width to prevent wrapping */
  max-width: 510px !important;
  padding-left: 0 !important;
  padding-right: 15px !important;
  margin-top: 0 !important;
}

/* Ensure taxonomies stand out visually */
.experts-table .humanitae-taxonomy-group {
  margin-bottom: 15px !important;
}

.experts-table .humanitae-taxonomy-group h4 {
  margin-bottom: 8px !important;
  font-weight: 700 !important;
}

/* Fix for Purpose taxonomy checkbox with long label */
.humanitae-filter-group-items .humanitae-filter-checkbox {
  display: flex;
  align-items: flex-start; /* Changed from center to allow better wrapping */
  line-height: 1.3;
  min-height: 30px; /* Ensure consistent height */
}

.humanitae-filter-group-items .humanitae-filter-checkbox input[type="checkbox"] {
  margin-top: 3px; /* Align checkbox with first line of text */
  flex-shrink: 0; /* Prevent checkbox from shrinking */
}

/* Make sure Purpose checkboxes have proper width */
.humanitae-filter-options .humanitae-filter-top-row .humanitae-filter-group:nth-child(3) .humanitae-filter-checkbox {
  width: 100%;
  max-width: 100%;
}

/* Styles for Type taxonomy in bottom row for Field Experts */
.humanitae-filter-group[data-taxonomy="type"] {
  width: 100%;
  margin-top: 10px;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-title {
  margin-bottom: 15px;
  position: relative;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-title::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background-color: #111740;
  margin-top: 10px;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  grid-gap: 12px 24px;
  max-height: none;
  overflow-y: visible;
  width: 100%;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-checkbox {
  margin: 0;
  width: 100%;
  min-width: 0;
  max-width: none;
  display: flex;
  align-items: flex-start;
  padding: 3px 0;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.3;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-checkbox input {
  margin-right: 8px;
  margin-top: 3px;
  flex-shrink: 0;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-checkbox > span:not(.humanitae-filter-count) {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  display: inline;
  font-size: 15px;
  max-width: 90%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Adjust width of Type taxonomy filter items in the grid */
.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-items {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  grid-gap: 12px 24px;
  max-height: none;
  overflow-y: visible;
  width: 100%;
}

.humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-count {
  white-space: nowrap;
  margin-left: 4px;
  color: #777;
}

/* Media queries for responsive design */
@media (max-width: 1200px) {
  .humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-items {
    grid-template-columns: repeat(3, minmax(300px, 1fr));
  }
}

@media (max-width: 980px) {
  .humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-items {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    grid-gap: 12px 24px;
  }
}

@media (max-width: 768px) {
  .humanitae-filter-group[data-taxonomy="type"] .humanitae-filter-group-items {
    grid-template-columns: repeat(1, 1fr);
    grid-gap: 10px;
  }
}
