/*
 * Bootstrap 5 compatibility rules for markup that has not yet been migrated
 * from Bootstrap 3.  This stylesheet intentionally loads after each
 * customer-specific Global.css file so it can restore the shared component
 * contracts those files were written against without reintroducing Bootstrap
 * 3 or overriding Bootstrap 5's base styles globally.
 */

/*
 * Bootstrap 5 gives .container-fluid a fixed width: 100%.  The portal's
 * WideContainer option also applies horizontal margins, so retaining that
 * width makes the page wider than its viewport and creates a horizontal
 * scrollbar.  Auto width lets the browser calculate the content width after
 * those configured margins have been applied.
 */
.body-content-fluid {
    width: auto;
}

/*
 * Bootstrap 3 established a 10px root font size.  The customer Global.css
 * files intentionally use rem values based on that contract (for example,
 * their desktop 1.375rem paragraph is intended to render as 13.75px).  With
 * Bootstrap 5's 16px root those same declarations became 22px, enlarging
 * every heading, paragraph, and branded button.  Restore the legacy root
 * scale so the existing customer typography retains its designed dimensions.
 */
html {
    font-size: 62.5%;
}

/*
 * Bootstrap 5 expresses its container gutter in rem.  Once the Bootstrap 3
 * root scale above is restored, its default 1.5rem gutter becomes 15px total
 * (7.5px per side), whereas Bootstrap 3 supplied a 30px total gutter (15px
 * per side).  Preserve the latter so the home panel and three-column content
 * retain their original inset from the customer-configured outer margins.
 */
.container,
.container-fluid {
    --bs-gutter-x: 3rem;
}

/*
 * The four login choices use full-width grid columns, but their descriptive
 * copy is intentionally narrower so it remains visually grouped below each
 * heading.  A dedicated class avoids Bootstrap 5's .w-50 utility, which
 * conflicts with the portal's pre-existing .w-50 padding helper.
 */
.login-option-description {
    width: 75%;
    margin-right: auto;
    margin-left: auto;
}

/*
 * The credential pages previously depended on Bootstrap 3 offset classes to
 * center their form panels.  Bootstrap 5 removed those offsets in favor of a
 * flex row, so clear the customer stylesheet's float and let the responsive
 * grid column remain centered from phone through desktop widths.
 */
.login-form-container #loginForm {
    float: none;
    width: 100%;
}

/*
 * The credential pages use Bootstrap 3 column offsets around their input
 * groups.  Those offsets no longer exist in Bootstrap 5, so give only this
 * form family a fixed, centered input measure.  The pages use Bootstrap 5
 * flex utilities directly for their button alignment.
 */
.login-form-container .login-input-group {
    width: 75%;
    margin-right: auto;
    margin-left: auto;
}

/*
 * Bootstrap 5 card titles are intentionally unopinionated.  Keep the former
 * 16px login heading scale explicitly so a card header remains legible under
 * the portal's Bootstrap 3-compatible 10px root font size.
 */
.login-form-container .card-header .card-title {
    font-size: 16px;
    line-height: 1.1;
}

/*
 * The customer header styles predate Bootstrap 5's flex navbar.  Preserve
 * their branded, in-flow header treatment while allowing the Bootstrap 5
 * collapse plugin to control the .show state of the menu on small screens.
 */
.navbar.fixed-top {
    position: relative;
    margin-bottom: 20px;
}

.navbar .navbar-brand {
    display: block;
    margin-left: 4%;
    margin-right: 0;
    padding: 0 15px;
    width: fit-content;
}

.navbar .navbar-brand img {
    display: block;
    max-width: 100%;
}

.navbar .navbar-toggler-icon {
    filter: brightness(0) invert(1);
}

@media (min-width: 768px) {
    /* Match logo-nav.css's original desktop padding and header height. */
    .navbar .navbar-brand {
        padding: 15px 0;
    }
}

@media (max-width: 767px) {
    /* Match logo-nav.css's original compact logo treatment on phones. */
    .navbar .navbar-brand {
        padding: 10px 15px;
    }
}

