.nhsuk-pagination {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.nhsuk-pagination > li {
    margin: 0;
}

.nhsuk-pagination__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 4px; /* Space between buttons */
}

/* General styles for all pagination items */
.nhsuk-pagination__item,
.nhsuk-pagination__next,
.nhsuk-pagination__prev {
    margin-right: 4px !important;
    box-sizing: border-box;
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    border-radius: 4px;
    border: 1px solid #b1b4b6;
    background-color: #f3f2f1;
    color: #005eb8;
    text-decoration: none;
}


.nhsuk-pagination__item,
.nhsuk-pagination__next,
.nhsuk-pagination__prev {
    height: 45px;
    line-height: 45px;
}


/* Hover effect */
.nhsuk-pagination__item:hover,
.nhsuk-pagination__next:hover,
.nhsuk-pagination__prev:hover {
    background-color: #d8dde0;
}

.nhsuk-spread-to {
    text-decoration: none;
    list-style: none;
    padding: 6px;
}

.nhsuk-pagination__item--current {
    background-color: #005eb8;
    color: white;
    border: none;
}

.nhsuk-pagination__item--current a {
    color: white;
}

.nhsuk-pagination__item--next {
    background-color: #f3f2f1;
    color: #005eb8;
}

/* Previous & Next buttons */
.nhsuk-pagination__prev,
.nhsuk-pagination__next {
    background: transparent;
    border: none;
    width: auto;
    padding: 0 10px;
}

.nhsuk-pagination__prev a,
.nhsuk-pagination__next a {
    text-decoration: none;
    color: black;
    font-weight: bold;
}

a:visited {
    color: black;
}

/* Properly center numbers in all pagination items */
.nhsuk-pagination__link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: black;
}

.nhsuk-pagination__item--current .nhsuk-pagination__link:visited {
    color: white;
}

.nhsuk-pagination__item--current .nhsuk-pagination__link:visited:hover {
    color: black;
}

/* Fix icon alignment */
.nhsuk-pagination__icon {
    width: 0.75rem;
    height: 1rem;
    color: #004b93;
    fill: currentcolor;
}

.nhsuk-pagination__prev--disabled,
.nhsuk-pagination__next--disabled {
    pointer-events: none;
}

.nhsuk-pagination__prev--disabled a,
.nhsuk-pagination__next--disabled a {
    color: #d8dde0;
}
