/* ============================================================
   Schemes & Services listing
   Loaded only on the page using page-template/schemes-services.php.
   Markup lives in that template and in
   custom-functions/get-schemeslist.php (AJAX result column).
   ============================================================ */

.schemes-page {
    --scheme-border: #DCDEE1;
    --scheme-muted: #6B7280;
    --scheme-ink: #111827;
    --scheme-blue: #0373DF;
}

/*
 * The Elementor kit stylesheet (post-6.css) paints EVERY bare <button> with a
 * border, an 8px radius and its own colour, and it loads after this file — so
 * each plain-text control below is scoped `.schemes-page …` to outrank it and
 * opts out explicitly here. Keep that prefix on any button added later.
 */
.schemes-page .schemes-facet__toggle,
.schemes-page .schemes-chip,
.schemes-page .schemes-chips__clear,
.schemes-page .scheme-group__viewall,
.schemes-page .scheme-group__toggle {
    border: 0;
    border-radius: 0;
    background-color: transparent;
    font-family: inherit;
    line-height: 1.4;
}

/* ---------- Top bar ---------- */

.schemes-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.schemes-topbar__search {
    flex: 1 1 320px;
    min-width: 0;
}

.schemes-topbar__search .form-control {
    height: 44px;
    padding-left: 40px;
    border-radius: 8px;
}

.schemes-topbar__org .form-select {
    height: 44px;
    min-width: 260px;
    border-radius: 8px;
}

.schemes-topbar__reset .btn {
    height: 44px;
    padding-inline: 20px;
    border-radius: 8px;
    white-space: nowrap;
}

/* ---------- Heading + status switch ---------- */

.schemes-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.schemes-heading__title {
    margin: 0;
    font-size: 28px !important;
    font-weight: 600 !important;
    color:#1F2428;
}

/* ---------- Applied filter chips ---------- */

.schemes-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.schemes-chips__label {
    color: #3A3D41;
}

.schemes-chips__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.schemes-page .schemes-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    background-color: #C0DBFF;
    font-size: 14px;
    font-weight: 400;
    color: #1E2124;
    cursor: pointer;
}

.schemes-page .schemes-chip:hover {
    background-color: #C9DFF8;
}

.schemes-chip__tick::before {
    content: "\2713";
    font-weight: 700;
}

/* The remove affordance. Permanently visible rather than hover-only, so it is
   discoverable on touch, but muted until the chip is hovered or focused. */
.schemes-chip__remove {
    margin-left: 2px;
    font-size: 20px;
    line-height: 1;
    opacity: .55;
}

.schemes-chip__remove::before {
    content: "\00D7";
}

.schemes-page .schemes-chip:hover .schemes-chip__remove,
.schemes-page .schemes-chip:focus-visible .schemes-chip__remove {
    opacity: 1;
}

.schemes-page .schemes-chip:focus-visible {
    outline: 2px solid var(--scheme-blue);
    outline-offset: 2px;
}

.schemes-page .schemes-chips__clear {
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--scheme-blue);
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Filter rail ---------- */

.schemes-rail__panel {
    padding: 4px 16px;
    border: 1px solid var(--scheme-border);
    border-radius: 12px;
    background: #fff;
}

.schemes-facet {
    position: relative;
}

.schemes-facet + .schemes-facet::before {
    content: "";
    position: absolute;
    top: 0;
    left: -16px;
    right: -16px;
    border-top: 1px solid var(--scheme-border);
}

.schemes-page .schemes-facet__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #0E1114;
    cursor: pointer;
}

.schemes-facet__chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--scheme-muted);
    border-bottom: 2px solid var(--scheme-muted);
    transform: rotate(-135deg);
    transition: transform .15s ease;
}

.schemes-facet.is-collapsed .schemes-facet__chevron {
    transform: rotate(45deg);
}

.schemes-facet__body {
    padding-bottom: 12px;
}

.schemes-facet__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.schemes-facet__input {
    margin: 0;
    flex: 0 0 auto;
}

.schemes-facet__label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
    color: #374151;
    cursor: pointer;
}

/* Applicant icon (ACF `icon` field on target-group terms). Always rendered for
   that facet — an empty circle keeps the label column aligned while icons are
   still being uploaded. */
.schemes-facet__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--stroke-100, #F3F4F6);
    overflow: hidden;
}

.schemes-facet__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.schemes-rail__empty {
    margin: 0;
    padding: 16px 0;
    font-size: 14px;
    color: var(--scheme-muted);
}

/* ---------- Results column ---------- */

.schemes-loader {
    display: block;
    margin: 24px auto;
    color: var(--scheme-blue);
}

.schemes-loader[hidden] {
    display: none;
}

/* Editor-authored banner from the applicant term's `top_section` WYSIWYG.
   The same field also renders in the home page offerings panel, so the layout
   contract is shared — see scheme-offerings-component.css. Authors write a
   .promo-copy block and an optional .promo-cta block; copy goes left, call to
   action right, stacking on narrow screens. */
.scheme-topsection {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px;
    margin-bottom: 16px;
    border: 1px solid #F6DDD4;
    border-radius: 12px;
    background: #FDF3EF;
}