/*
 * These Bootstrap 3 utilities occur throughout the existing pages.  Keeping
 * their original semantics avoids invisible controls and layout shifts until
 * each view can be converted to the Bootstrap 5 utility names.
 */
.hidden {
    display: none !important;
}

.pull-right {
    float: right !important;
}

.pull-left {
    float: left !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/*
 * Bootstrap 5 removed the Bootstrap 3 default button variant.  These custom
 * properties deliberately match Bootstrap 5's light button palette, giving
 * legacy .btn-default controls a visible neutral affordance without changing
 * the styling of the modern button variants.
 */
.btn-default {
    --bs-btn-color: #000;
    --bs-btn-bg: #f8f9fa;
    --bs-btn-border-color: #f8f9fa;
    --bs-btn-hover-color: #000;
    --bs-btn-hover-bg: #d3d4d5;
    --bs-btn-hover-border-color: #c6c7c8;
    --bs-btn-focus-shadow-rgb: 211, 212, 213;
    --bs-btn-active-color: #000;
    --bs-btn-active-bg: #c6c7c8;
    --bs-btn-active-border-color: #babbbc;
    --bs-btn-disabled-color: #000;
    --bs-btn-disabled-bg: #f8f9fa;
    --bs-btn-disabled-border-color: #f8f9fa;
}

/*
 * Bootstrap 5 no longer supplies panel or well components.  These rules keep
 * legacy panels readable and bordered while avoiding a dependency on the old
 * framework stylesheet.  They are intentionally limited to the portal's
 * existing class names rather than attempting to recreate Bootstrap 3.
 */
.panel {
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.panel-body {
    padding: 15px;
}

.panel-heading {
    padding: 10px 15px;
    border-bottom: 1px solid transparent;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

.panel-footer {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
}

.panel-default {
    border-color: #ddd;
}

.panel-default > .panel-heading {
    color: #333;
    background-color: #f5f5f5;
    border-color: #ddd;
}

.well {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgb(0 0 0 / 5%);
}

/*
 * Bootstrap 5 replaced .close with .btn-close.  Existing pages still render
 * textual × buttons, so retain the former sizing and transparent button
 * treatment until those controls are converted to the accessible new markup.
 */
.close {
    float: right;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    appearance: none;
    background: transparent;
    border: 0;
    opacity: .5;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    opacity: .75;
}

/*
 * The customer Bootstrap 3 theme files add horizontal and desktop-only
 * vertical padding to .toggle-handle. Bootstrap 5 Toggle instead uses the
 * standard .75rem button-side padding to size a zero-width handle and
 * stretches it to the track height; retaining the legacy padding makes the
 * handle overflow the track and offsets icon-only on/off labels. These rules
 * deliberately restore the plugin's expected handle dimensions while keeping
 * its state, width, and color behavior intact.
 */
.toggle > .toggle-group > .toggle-handle.btn.btn-default {
    padding: 0 .75rem !important;
}

.toggle > .toggle-group > .toggle-on,
.toggle > .toggle-group > .toggle-off,
.toggle > .toggle-group > .toggle-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/*
 * Legacy modal themes float PDF glyphs and add an 8px vertical margin. A
 * Bootstrap 5 button is already a box-aligned control, so the icon must be a
 * normal flex child to remain centered vertically at every button height.
 */
.modal-confirm .btn-PDF,
.modal-failed .btn-PDF,
.modal-info .btn-PDF {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.modal-confirm .btn-PDF > span,
.modal-failed .btn-PDF > span,
.modal-info .btn-PDF > span {
    float: none !important;
    margin: 0 !important;
    line-height: 1;
}

/*
 * Icon-only toggles do not need a visible slider handle. Removing it lets the
 * active/inactive label occupy the complete switch width, which centers the
 * check/minus glyph and eliminates the handle's translucent hover overlay.
 * The marker class is applied only where the toggle has no text label.
 */
.toggle-icon-only > .toggle-group > .toggle-handle {
    display: none !important;
}

.toggle-icon-only > .toggle-group > .toggle-on,
.toggle-icon-only > .toggle-group > .toggle-off {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

/* Font Awesome's check and close glyphs have visible strokes that sit left of
 * their advance boxes. Move only active icon-only toggle glyphs a few pixels
 * right for visual, rather than merely mathematical, centering. */
.toggle-icon-only > .toggle-group > .toggle-on .fa-check,
.toggle-icon-only > .toggle-group > .toggle-on .fa-close {
    transform: translateX(6px);
}

/* Font Awesome's fa-lg reduces its own line height to .75em. Restore a full
 * line box only inside PDF buttons so the icon's graphic centers in the
 * button without changing Font Awesome alignment elsewhere in the portal. */
.btn-PDF > .fa-lg {
    display: block;
    line-height: 1;
    vertical-align: middle;
    /* Font Awesome draws fa-lg glyphs above their text baseline; compensate
       only in the icon-only PDF action after flex has centered its line box. */
    transform: translateY(2px);
}

/*
 * The two-factor setup dialog is Bootstrap 5 markup, but customer theme files
 * retained from Bootstrap 3 can still apply desktop widths and offsets to the
 * generic .modal-dialog selector.  Scope the reset to this dialog so it stays
 * centered within the viewport without changing legacy modals elsewhere.
 */
#SetupModal .two-factor-setup-dialog {
    position: relative !important;
    right: auto !important;
    left: auto !important;
    width: auto !important;
    max-width: min(500px, calc(100% - 2rem));
    padding: 0 !important;
    margin: 1rem auto;
}

/* Customer Bootstrap 3 themes also lower the modal stack level.  Restore the
 * Bootstrap 5 dialog level locally so its backdrop cannot cover the setup UI. */
#SetupModal {
    z-index: 1055;
}

#SetupModal .modal-body {
    overflow-x: hidden;
}

/* Preserve the QR's square modules while allowing a very narrow viewport to
 * shrink the image rather than causing the modal or page to overflow. */
#SetupModal .two-factor-qr {
    width: 100px;
    max-width: 100%;
    height: auto;
}

@media (min-width: 576px) {
    #SetupModal .two-factor-setup-dialog {
        margin: 1.75rem auto;
    }
}

