/**
 * Service Archive Widget Styles
 *
 * All selectors scoped under .ils-sa to prevent conflicts.
 *
 * @package InLightStudios
 * @since   1.0.0
 */

/* ============================================================
   LAYOUT
   ============================================================ */

.ils-sa {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    sans-serif;
  overflow-x: hidden;
}

.ils-sa *,
.ils-sa *::before,
.ils-sa *::after {
  box-sizing: border-box;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.ils-sa__sidebar {
  width: 280px;
  min-width: 280px;
  flex-shrink: 0;
  background: #ffffff;
  padding: 0 32px 0 0;
}

/* Sidebar heading (Services with minus icon) */
.ils-sa__sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 24px 0;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 0;
}

.ils-sa__sidebar-title {
  font-size: 28px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.ils-sa__sidebar-collapse-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: #1f2937;
}

.ils-sa__sidebar-collapse-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Filter groups (categories) */
.ils-sa__filter-group {
  border-bottom: none;
  margin-bottom: 0;
}

.ils-sa__group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  cursor: pointer;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  transition: all 0.25s ease;
  border-radius: 8px;
  margin: 8px 0;
  background: transparent;
}

.ils-sa__group-header:hover {
  background: #f9fafb;
}

/* .ils-sa__filter-group.is-open .ils-sa__group-header {
	background: #f3f4f6;
} */

.ils-sa__group-title {
  font-size: 17px;
  font-weight: 500;
  color: #6b7280;
  line-height: 1.3;
  margin: 0;
  padding: 0;
  transition: color 0.25s ease;
}

.ils-sa__filter-group.is-open .ils-sa__group-title {
  color: #dc2626;
  font-weight: 600;
}

.ils-sa__group-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #9ca3af;
  transition:
    transform 0.3s ease,
    color 0.25s ease;
}

.ils-sa__filter-group.is-open .ils-sa__group-icon {
  color: #dc2626;
  transform: rotate(180deg);
}

.ils-sa__group-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ils-sa__group-body {
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  opacity: 0;
  padding: 0 16px;
}

.ils-sa__filter-group.is-open .ils-sa__group-body {
  opacity: 1;
  padding: 0 16px 12px 16px;
}

.ils-sa__term-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ils-sa__term-item {
  margin: 0;
  padding: 0;
}

.ils-sa__term-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 400;
  color: #9ca3af;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1.4;
  border-radius: 6px;
  position: relative;
  gap: 8px;
}

.ils-sa__term-item:not(.has-children) .ils-sa__term-link {
  padding-left: 24px;
}

.ils-sa__term-link:hover {
  color: #6b7280;
  background: #f9fafb;
}

.ils-sa__term-link:focus {
  border: unset;
  outline: unset;
}

.ils-sa__term-link.is-active {
  color: #dc2626;
  font-weight: 500;
  background: transparent;
}

.ils-sa__term-name {
  display: block;
  flex: 1;
}

.ils-sa__term-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #9ca3af;
  transition:
    transform 0.2s ease,
    color 0.2s ease;
}

.ils-sa__term-toggle-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ils-sa__term-item.is-expanded
  > .ils-sa__term-link
  > .ils-sa__term-toggle-icon {
  transform: rotate(90deg);
}

.ils-sa__term-link:hover .ils-sa__term-toggle-icon {
  color: #6b7280;
}

.ils-sa__term-check {
  display: flex;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #dc2626;
  flex-shrink: 0;
}

.ils-sa__term-link.is-active .ils-sa__term-check {
  opacity: 1;
}

.ils-sa__term-check svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.5;
}

