/* MFSA FIRB Institutions compatibility layer — Phase 3. */

.mfsa-firb {
    color: var(--mfsa-ui-text);
}

.mfsa-firb .mfsa-firb-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--mfsa-ui-gap);
    width: 100%;
    margin: 12px 0;
    padding: 12px;
    box-sizing: border-box;
    color: var(--mfsa-ui-text);
    background: var(--mfsa-ui-surface-subtle);
    border: 1px solid var(--mfsa-ui-border-light);
    border-radius: var(--mfsa-ui-radius);
}

.mfsa-firb .mfsa-firb-count {
    color: var(--mfsa-ui-text-muted);
}

.mfsa-firb .mfsa-firb-search,
.mfsa-firb .mfsa-firb-sort,
.mfsa-firb .mfsa-firb-page-size {
    min-height: var(--mfsa-ui-control-height);
    margin: 0;
    padding: 8px 12px;
    box-sizing: border-box;
    color: var(--mfsa-ui-text);
    background: var(--mfsa-ui-surface);
    border: 1px solid var(--mfsa-ui-border);
    border-radius: var(--mfsa-ui-radius);
    box-shadow: none;
    font: inherit;
}

.mfsa-firb .mfsa-firb-button,
.mfsa-firb .mfsa-firb-pages button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--mfsa-ui-control-height);
    margin: 0;
    padding: 8px 12px;
    box-sizing: border-box;
    color: var(--mfsa-ui-teal-dark) !important;
    background: var(--mfsa-ui-surface);
    border: 1px solid var(--mfsa-ui-teal);
    border-radius: var(--mfsa-ui-radius);
    box-shadow: none;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
}

.mfsa-firb .mfsa-firb-button:hover,
.mfsa-firb .mfsa-firb-button:focus-visible,
.mfsa-firb .mfsa-firb-pages button:hover,
.mfsa-firb .mfsa-firb-pages button:focus-visible,
.mfsa-firb .mfsa-firb-pages button[aria-current="page"] {
    color: #ffffff !important;
    background: var(--mfsa-ui-teal-dark);
    border-color: var(--mfsa-ui-teal-dark);
}

.mfsa-firb :is(.mfsa-firb-search, .mfsa-firb-sort, .mfsa-firb-page-size, .mfsa-firb-button, .mfsa-firb-pages button):focus-visible {
    outline: 3px solid var(--mfsa-ui-focus) !important;
    outline-offset: 2px !important;
}

.mfsa-firb .mfsa-firb-table-wrap {
    border-radius: var(--mfsa-ui-radius);
}

.mfsa-firb table {
    color: var(--mfsa-ui-text);
    background: var(--mfsa-ui-surface);
}

.mfsa-firb th {
    color: #ffffff;
    background: var(--mfsa-ui-teal);
    border-color: var(--mfsa-ui-teal-dark);
}

.mfsa-firb td {
    color: var(--mfsa-ui-text);
    background: var(--mfsa-ui-surface);
    border-color: var(--mfsa-ui-border-light);
}

.mfsa-firb tbody tr:nth-child(even) td {
    background: var(--mfsa-ui-surface-subtle);
}

.mfsa-firb .mfsa-firb-class-heading th {
    color: #ffffff;
    background: var(--mfsa-ui-teal-dark);
}

.mfsa-firb .mfsa-firb-footer,
.mfsa-firb .mfsa-firb-footer label {
    color: var(--mfsa-ui-text-muted);
}

.mfsa-firb .mfsa-firb-empty {
    color: var(--mfsa-ui-text);
    background: var(--mfsa-ui-surface-subtle);
    border: 1px solid var(--mfsa-ui-border-light);
    border-radius: var(--mfsa-ui-radius);
}

body.pojo-a11y-high-contrast .mfsa-firb,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-toolbar,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-footer,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-empty {
    color: #ffffff !important;
    background: #000000 !important;
    border-color: #ffffff !important;
}

body.pojo-a11y-high-contrast .mfsa-firb :is(.mfsa-firb-count, .mfsa-firb-footer label) {
    color: #ffffff !important;
    background: #000000 !important;
}

body.pojo-a11y-high-contrast .mfsa-firb :is(.mfsa-firb-search, .mfsa-firb-sort, .mfsa-firb-page-size) {
    color: #ffffff !important;
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}

body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-search::placeholder {
    color: #ffffff !important;
    opacity: 1 !important;
}

body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-button,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-pages button {
    color: #00ffff !important;
    background: #000000 !important;
    border: 2px solid #ffffff !important;
    text-decoration: underline !important;
}

body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-button:hover,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-button:focus-visible,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-pages button:hover,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-pages button:focus-visible,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-pages button[aria-current="page"] {
    color: #000000 !important;
    background: #ffff00 !important;
}

body.pojo-a11y-high-contrast .mfsa-firb th,
body.pojo-a11y-high-contrast .mfsa-firb .mfsa-firb-class-heading th {
    color: #000000 !important;
    background: #ffff00 !important;
    border-color: #ffffff !important;
}

body.pojo-a11y-high-contrast .mfsa-firb td,
body.pojo-a11y-high-contrast .mfsa-firb tbody tr:nth-child(even) td {
    color: #ffffff !important;
    background: #000000 !important;
    border-color: #ffffff !important;
}

@media (max-width: 900px) {
    .mfsa-firb .mfsa-firb-toolbar {
        align-items: stretch;
        flex-direction: column;
        flex-wrap: wrap;
    }

    .mfsa-firb .mfsa-firb-controls {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
    }

    .mfsa-firb .mfsa-firb-controls label {
        flex: 1 1 100%;
    }

    .mfsa-firb .mfsa-firb-button {
        flex: 1 1 120px;
    }
}

/* Print remains fully owned by the FIRB plugin. */
@media print {
    .mfsa-firb .mfsa-firb-toolbar,
    .mfsa-firb .mfsa-firb-footer,
    .mfsa-firb .mfsa-firb-empty {
        display: none !important;
    }
}
