/*
 * Province filter UI for the province-filtered news widgets
 * (newsmanagement grid/slideset, gridcontentprovince). Paired with
 * ../js/province-filter.js.
 *
 * Colours: #0076bb is the blue the province dropdown already used (white text on
 * it passes WCAG AA). The empty/loading/error states are solid blue cards rather
 * than bare white text, because the same widgets sit on the dark MOC Provincial
 * section (site 1) and on white regional sections (site 37).
 */

.pf-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* The head used overflow:hidden to contain its float, which would clip the suggestion list. */
.newsmgtprovince-head,
.gridcontentprovince-head {
    overflow: visible !important;
    display: flow-root;
    position: relative;
    z-index: 20;
}

/* ---------------------------------------------------------------- combobox */

.pcb {
    position: relative;
    width: 100%;
    min-width: 260px;
    max-width: 100%;
    margin: 0 auto;
    text-align: left;
}

.pcb .pcb-input,
.pcb .pcb-input.form-control {
    display: block;
    width: 100%;
    height: 42px;
    margin: 0;
    padding: 6px 72px 6px 42px;
    border: 0;
    border-radius: 5px;
    background: #0076bb !important;
    color: #fff !important;
    font-size: 16px;
    line-height: 1.4;
    text-align: center;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
}

.pcb .pcb-input::placeholder {
    color: #fff;
    opacity: 1;
}

.pcb .pcb-input:focus {
    outline: 0;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #003b5c;
}

.pcb-search-icon,
.pcb-toggle,
.pcb-clear {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.pcb-search-icon {
    left: 12px;
    pointer-events: none;
}

.pcb-toggle {
    right: 0;
    width: 36px;
    cursor: pointer;
}

.pcb-toggle svg {
    transition: transform .15s ease;
}

.pcb.is-open .pcb-toggle svg {
    transform: rotate(180deg);
}

.pcb .pcb-clear {
    right: 34px;
    width: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.pcb .pcb-clear[hidden] {
    display: none;
}

.pcb .pcb-clear:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -4px;
    border-radius: 50%;
}

.pcb-panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1050;
    padding: 6px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(10, 20, 60, .28);
}

.pcb-panel[hidden],
.pcb-list[hidden],
.pcb-empty[hidden] {
    display: none;
}

.pcb-list {
    position: relative;
    max-height: 300px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
}

.pcb-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 12px;
    border-radius: 6px;
    color: #1f2937;
    font-size: 16px;
    line-height: 1.4;
    cursor: pointer;
}

.pcb-option:hover,
.pcb-option.is-active {
    background: #e6f1f9;
    color: #00406b;
}

.pcb-option[aria-selected="true"] {
    color: #005f96;
    font-weight: 600;
}

.pcb-option[aria-selected="true"]::after {
    content: "\2713";
    margin-left: auto;
}

.pcb-option--all {
    margin-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 6px 6px 0 0;
}

.pcb-option mark {
    padding: 0;
    background: none;
    color: #0076bb;
    font-weight: 700;
}

.pcb-empty {
    padding: 10px 12px;
    color: #4b5563;
    font-size: 16px;
}

@media (max-width: 575.98px) {
    .pcb {
        min-width: 0;
    }
}

/* ------------------------------------------------------- loading overlay */

.pf-results {
    position: relative;
}

/* --pf-font: the widget's dropdown font, set by province-filter.js. */
.pf-results .pf-loading-pill,
.pf-results .pf-state {
    font-family: var(--pf-font, inherit);
}

.pf-results.is-loading > :not(.pf-loading):not(.pf-sr-only) {
    opacity: .35;
    pointer-events: none;
    transition: opacity .15s ease;
}

.pf-results.is-initial {
    min-height: 180px;
}

.pf-loading {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 48px;
}

.pf-results.is-initial .pf-loading {
    align-items: center;
    padding-top: 0;
}

.pf-loading[hidden] {
    display: none;
}

.pf-loading-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #0076bb;
    color: #fff;
    font-size: 17px;
    line-height: 1.3;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}

.pf-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pf-spin .8s linear infinite;
}

@keyframes pf-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .pf-spinner { animation-duration: 2.4s; }
}

/* ---------------------------------------------------- empty / error card */

.pf-state {
    max-width: 560px;
    margin: 8px auto 20px;
    padding: 28px 24px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 14px;
    background: #0076bb;
    color: #fff;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 20, 60, .25);
}

.pf-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .16);
}

.pf-state-icon svg {
    width: 40px;
    height: 40px;
}

.pf-state .pf-state-title {
    margin: 0;
    color: #fff;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.35;
}

.pf-state .pf-state-hint {
    margin: 6px 0 0;
    color: #fff;
    font-size: 18px;
    line-height: 1.5;
}

.pf-state .pf-state-retry {
    margin-top: 14px;
    padding: 8px 22px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 17px;
    cursor: pointer;
}

.pf-state .pf-state-retry:hover {
    background: #fff;
    color: #0076bb;
}

.pf-state .pf-state-retry:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}