/* Child terms indentation and collapsing */
.ils-sa__term-children {
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ils-sa__term-item.is-expanded > .ils-sa__term-children {
  max-height: 2000px;
}

.ils-sa__term-children .ils-sa__term-link {
  font-size: 14px;
  color: #9ca3af;
  padding: 8px 12px;
}

.ils-sa__term-children
  .ils-sa__term-item:not(.has-children)
  .ils-sa__term-link {
  padding-left: 24px;
}

.ils-sa__term-children .ils-sa__term-link:hover {
  color: #6b7280;
  background: #f9fafb;
}

.ils-sa__term-children .ils-sa__term-link.is-active {
  color: #dc2626;
  font-weight: 500;
  background: transparent;
}

/* Mobile sidebar toggle */
.ils-sa__sidebar-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  margin-bottom: 16px;
  width: 100%;
}

.ils-sa__sidebar-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.ils-sa__sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ils-sa__sidebar-overlay.is-visible {
  opacity: 1;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */

.ils-sa__content {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  width: 100%;
}

.ils-sa__heading {
  font-size: 32px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 12px 0;
  line-height: 1.2;
}

.ils-sa__description {
  font-size: 15px;
  font-weight: 400;
  color: #4b5563;
  line-height: 1.65;
  margin: 0 0 24px 0;
  max-width: 640px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================================
   TOOLBAR
   ============================================================ */

.ils-sa__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.ils-sa__result-count {
  font-size: 14px;
  font-weight: 400;
  color: #6b7280;
  white-space: nowrap;
}

.ils-sa__toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ils-sa__search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ils-sa__search-icon {
  position: absolute;
  left: 10px;
  display: flex;
  align-items: center;
  pointer-events: none;
  color: #9ca3af;
}

.ils-sa__search-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.ils-sa__search-input {
  width: 200px;
  padding: 8px 12px 8px 34px !important;
  font-size: 13px;
  font-weight: 400;
  color: #374151;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  font-family: inherit;
}

.ils-sa__search-input::placeholder {
  color: #9ca3af;
}

.ils-sa__search-input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.ils-sa__view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    opacity 0.2s ease;
  background-color: #dc2626;
  color: #ffffff;
  padding: 0;
}

.ils-sa__view-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.ils-sa__view-btn:not(.is-active) {
  opacity: 0.7;
}

.ils-sa__view-btn.is-active {
  opacity: 1;
  background-color: #b91c1c;
}

.ils-sa__view-btn:hover {
  opacity: 1;
}

/* ============================================================
   GRID CARDS
   ============================================================ */

.ils-sa__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 100%;
}

.ils-sa__grid.is-list {
  grid-template-columns: 1fr;
  gap: 12px;
}

.ils-sa__card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  aspect-ratio: 4 / 3;
}

.ils-sa__card-link {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.ils-sa__card-image-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.ils-sa__card-image {
  width: 100%;
  height: 100% !important;
  object-fit: cover;
  transition: transform 0.4s ease;
  display: block;
  max-width: 100%;
}

.ils-sa__card:hover .ils-sa__card-image {
  transform: scale(1.06);
}

.ils-sa__card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.55) 100%
  );
  transition: background 0.3s ease;
  pointer-events: none;
}

.ils-sa__card:hover .ils-sa__card-overlay {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 30%,
    rgba(0, 0, 0, 0.65) 100%
  );
}