/*
 * Shared Service-page title rows render customer contact information beside a
 * page heading on desktop.  Permit long contact values to break within their
 * Bootstrap column instead of painting over the heading at intermediate
 * viewport widths.  The semantic classes keep this rule from changing
 * unrelated two-column layouts elsewhere in the portal.
 */
.page-title-contact,
.page-title-contact > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* Keep the contact container shrinkable at every viewport size. Its type size
 * belongs to the customer stylesheets, where it follows each theme's heading
 * breakpoints instead of overriding them after those stylesheets load. */
.page-title-contact > .page-contact-info {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: normal;
    word-break: normal;
}

/* Phone-sized viewports retain the compact contact treatment. Wider viewport
 * values are supplied by each customer Global.css file to match its h5 rules. */
@media (max-width: 575.98px) {
    .page-title-contact > .page-contact-info {
        font-size: 1rem;
        line-height: 1.25;
    }
}

/*
 * Work-order accordion headers have three independent flex regions.  The
 * summary must be allowed to shrink; flex items otherwise use their content's
 * intrinsic minimum width and can force the attachment indicator outside the
 * card when a work-order description is long.
 */
.work-order-card-header .work-order-summary {
    min-width: 0;
    overflow-wrap: anywhere;
}

/*
 * Bootstrap's sm breakpoint is the portal's phone layout threshold.  Stack
 * the heading and contact information in portrait phone widths, then move the
 * attachment region to its own right-aligned line.  Landscape phones and
 * tablets retain the compact side-by-side desktop layout when sufficient
 * horizontal space is available.
 */
@media (max-width: 575.98px) {
    .page-title-row {
        row-gap: .25rem;
    }

    .page-title-row > .col-6 {
        flex: 0 0 100%;
        width: 100%;
    }

    .page-title-row > .page-title-contact {
        justify-content: flex-start !important;
        text-align: start !important;
    }

    .work-order-card-header {
        flex-wrap: wrap;
    }

    .work-order-card-header .work-order-attachments {
        flex-basis: 100%;
        justify-content: flex-end;
    }
}
