/* Basic styling for the search results container */
.ais-InstantSearch {
  max-width: 1200px;
  margin: 0 auto;
}

.hit-item {
  width: 100%;
}

.ais-Hits-item {
  padding: 0;
}

.ais-SearchBox-form {
  background-color: transparent;
  border-radius: 100px; /* fallback for background-color: transparent; */
  height: auto;
  line-height: auto;
}

/* Style for individual hit items */
.hit-item h2 .ais-Highlight-highlighted {
  background-color: #ffe082; /* Light yellow highlight */
  font-style: normal;
}

.hit-item p .ais-Snippet-highlighted {
  background-color: #ffe082;
  font-style: normal;
}

/* Ensure SearchBox input has good contrast and size */
.ais-SearchBox-input {
  font-size: 1rem;
  /* Ensure space for right action buttons; left aligns like normal when typing */
  padding: 0.75rem 5rem 0.75rem 1rem;
}

/* Style for refinement list */
.ais-RefinementList-label {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.ais-RefinementList-labelText {
  margin-left: 8px;
  flex-grow: 1;
}

.ais-RefinementList-count {
  font-size: 0.875rem;
  color: #6b7280; /* text-gray-800 */
  background-color: #f3f4f6; /* bg-gray-100 */
  padding: 2px 8px;
  border-radius: 9999px; /* rounded-full */
}

.ais-RefinementList-item--selected .ais-RefinementList-labelText {
  font-weight: 600;
}

/* Pagination styling */
.ais-Pagination-list {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
}

.ais-Pagination-item {
  margin: 0 4px;
}

.ais-Pagination-link {
  padding: 8px 12px;
  border: 1px solid #d1d5db; /* border-gray-300 */
  border-radius: 4px;
  text-decoration: none;
  color: #374151; /* text-gray-700 */
  transition:
    background-color 0.2s ease-in-out,
    color 0.2s ease-in-out;
}

.ais-Pagination-link:hover {
  background-color: #f3f4f6; /* bg-gray-100 */
}

.ais-Pagination-item--disabled .ais-Pagination-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stats styling */
.ais-Stats {
  font-size: 0.875rem;
  color: #4b5563; /* text-gray-800 */
}

/* Fix checkbox positioning to prevent movement on click */
.ais-RefinementList-checkbox {
  position: relative !important;
  transform: none !important;
  transition: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.125rem !important;
  width: 1rem !important;
  height: 1rem !important;
  flex-shrink: 0 !important;
  cursor: pointer !important;
}

.ais-RefinementList-checkbox:hover {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 2px !important;
}

.ais-RefinementList-checkbox:focus {
  outline: 2px solid #3b82f6 !important;
  outline-offset: 2px !important;
}

.ais-RefinementList-checkbox:checked {
  background-color: #3b82f6 !important;
  border-color: #3b82f6 !important;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e") !important;
  background-size: 12px 12px !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
}

.ais-RefinementList-item {
  display: flex !important;
  align-items: center !important;
  position: relative !important;
  margin: 0 0 0.5rem 0 !important;
  padding: 0 0 0 1rem !important;
}

.ais-RefinementList-label {
  display: flex !important;
  align-items: center !important;
  cursor: pointer !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0.25rem 0 !important;
  position: relative !important;
}

.ais-RefinementList-labelText {
  margin-left: 0.5rem !important;
  flex-grow: 1 !important;
  line-height: 1.25rem !important;
}

/* Remove placeholder-specific padding; maintain consistent padding at all times */
/* When not focused (icon visible via form::before), add left padding to clear icon */
form.ais-SearchBox-form:not(:focus-within) .ais-SearchBox-input {
  padding-left: 2.5rem;
}

input.ais-SearchBox-input::placeholder {
  color: #9ca3af; /* text-gray-400 */
  opacity: 1; /* Firefox otherwise dims it */
}

form.ais-SearchBox-form {
  position: relative; /* so ::before can be positioned if needed */
}

form.ais-SearchBox-form::before {
  content: ''; /* REQUIRED in Firefox */
}

form.ais-SearchBox-form:focus-within::before {
  display: none;
}