.ils-sa__card-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.ils-sa__card-title {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  margin: 0;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.ils-sa__card-description {
  display: none;
  margin: 0;
  padding: 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ============================================================
   LIST VIEW CARDS
   ============================================================ */

.ils-sa__grid.is-list .ils-sa__card {
  aspect-ratio: unset;
  display: flex;
  flex-direction: row;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  height: auto;
}

.ils-sa__grid.is-list .ils-sa__card-link {
  display: flex;
  flex-direction: row;
  height: auto;
}

.ils-sa__grid.is-list .ils-sa__card-image-wrap {
  position: relative;
  width: 200px;
  min-width: 200px;
  height: 140px;
  inset: unset;
}

.ils-sa__grid.is-list .ils-sa__card-overlay {
  display: none;
}

.ils-sa__grid.is-list .ils-sa__card-content {
  position: relative;
  padding: 16px 20px;
  justify-content: flex-start;
  align-items: flex-start;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.ils-sa__grid.is-list .ils-sa__card-title {
  color: #111827 !important;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  text-shadow: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.ils-sa__grid.is-list .ils-sa__card-description {
  display: block;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

/* ============================================================
   PAGINATION / LOAD MORE
   ============================================================ */

.ils-sa__pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
}

.ils-sa__load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
}

.ils-sa__load-more-btn {
  padding: 12px 32px;
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  background-color: #dc2626;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: inherit;
}

.ils-sa__load-more-btn:hover {
  background-color: #b91c1c;
}

.ils-sa__load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ils-sa__page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  border-radius: 4px;
  background: transparent;
}

.ils-sa__page-link:hover:not(.is-disabled):not(.is-active) {
  background: #f9fafb;
  color: #111827;
}

.ils-sa__page-link.is-active {
  background: #dc2626;
  color: #ffffff;
  cursor: default;
}

.ils-sa__page-link.is-disabled {
  cursor: not-allowed;
  pointer-events: none;
  opacity: 0.4;
}

.ils-sa__page-prev,
.ils-sa__page-next {
  padding: 0;
  width: 36px;
}

.ils-sa__page-prev svg,
.ils-sa__page-next svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ils-sa__page-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  font-size: 14px;
  font-weight: 500;
  user-select: none;
  color: #9ca3af;
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.ils-sa__grid.is-loading {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ils-sa__spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.ils-sa__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: ilsSaSpin 0.6s linear infinite;
}

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

/* ============================================================
   NO RESULTS
   ============================================================ */

.ils-sa__no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: #9ca3af;
  font-size: 15px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Large Desktop (1200px+) - Default styles above */

/* Desktop to Tablet (1024px - 1199px) */
@media (max-width: 1199px) {
  .ils-sa {
    gap: 32px;
  }

  .ils-sa__sidebar {
    width: 260px;
    min-width: 260px;
    padding: 0 24px 0 0;
  }

  .ils-sa__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }

  .ils-sa__heading {
    font-size: 28px;
  }

  .ils-sa__card-title {
    font-size: 13px;
  }
}

