/* Custom Algolia styling to match Tailwind */
.ais-RefinementList-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ais-RefinementList-item {
    margin-bottom: 8px;
}
.ais-RefinementList-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.ais-RefinementList-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #FD6E6D !important; /* Brand coral */
    cursor: pointer;
}

/* Ensure checkboxes use brand color in all states */
.ais-RefinementList-checkbox:checked {
    accent-color: #FD6E6D !important; /* Brand coral */
    background-color: #FD6E6D !important;
    border-color: #FD6E6D !important;
}

.ais-RefinementList-checkbox:focus {
    outline-color: #FD6E6D !important; /* Brand coral */
    box-shadow: 0 0 0 3px rgba(253, 110, 109, 0.1) !important;
}
.ais-RefinementList-count {
    margin-left: auto;
    font-size: 12px;
    color: #9ca3af;
}
/* Boolean filter toggles ("Good to know" on the directory). Styled to match
   the RefinementList checkboxes above so the filter panel reads as one list. */
.ais-ToggleRefinement-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}
.ais-ToggleRefinement-checkbox {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: #FD6E6D !important; /* Brand coral */
    cursor: pointer;
}
.ais-ToggleRefinement-checkbox:focus {
    outline-color: #FD6E6D !important; /* Brand coral */
    box-shadow: 0 0 0 3px rgba(253, 110, 109, 0.1) !important;
}
/* The count sits inside labelText, so it is pushed right from here rather
   than with margin-left:auto on the count itself. */
.ais-ToggleRefinement-labelText {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.ais-ToggleRefinement-count {
    font-size: 12px;
    color: #9ca3af;
}
.ais-CurrentRefinements-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.ais-CurrentRefinements-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.ais-CurrentRefinements-category {
    display: inline-flex;
    align-items: center;
    background: rgba(217, 238, 244, 0.6);
    color: #344452;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}
.ais-CurrentRefinements-delete {
    background: none;
    border: none;
    margin-left: 2px;
    cursor: pointer;
    color: #344452;
    font-weight: bold;
    /* Enlarge the tap target beyond the × glyph */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
}
.ais-SearchBox-form {
    position: relative;
    display: flex;
    align-items: center;
}
.ais-SearchBox-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}
.ais-SearchBox-input:focus {
    border-color: #FD6E6D;
    box-shadow: 0 0 0 3px rgba(253, 110, 109, 0.1);
}
.ais-SearchBox-submit {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s, background-color 0.2s;
}
.ais-SearchBox-reset {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 4px;
    display: none !important;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s, background-color 0.2s;
}
.ais-SearchBox-reset[hidden] {
    display: none !important;
}
.ais-SearchBox-reset:not([hidden]) {
    display: flex !important;
}
/* Hide submit button when reset is showing */
.ais-SearchBox-form:has(.ais-SearchBox-reset:not([hidden])) .ais-SearchBox-submit {
    display: none !important;
}
.ais-SearchBox-submit:hover,
.ais-SearchBox-reset:hover {
    color: #FD6E6D;
    background-color: rgba(253, 110, 109, 0.1);
}
.ais-SearchBox-submitIcon,
.ais-SearchBox-resetIcon {
    width: 16px;
    height: 16px;
}
.ais-SearchBox-loadingIndicator {
    position: absolute;
    right: 8px;
    padding: 8px;
}
.ais-SearchBox-loadingIcon {
    width: 16px;
    height: 16px;
}
/* Style the filter search box */
.ais-RefinementList-searchBox .ais-SearchBox-input {
    padding: 8px 36px 8px 12px;
    font-size: 14px;
    border-radius: 6px;
    margin-bottom: 12px;
}
.ais-RefinementList-searchBox .ais-SearchBox-submit {
    right: 6px;
    padding: 6px;
}
.ais-RefinementList-searchBox .ais-SearchBox-reset {
    right: 6px;
    padding: 6px;
}
.ais-RefinementList-searchBox .ais-SearchBox-submitIcon,
.ais-RefinementList-searchBox .ais-SearchBox-resetIcon {
    width: 14px;
    height: 14px;
    display: block;
}
.ais-Pagination-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.ais-Pagination-item {
    border-radius: 6px;
}
.ais-Pagination-link {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}
.ais-Pagination-link:hover,
.ais-Pagination-item--selected .ais-Pagination-link {
    background: #FD6E6D;
    color: white;
    border-color: #FD6E6D;
}

/* Mobile responsive pagination */
@media (max-width: 640px) {
    .ais-Pagination-list {
        gap: 4px;
    }
    .ais-Pagination-link {
        padding: 12px 10px;
        font-size: 14px;
        min-width: 44px;
        min-height: 44px;
    }
    /* Hide page numbers on mobile, keep only prev/next and current */
    .ais-Pagination-item:not(.ais-Pagination-item--previousPage):not(.ais-Pagination-item--nextPage):not(.ais-Pagination-item--selected):not(.ais-Pagination-item--firstPage):not(.ais-Pagination-item--lastPage) {
        display: none;
    }
    /* Show first and last page on mobile */
    .ais-Pagination-item--firstPage,
    .ais-Pagination-item--lastPage {
        display: block !important;
    }
}
/* Clear refinements button */
.ais-ClearRefinements-button {
    background: none;
    border: none;
    color: #FD6E6D;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    transition: opacity 0.2s;
}
.ais-ClearRefinements-button:hover:not(:disabled) {
    opacity: 0.8;
}
.ais-ClearRefinements-button:disabled,
.ais-ClearRefinements-button--disabled {
    color: #d1d5db;
    cursor: not-allowed;
    opacity: 0.5;
}
/* Show more/less buttons */
.ais-RefinementList-showMore {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    transition: color 0.2s;
}
.ais-RefinementList-showMore:hover {
    color: #FD6E6D;
}
.ais-RefinementList-showMore:disabled,
.ais-RefinementList-showMore--disabled {
    display: none;
}

/* Quick filter chips - hide scrollbar */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Sort dropdown styling */
#sort-by .ais-SortBy-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232C3E50'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}