/*
 * NOTICE OF LICENSE
 *
 * THE SOFTWARE CONTAINED HEREIN IS PROPRIETARY TO INFOR AND/OR ITS AFFILIATES AND SUBSIDIARIES AND IS PROVIDED TO
 * INFOR CUSTOMERS FOR THEIR OWN USE IN ACCORDANCE WITH THE TERMS OF THEIR SOFTWARE LICENSE AGREEMENT. ALL OTHER RIGHTS RESERVED.
 *
 * (c) COPYRIGHT 2026 INFOR. ALL RIGHTS RESERVED. THE WORD AND DESIGN MARKS SET FORTH HEREIN ARE TRADEMARKS AND/OR
 * REGISTERED TRADEMARKS OF INFOR AND/OR ITS AFFILIATES AND SUBSIDIARIES. ALL RIGHTS RESERVED. ALL OTHER TRADEMARKS
 * LISTED HEREIN ARE THE PROPERTY OF THEIR RESPECTIVE OWNERS.
 */

/*
 * Keyboard focus ring for admin pages (WCAG 2.4.7, 1.4.11). The IDS theme, common.css, jQuery UI and jqGrid
 * remove the browser outline. Two-tone ring (page-colour gap + 3:1 outer ring); IDS controls with a compliant
 * ring are excluded in Light. Checkboxes/switches hide the input, so the ring goes on the label box.
 */
:root {
    --scs-focus-ring-color: #0054B1;
    --scs-focus-ring-gap-color: #FFFFFF;
}

html.theme-new-dark {
    --scs-focus-ring-color: #69B5FF;
    --scs-focus-ring-gap-color: #1A1A1A;
}

/* !important: the resets above use focus selectors that are as specific as these. IDS tabs draw their own
 * ring on .tab-focus-indicator, so the tab link is excluded in both variants. Accordion header links
 * sit inside the IDS header ring, so the ring moves to the header (below). */
:focus-visible:not(.btn-icon, .btn-primary, .btn-secondary, .btn-tertiary, .btn-actions, .btn-menu,
    .btn-close, .hyperlink, .datepicker, .tab > a, .accordion-header a, .accordion-header > .btn),
html.theme-new-dark :focus-visible:not(.tab > a, .accordion-header a),
input.checkbox:focus-visible + label::before,
input.checkbox:focus-visible + input[type="hidden"] + label::before,
input.switch:focus-visible + label::before {
    outline: 2px solid var(--scs-focus-ring-color) !important;
    outline-offset: 2px !important;
}

/* Gap between control and ring. Script-only focus targets (tabindex="-1": dialogs, popups) keep their own
 * drop shadow. */
:focus-visible:not(.btn-icon, .btn-primary, .btn-secondary, .btn-tertiary, .btn-actions, .btn-menu,
    .btn-close, .hyperlink, .datepicker, .tab > a, .accordion-header a, .accordion-header > .btn, [tabindex="-1"]),
html.theme-new-dark :focus-visible:not(.tab > a, .accordion-header a, [tabindex="-1"]),
input.checkbox:focus-visible + label::before,
input.checkbox:focus-visible + input[type="hidden"] + label::before,
input.switch:focus-visible + label::before {
    box-shadow: 0 0 0 2px var(--scs-focus-ring-gap-color) !important;
}

/* These sit inside overflow containers that clip an outer ring, so draw it inside the edge. :is() takes the #id
 * specificity, so this also beats the Dark rule above, and replaces the IDS ring (which would be clipped too). */
:is(#masthead-icon, #breadCrumb a, .buttonset :is(a, button), .ui-jqgrid :is(a, select, input),
    #listViewSearchTerm, .card-content :is(button, .dropdown), #calendar-toolbar .dropdown, .fc-scroller,
    #sidebar-container a:not(.accordion-header a),
    html.theme-new-dark :is(.detailsHierarchyLinks a, .accordion-header > .btn)):focus-visible,
:is(#calendar-toolbar, #sidebar-container) input.switch:focus-visible + label::before {
    outline: 2px solid var(--scs-focus-ring-color) !important;
    outline-offset: -2px !important;
    box-shadow: inset 0 0 0 4px var(--scs-focus-ring-gap-color) !important;
}

#bookmarkButton:has(#bookmarkListButton:focus-visible) {
    outline: 2px solid var(--scs-focus-ring-color) !important;
    outline-offset: -2px !important;
    box-shadow: inset 0 0 0 4px var(--scs-focus-ring-gap-color) !important;
}

:is(#bookmarkListButton, .ui-jqgrid-btable):focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

/* A focused jqGrid table can be taller than the page, with its top and bottom scrolled out of view, so mark its
 * left edge on every row, skipping up to two leading hidden (inline display:none) id cells. An empty table is
 * 0px high, so ring its column header instead, above the header cells. */
.ui-jqgrid-btable:focus-visible tr.jqgrow > :is(
    td:first-child:not(:is([style*="display:none"], [style*="display: none"])),
    td:first-child:is([style*="display:none"], [style*="display: none"])
        + td:not(:is([style*="display:none"], [style*="display: none"])),
    td:first-child:is([style*="display:none"], [style*="display: none"]) + td:is([style*="display:none"], [style*="display: none"])
        + td) {
    box-shadow: inset 4px 0 0 var(--scs-focus-ring-color) !important;
}

.ui-jqgrid-view:has(.ui-jqgrid-btable:focus-visible):not(:has(tr.jqgrow)) > .ui-jqgrid-hdiv::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    outline: 2px solid var(--scs-focus-ring-color);
    outline-offset: -2px;
    box-shadow: inset 0 0 0 4px var(--scs-focus-ring-gap-color);
}

/* One ring per accordion header (nav, Settings, side panels), replacing the IDS header ring instead of nesting
 * inside it. Inset, as neighbouring headers and overflow: hidden would clip an outer ring. */
.accordion-header:has(a:focus-visible) {
    border-color: transparent !important;
    outline: 2px solid var(--scs-focus-ring-color) !important;
    outline-offset: -2px !important;
    box-shadow: inset 0 0 0 4px var(--scs-focus-ring-gap-color) !important;
}

/* The nav is dark in both variants; the light ring alone is >= 3:1 on it (3.3:1 on the selected item), so no
 * gap band. */
.application-menu .accordion-header:has(a:focus-visible) {
    outline-color: #69B5FF !important;
    box-shadow: none !important;
}