/* Tablet Landscape (900px - 1023px) */
@media (max-width: 1023px) {
  .ils-sa {
    gap: 24px;
  }

  .ils-sa__sidebar {
    width: 240px;
    min-width: 240px;
    padding: 0 20px 0 0;
  }

  .ils-sa__sidebar-title {
    font-size: 24px;
  }

  .ils-sa__group-title {
    font-size: 16px;
  }

  .ils-sa__term-link {
    font-size: 14px;
    padding: 9px 10px;
  }

  .ils-sa__term-children .ils-sa__term-link {
    font-size: 13px;
    padding: 7px 10px;
  }

  .ils-sa__heading {
    font-size: 26px;
    margin-bottom: 10px;
  }

  .ils-sa__description {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .ils-sa__toolbar {
    margin-bottom: 20px;
    gap: 12px;
  }

  .ils-sa__search-input {
    width: 180px;
    font-size: 13px;
  }

  .ils-sa__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .ils-sa__card-content {
    padding: 14px;
  }

  .ils-sa__card-title {
    font-size: 13px;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    width: 180px;
    min-width: 180px;
    height: 130px;
  }

  .ils-sa__grid.is-list .ils-sa__card-content {
    padding: 14px 18px;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 17px;
    font-weight: 700;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 13px;
  }
}

/* Tablet Portrait (768px - 899px) */
@media (max-width: 899px) {
  .ils-sa {
    flex-direction: column;
    gap: 0;
  }

  .ils-sa__sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    min-width: 280px;
    height: 100vh;
    height: 100dvh;
    z-index: 9999;
    border-right: 1px solid #e5e7eb;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transition: left 0.3s ease;
    box-shadow: none;
    background: #ffffff;
  }

  .ils-sa__sidebar.is-open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }

  .ils-sa__sidebar-toggle {
    display: flex;
  }

  .ils-sa__sidebar-overlay.is-visible {
    display: block;
  }

  .ils-sa__sidebar-close {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 16px;
  }

  .ils-sa__sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    transition:
      background-color 0.2s ease,
      border-color 0.2s ease;
  }

  .ils-sa__sidebar-close-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
  }

  .ils-sa__sidebar-close-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
  }

  .ils-sa__sidebar-heading {
    padding: 16px 0 20px 0;
  }

  .ils-sa__sidebar-title {
    font-size: 22px;
  }

  .ils-sa__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .ils-sa__heading {
    font-size: 24px;
    margin-bottom: 10px;
  }

  .ils-sa__description {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
  }

  .ils-sa__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
  }

  .ils-sa__result-count {
    font-size: 13px;
  }

  .ils-sa__toolbar-actions {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .ils-sa__search-wrap {
    flex: 1;
  }

  .ils-sa__search-input {
    width: 100%;
    font-size: 14px;
    padding: 9px 12px 9px 34px !important;
  }

  .ils-sa__view-btn {
    width: 38px;
    height: 38px;
  }

  .ils-sa__view-btn svg {
    width: 17px;
    height: 17px;
  }

  .ils-sa__card-content {
    padding: 12px;
  }

  .ils-sa__card-title {
    font-size: 12px;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    width: 160px;
    min-width: 160px;
    height: 120px;
  }

  .ils-sa__grid.is-list .ils-sa__card-content {
    padding: 12px 16px;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 16px;
    font-weight: 700;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 12px;
  }

  .ils-sa__pagination {
    gap: 6px;
    margin-top: 28px;
  }

  .ils-sa__page-link {
    min-width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .ils-sa__load-more {
    margin-top: 28px;
  }

  .ils-sa__load-more-btn {
    padding: 11px 28px;
    font-size: 13px;
  }
}

/* Mobile Landscape (640px - 767px) */
@media (max-width: 767px) {
  .ils-sa__sidebar {
    width: 260px;
    min-width: 260px;
    left: -260px;
  }

  .ils-sa__heading {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .ils-sa__description {
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 18px;
    max-width: 100%;
  }

  .ils-sa__toolbar {
    margin-bottom: 18px;
    gap: 10px;
  }

  .ils-sa__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .ils-sa__card {
    border-radius: 6px;
  }

  .ils-sa__card-content {
    padding: 10px;
  }

  .ils-sa__card-title {
    font-size: 11px;
  }

  .ils-sa__grid.is-list .ils-sa__card {
    border-radius: 6px;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    width: 140px;
    min-width: 140px;
    height: 110px;
  }

  .ils-sa__grid.is-list .ils-sa__card-content {
    padding: 10px 14px;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 15px;
    font-weight: 700;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 11px;
  }

  .ils-sa__pagination {
    gap: 5px;
    margin-top: 24px;
    flex-wrap: wrap;
  }

  .ils-sa__page-link {
    min-width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .ils-sa__page-prev svg,
  .ils-sa__page-next svg {
    width: 14px;
    height: 14px;
  }

  .ils-sa__page-dots {
    min-width: 28px;
    height: 32px;
    font-size: 12px;
  }

  .ils-sa__load-more {
    margin-top: 24px;
  }

  .ils-sa__load-more-btn {
    padding: 10px 24px;
    font-size: 13px;
  }
}

/* Mobile Portrait (480px - 639px) */
@media (max-width: 639px) {
  .ils-sa__sidebar {
    width: 240px;
    min-width: 240px;
    left: -240px;
    padding: 16px;
  }

  .ils-sa__sidebar-heading {
    padding: 12px 0 16px 0;
  }

  .ils-sa__sidebar-title {
    font-size: 20px;
  }

  .ils-sa__group-header {
    padding: 14px 12px;
    margin: 6px 0;
  }

  .ils-sa__group-title {
    font-size: 15px;
  }

  .ils-sa__term-link {
    font-size: 13px;
    padding: 8px 10px;
  }

  .ils-sa__term-children .ils-sa__term-link {
    font-size: 12px;
    padding: 6px 10px;
  }

  .ils-sa__heading {
    font-size: 20px;
    margin-bottom: 8px;
  }

  .ils-sa__description {
    font-size: 13px;
    margin-bottom: 16px;
  }

  .ils-sa__toolbar {
    margin-bottom: 16px;
  }

  .ils-sa__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ils-sa__card {
    aspect-ratio: 16 / 10;
  }

  .ils-sa__card-content {
    padding: 12px;
  }

  .ils-sa__card-title {
    font-size: 13px;
  }

  .ils-sa__grid.is-list .ils-sa__card {
    border-radius: 6px;
  }

  .ils-sa__grid.is-list .ils-sa__card-link {
    flex-direction: row;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    width: 120px;
    min-width: 120px;
    height: 100px;
  }

  .ils-sa__grid.is-list .ils-sa__card-content {
    padding: 10px 12px;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 15px;
    font-weight: 700;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 11px;
    display: block;
  }

  .ils-sa__pagination {
    margin-top: 20px;
  }

  .ils-sa__load-more {
    margin-top: 20px;
  }
}

/* Small Mobile (320px - 479px) */
@media (max-width: 479px) {
  .ils-sa__sidebar {
    width: 100%;
    min-width: unset;
    left: -100%;
    padding: 16px;
  }

  .ils-sa__sidebar-toggle {
    padding: 9px 14px;
    font-size: 13px;
    margin-bottom: 14px;
  }

  .ils-sa__sidebar-toggle svg {
    width: 16px;
    height: 16px;
  }

  .ils-sa__sidebar-heading {
    padding: 10px 0 14px 0;
  }

  .ils-sa__sidebar-title {
    font-size: 18px;
  }

  .ils-sa__sidebar-collapse-icon {
    width: 20px;
    height: 20px;
  }

  .ils-sa__sidebar-collapse-icon svg {
    width: 18px;
    height: 18px;
  }

  .ils-sa__group-header {
    padding: 12px 10px;
    margin: 4px 0;
    border-radius: 6px;
  }

  .ils-sa__group-title {
    font-size: 14px;
  }

  .ils-sa__group-icon {
    width: 18px;
    height: 18px;
  }

  .ils-sa__group-icon svg {
    width: 14px;
    height: 14px;
  }

  .ils-sa__term-link {
    font-size: 13px;
    padding: 7px 8px;
    gap: 6px;
  }

  .ils-sa__term-item:not(.has-children) .ils-sa__term-link {
    padding-left: 20px;
  }

  .ils-sa__term-toggle-icon {
    width: 18px;
    height: 18px;
  }

  .ils-sa__term-toggle-icon svg {
    width: 14px;
    height: 14px;
  }

  .ils-sa__term-check svg {
    width: 13px;
    height: 13px;
  }

  .ils-sa__term-children {
    padding: 0 0 0 16px;
  }

  .ils-sa__term-children .ils-sa__term-link {
    font-size: 12px;
    padding: 6px 8px;
  }

  .ils-sa__term-children
    .ils-sa__term-item:not(.has-children)
    .ils-sa__term-link {
    padding-left: 20px;
  }

  .ils-sa__heading {
    font-size: 18px;
    margin-bottom: 6px;
    line-height: 1.3;
  }

  .ils-sa__description {
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 14px;
  }

  .ils-sa__toolbar {
    margin-bottom: 14px;
    gap: 10px;
  }

  .ils-sa__result-count {
    font-size: 12px;
  }

  .ils-sa__search-input {
    font-size: 13px;
    padding: 8px 10px 8px 32px !important;
  }

  .ils-sa__search-icon {
    left: 9px;
  }

  .ils-sa__search-icon svg {
    width: 15px;
    height: 15px;
  }

  .ils-sa__view-btn {
    width: 36px;
    height: 36px;
  }

  .ils-sa__view-btn svg {
    width: 15px;
    height: 15px;
  }

  .ils-sa__grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ils-sa__card {
    aspect-ratio: 16 / 10;
    border-radius: 6px;
  }

  .ils-sa__card-content {
    padding: 10px;
  }

  .ils-sa__card-title {
    font-size: 12px;
    line-height: 1.4;
  }

  .ils-sa__grid.is-list .ils-sa__card-link {
    flex-direction: column;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    width: 100%;
    min-width: unset;
    height: 180px;
  }

  .ils-sa__grid.is-list .ils-sa__card-content {
    padding: 12px;
    width: 100%;
    align-items: center;
    text-align: center;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 12px;
    text-align: center;
    display: block;
  }

  .ils-sa__pagination {
    gap: 4px;
    margin-top: 18px;
  }

  .ils-sa__page-link {
    min-width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .ils-sa__page-prev svg,
  .ils-sa__page-next svg {
    width: 13px;
    height: 13px;
  }

  .ils-sa__page-dots {
    min-width: 24px;
    height: 30px;
    font-size: 12px;
  }

  .ils-sa__load-more {
    margin-top: 18px;
  }

  .ils-sa__load-more-btn {
    padding: 9px 20px;
    font-size: 12px;
    border-radius: 5px;
  }

  .ils-sa__no-results {
    padding: 32px 16px;
    font-size: 13px;
  }

  .ils-sa__spinner {
    width: 28px;
    height: 28px;
    border-width: 2.5px;
  }
}

/* Extra Small Mobile (< 360px) */
@media (max-width: 359px) {
  .ils-sa__heading {
    font-size: 16px;
  }

  .ils-sa__description {
    font-size: 11px;
  }

  .ils-sa__toolbar-actions {
    flex-wrap: wrap;
  }

  .ils-sa__search-wrap {
    width: 100%;
    order: 2;
  }

  .ils-sa__view-btn {
    width: 34px;
    height: 34px;
  }

  .ils-sa__card-title {
    font-size: 11px;
  }

  .ils-sa__grid.is-list .ils-sa__card-image-wrap {
    height: 160px;
  }

  .ils-sa__grid.is-list .ils-sa__card-title {
    font-size: 15px;
    font-weight: 700;
  }

  .ils-sa__grid.is-list .ils-sa__card-description {
    font-size: 11px;
  }
}

/* ============================================================
   DESKTOP SIDEBAR CLOSE (hidden)
   ============================================================ */

@media (min-width: 900px) {
  .ils-sa__sidebar-close {
    display: none;
  }
}

/* ============================================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================================ */

@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets for better mobile usability */
  .ils-sa__group-header {
    padding: 16px 14px;
  }

  .ils-sa__term-link {
    padding: 10px 12px;
  }

  .ils-sa__sidebar-toggle {
    padding: 11px 16px;
  }

  .ils-sa__view-btn {
    min-width: 40px;
    min-height: 40px;
  }

  .ils-sa__page-link {
    min-width: 36px;
    min-height: 36px;
  }

  .ils-sa__load-more-btn {
    padding: 12px 28px;
    min-height: 44px;
  }
}

/* ============================================================
   LANDSCAPE ORIENTATION ADJUSTMENTS
   ============================================================ */

@media (max-height: 600px) and (orientation: landscape) {
  .ils-sa__sidebar {
    padding: 12px 16px;
  }

  .ils-sa__sidebar-heading {
    padding: 10px 0 12px 0;
  }

  .ils-sa__group-header {
    padding: 10px 12px;
    margin: 4px 0;
  }

  .ils-sa__term-link {
    padding: 6px 10px;
  }

  .ils-sa__term-children .ils-sa__term-link {
    padding: 5px 10px;
  }
}