.scheme-topsection > :last-child {
    margin-bottom: 0;
}

.scheme-topsection .promo-copy {
    flex: 1 1 260px;
    min-width: 0;
}

.scheme-topsection .promo-cta {
    flex: 0 0 auto;
    margin: 0;
}

.scheme-topsection h1,
.scheme-topsection h2,
.scheme-topsection h3,
.scheme-topsection h4,
.scheme-topsection h5,
.scheme-topsection h6 {
    margin-bottom: 4px;
    font-size: 17px;
    font-weight: 600;
    color: var(--scheme-ink);
}

.scheme-topsection p {
    margin-bottom: 0;
    font-size: 14px;
    color: #4B5563;
}

/* Only needed when an author writes a bare button with no .promo-cta wrapper. */
.scheme-topsection > a.btn {
    flex: 0 0 auto;
}

/* ---------- Category groups ---------- */

.scheme-group {
    margin-bottom: 12px;
    border: 1px solid var(--scheme-border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}

.scheme-group__header {
    margin: 0;
}

.schemes-page .scheme-group__toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px 20px;
    background-color: #fff;
    font-size: 16px;
    font-weight: 600;
    color:#0E1114;
}

/* ux4g styles the open state of every .accordion-button with a purple focus
   ring (using !important); these group headers are flush, so suppress it. */
.schemes-page .scheme-group__toggle:not(.collapsed) {
    background-color: #fff;
    color: var(--scheme-ink);
    border: 0 !important;
    box-shadow: none !important;
}

.schemes-page .scheme-group__toggle:focus-visible {
    outline: 2px solid var(--scheme-blue);
    outline-offset: -2px;
}

.scheme-group__name {
    flex: 1 1 auto;
    text-align: left;
}

.scheme-group__count {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 20px;
    background: #DCDEE1;
    font-size: 12px;
    font-weight: 500;
    color: #1E2124;
}

.scheme-group__body {
    padding: 0 20px 20px;
    /* border-top: 1px solid var(--scheme-border); */
    padding-top: 20px;
}

/* ---------- Scheme card ---------- */

.schemes-results .scheme-card {
    border: 1px solid var(--scheme-border);
    border-radius: 10px;
    background: #fff;
}

.scheme-card__body {
    padding: 18px 18px 12px;
}

.schemes-results a.scheme-card__title {
    display: block;
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #1E2124;
    text-decoration: none;
}

.schemes-results a.scheme-card__title:hover,
.schemes-results a.scheme-card__title:focus-visible {
    color: var(--scheme-blue);
    text-decoration: underline;
}

.scheme-card__desc,
.scheme-card__org {
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 16px;
    color: #1E2124;
}

.scheme-card__desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color:#3A3D41;
    margin-bottom: 8px;;
}

.scheme-card__org {
    display: flex;
    align-items: baseline;
    gap: 6px;
    align-items: center;
}

.scheme-card__org-icon {
    flex: 0 0 auto;
    transform: translateY(1px);
}

.scheme-card__for {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.scheme-card__for-label {
    font-size: 12px;
    color:#3A3D41;
}

.scheme-card__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.scheme-chip {
    padding: 3px 7px;
    border: 1px solid var(--scheme-border);
    border-radius: 6px;
    font-size: 12px;
    color: #1E2124;
}

.schemes-results .scheme-card__footer {
    padding: 10px 18px 14px;
    border-top: 1px solid var(--scheme-border);
    background: transparent;
}

.schemes-results a.scheme-card__link {
    font-size: 14px;
    font-weight: 500;
    color: var(--scheme-blue);
    text-decoration: none;
}

.schemes-results a.scheme-card__link:hover {
    text-decoration: underline;
}

/* ---------- View all / empty ---------- */

.schemes-page .scheme-group__viewall {
    margin-top: 16px;
    padding: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--scheme-blue);
    cursor: pointer;
}

.schemes-page .scheme-group__viewall:hover {
    text-decoration: underline;
}

.scheme-empty {
    padding: 48px 24px;
    border: 1px solid var(--scheme-border);
    border-radius: 12px;
    background: #fff;
    text-align: center;
}

.scheme-empty__title {
    margin-bottom: 4px;
    font-size: 14px;
    font-weight: 600;
    line-height:20px;
    color: #0E1114;
}

.scheme-empty__hint {
    margin: 0;
    font-size: 14px;
    line-height:20px;
    color:#3A3D41;
}

/* ---------- Responsive ---------- */

@media (max-width: 991.98px) {
    .schemes-rail {
        margin-bottom: 16px;
    }

    .schemes-topbar__org .form-select {
        min-width: 0;
        width: 100%;
    }

    .schemes-topbar__org,
    .schemes-topbar__reset {
        flex: 1 1 100%;
    }

    .schemes-topbar__reset .btn {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .schemes-heading__title {
        font-size: 22px !important;
    }

    .scheme-group__body {
        padding-inline: 14px;
    }

    .schemes-results .scheme-group__toggle {
        padding-inline: 14px;
        font-size: 16px;
    }
}
