﻿/* -----------------------------------------------------------------------------
           1) FULL-SCREEN OVERLAY ELEMENT (#rotateOverlay)
           2) HIDE *EVERYTHING* under <body> except this overlay when in portrait-mode
        ----------------------------------------------------------------------------- */
#rotateOverlay {
    display: none; /* hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /*background: rgba(0, 0, 0, 0.85);*/
    /*color: #ffffff;*/
    z-index: 9999;
    text-align: center;
    /* REMOVE the padding centering */
    /* padding-top: 40vh; */
    /* TRUE centering */
    align-items: center; /* vertical */
    justify-content: center; /* horizontal */
    /* optional but usually helpful */
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 1.2rem;
    flex-direction: column;
    gap: 16px;
}

body.portrait-mode #rotateOverlay {
    display: flex !important;
}

/* When <body> has .portrait-mode, hide all body‐children except #rotateOverlay */
body.portrait-mode > *:not(#rotateOverlay) {
    display: none !important;
}

.body-home-logo {
    text-align: center;
}

/* Allow all text to wrap inside this specific container */
.home-cards-container .card-body,
.home-cards-container .card-body * {
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
}

.home-cards-container .inner-cards-container .card {
    /* Allow each card to shrink below its content’s minimum width */
    min-width: 0;
    /* (Optional) hide any overflow so shrunken text doesn’t escape */
    overflow: hidden;
}

/* Ensure *all* text inside these cards can break */
.home-cards-container .card,
.home-cards-container .card * {
    white-space: normal !important;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ========================================= */
/*  MERGED CSS FROM YOUR TWO ORIGINAL FILES  */
/* ========================================= */

/* -------------------------------------------------- */
/* 1) Base case (XL and up): Navbar sits above Menu   */
/* -------------------------------------------------- */
#layout-navbar {
    z-index: 1300;
}

#layout-menu {
    /*isolation: isolate !important;*/
    z-index: 1200 !important;
    max-height: calc(100dvh - 60px);
    -webkit-overflow-scrolling: touch;
}

/* ------------------------------------------------------------------
   1) By default (desktop ≥1200px), show “System Tour” and hide “Tour”
   ------------------------------------------------------------------ */
#SystemTour .desktop-text {
    display: inline;
}

#SystemTour .mobile-text {
    display: none;
}

/* ------------------------------------------------------------------
   2) On “mobile” (≤1199.98px), hide “System Tour” and show “Tour”
   ------------------------------------------------------------------ */
@media (max-width: 1199.98px) {
    #SystemTour .desktop-text {
        display: none;
    }

    #SystemTour .mobile-text {
        display: inline;
    }

    /* Keep your existing mobile rules for other elements: */
    .hide-on-mobile {
        display: none !important;
    }

    .hide-on-mobile-ignore {
        display: inline-block !important;
    }

    /* (Other mobile‐specific styles you had…) */
    #NavBarLogo {
        max-height: 50px;
    }

    #layout-menu {
        z-index: 1400 !important;
    }

    body {
        padding-top: 20px !important;
    }

    #form-container.container-p-y,
    .container-p-y {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .content-wrapper {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .d-flex.d-xl-none.align-items-center {
        position: relative !important;
    }
}

/* -------------------------------------------------- */
/* 3) Force the “brand” wrapper to be only as tall    */
/*    as its contents (for desktop/mobile)            */
/* -------------------------------------------------- */
.navbar-brand.app-brand.demo {
    padding-top: 0;
    padding-bottom: 0;
    line-height: 0; /* if the chevron is too tall, tweak this */
}

/* -------------------------------------------------- */
/* 4) If the chevron <i> has any top/bottom margin,   */
/*    zero it out                                     */
/* -------------------------------------------------- */
.layout-menu-toggle.menu-link i {
    margin: 0;
    padding: 0;
    line-height: 1; /* so it doesn’t force the parent taller */
}

/* -------------------------------------------------- */
/* 5) Override Sneat’s forced height/min-height on    */
/*    that dummy-brand placeholder                    */
/* -------------------------------------------------- */
.override-navbar-brand {
    height: auto !important;
    min-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* -------------------------------------------------- */
/* 6) Original .navbar-x rule (if you still need it)  */
/* -------------------------------------------------- */
.navbar-x {
    position: absolute !important;
    top: -12px !important; /* flush with the very top of .align-items-center */
    right: 0 !important; /* flush with the very right edge */
    margin: -20px !important; /* remove any extra margins */
    padding: 0; /* remove any extra padding */
    line-height: 1;
    z-index: 9999 !important; /* guarantee it sits above everything */
}

:root {
    --g: 12px;
    --footer-h: 0px; /* will be set by JS */
    --form-top: 0px; /* will be set by JS */
}

/* Lock the page; inner container scrolls */
html, body {
    height: 100%;
    overflow: hidden !important;
}

/* Flex ancestors must allow shrink/scroll */
.layout-wrapper,
.layout-container,
.layout-page,
.content-wrapper {
    min-height: 0 !important;
}

/* Keep full-width if you're using container-xxl */
#form-container.container-xxl {
    max-width: 100%;
}

/* Make #form-container the only scroller and stop under the footer */
#form-container {
    /* dvh for mobile; fallback to vh if not supported */
    height: calc(100vh - var(--footer-h) - var(--form-top));
    overflow: auto;
    overscroll-behavior: contain;
    padding-bottom: var(--footer-h); /* last rows not hidden */
    scrollbar-gutter: stable both-edges; /* avoid layout jump */
}

@supports (height: 100dvh) {
    #form-container {
        height: calc(100dvh - var(--footer-h) - var(--form-top));
    }
}

/* Keep the vertical padding tame */
#form-container.container-p-y {
    padding-top: var(--g) !important;
    padding-bottom: var(--g) !important;
}

.my-tooltip {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    background: rgba(33,37,41,.95);
    color: #fff;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 120ms ease;
}

.my-tooltip.show {
    opacity: 1;
}

.my-tooltip-arrow {
    position: absolute;
    width: 8px;
    height: 8px;
    transform: rotate(45deg);
    background: inherit;
}
/* Keep panels free so children can fly out */
.menu-horizontal .menu-sub {
    overflow: visible;
    will-change: transform;
}

/* Optional: avoid animated jumping */
.menu-horizontal .menu-sub {
    transition: transform 2s !important;
}

/* ── Deep menu nesting (WFE → View As Role → Department → Role) ──────
   Sneat template natively supports 2 levels. These rules support 3rd
   and 4th levels in BOTH horizontal (fly-out) and vertical (drawer) modes.

   HORIZONTAL — fly-out submenus on hover. */
.menu-horizontal .menu-sub .menu-item {
    position: relative;
}
.menu-horizontal .menu-sub .menu-item > .menu-sub {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 0;
    min-width: 260px;
    z-index: 1080;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 0;
    list-style: none;
}
.menu-horizontal .menu-sub .menu-item:hover > .menu-sub,
.menu-horizontal .menu-sub .menu-item.open > .menu-sub,
.menu-horizontal .menu-sub .menu-item:focus-within > .menu-sub {
    display: block;
}
.menu-horizontal .menu-sub .menu-item > .menu-link.menu-toggle::after {
    /* submenu indicator — CSS-drawn right-pointing chevron (nested flyout opens to the right) */
    content: "";
    font-size: calc(1em + 2px);   /* indicator is +2px over the menu text */
    margin-left: auto;            /* push to right edge; flex align-items:center handles vertical centering */
    width: 0.45em;
    height: 0.45em;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.9;
}
@media (max-width: 1100px) {
    .menu-horizontal .menu-sub .menu-sub .menu-sub {
        left: auto;
        right: 100%;
    }
}

/* VERTICAL (tablet drawer) — inline expand under parent on .open.
   The default Sneat behavior only expands one level; these rules let
   3rd and 4th levels also expand. Click .menu-toggle to toggle .open.
   Hover provides a fallback for mouse users on touch+mouse devices. */
.menu-vertical .menu-sub {
    display: none;
    padding-left: 0;
    margin: 0;
    list-style: none;
}
.menu-vertical .menu-item.open > .menu-sub,
.menu-vertical .menu-item:hover > .menu-sub {
    display: block;
}
.menu-vertical .menu-sub .menu-item > .menu-link {
    display: block;
    padding: 6px 12px 6px 28px;     /* indent each level */
    color: inherit;
    text-decoration: none;
    white-space: normal;
}
.menu-vertical .menu-sub .menu-sub .menu-item > .menu-link { padding-left: 44px; }
.menu-vertical .menu-sub .menu-sub .menu-sub .menu-item > .menu-link { padding-left: 60px; }
.menu-vertical .menu-sub .menu-item > .menu-link:hover {
    background: rgba(0,0,0,0.05);
}
.menu-vertical .menu-item > .menu-link.menu-toggle::after {
    /* submenu indicator — CSS-drawn right-pointing chevron (has a child/grandchild submenu) */
    content: "";
    font-size: calc(1em + 2px);   /* indicator is +2px over the menu text */
    margin-left: auto;            /* push to right edge; flex align-items:center handles vertical centering */
    width: 0.45em;
    height: 0.45em;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
    opacity: 0.9;
    transition: transform 0.15s;
}
.menu-vertical .menu-item.open > .menu-link.menu-toggle::after {
    transform: rotate(135deg);   /* right -> points down when expanded */
}

/* Wrapper spacing */
pager {
    display: block;
}

.pagination-control {
    padding-bottom: 10px;
}

/* Layout */
.pagination {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
}

    /* Kill Bootstrap spacing */
    .pagination .page-item,
    .pagination .page-link {
        margin: 0 !important;
    }

        .pagination .page-item + .page-item {
            margin-left: 2px !important; /* tighten spacing */
        }

    /* Reset any inline image styles from old pager */
    .pagination .page-item {
        background: none !important;
        background-image: none !important;
        padding: 0 !important;
    }

    /* Chip base */
    .pagination .page-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        height: 32px;
        padding: 0 8px;
        border-radius: 10px;
        border: 1px solid #cbd5e1; /* stronger base border */
        background: #f9fafb;
        color: #4b5563;
        text-decoration: none;
        line-height: 1;
        transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease, transform .02s ease;
        box-shadow: 0 1px 1px rgba(0,0,0,.04);
    }

    /* Make First/Last borders unambiguously visible */
    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        border-color: #94a3b8 !important; /* force it */
    }

    /* Hover — much higher contrast */
    .pagination .page-link:hover {
        background: #e0e7ff; /* deeper tint */
        border-color: #6366f1;
        color: #111827;
        box-shadow: 0 2px 6px rgba(99,102,241,.28);
    }

    /* Pressed */
    .pagination .page-link:active {
        transform: translateY(1px);
    }

    /* Focus ring */
    .pagination .page-link:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(99,102,241,.35);
    }

    /* Active/current page */
    .pagination .page-item.active .page-link {
        background: #6366f1;
        border-color: #6366f1 !important;
        color: #fff;
        box-shadow: 0 6px 12px rgba(99,102,241,.35);
        cursor: default;
    }

    /* Disabled (if you use it) */
    .pagination .page-item.disabled .page-link {
        background: #f3f4f6;
        border-color: #e5e7eb !important;
        color: #9aa4b2;
        opacity: .9;
        pointer-events: none;
    }

/* =========== Compact Select2 when the SOURCE <select> has .inline-dropdown-container =========== */
/* The Select2 container is inserted RIGHT AFTER the <select>, so we use the adjacent sibling (+) */
.inline-dropdown-container + .select2 .select2-selection--single {
    height: 22px !important;
    min-height: 22px !important;
    line-height: 22px !important;
    font-size: 12px !important;
    padding: 0 22px 0 6px !important; /* room for clear & arrow */
    box-sizing: border-box;
}

/* Rendered text */
.inline-dropdown-container + .select2 .select2-selection__rendered {
    font-size: 12px !important;
    line-height: 22px !important;
    padding-right: 22px !important; /* avoid overlap with arrow/clear */
    margin: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Placeholder text */
.inline-dropdown-container + .select2 .select2-selection__placeholder {
    font-size: 12px !important;
    line-height: 22px !important;
}

/* Clear (×) button */
.inline-dropdown-container + .select2 .select2-selection__clear {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    line-height: 1;
    font-size: 12px !important;
    cursor: pointer;
}

/* Arrow */
.inline-dropdown-container + .select2 .select2-selection__arrow {
    position: absolute;
    right: 4px;
    top: 0;
    height: 22px !important;
    width: 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Optional: tighten the container width if needed (your inline style is already 300px) */
.inline-dropdown-container + .select2 {
    max-width: 300px; /* keep in sync with your inline style */
}

/* put this on the scrolling container that holds the big table */
.big-table-wrap {
    content-visibility: auto; /* skip layout/paint off-screen */
    contain-intrinsic-size: 1200px; /* reserve space so scrolling works smoothly */
}

.password-wrap {
    position: relative;
}

.password-wrap input.form-control {
    padding-right: 2.25rem;
}
/* room for the icon */
.password-toggle {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    padding: 0;
    line-height: 0;
    cursor: pointer;
    opacity: .7;
}

.password-toggle:hover, .password-toggle:focus {
    opacity: 1;
}

.password-toggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* Container forces full table width and prevents resizing */
.pcg-pager-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Spreads sections to left, center, right */
    padding: 8px 15px;
    background-color: transparent;
    border-top: 1px solid #dee2e6;
}

.pcg-pager-section {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Force the bar to be a static size regardless of content */
.pcg-pager-container .pagination {
    display: flex;
    justify-content: center;
    width: 100%;
}

.pcg-pager-container .page-item {
    flex: 0 0 auto;
}

.pcg-pager-container .pagination .page-link {
    width: 38px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Ensure Prev/Next have their own fixed width */
.pcg-pager-container .page-item:nth-child(2) .page-link,
.pcg-pager-container .page-item:nth-last-child(2) .page-link {
    width: 60px;
}
/* Ensure the '...' ellipsis item also has a fixed width */
.pcg-pager-container .page-item.disabled .page-link {
    min-width: 35px;
}

/* ---------------------------------------------------------------
   Zone field layout — flex wrapping with bottom-aligned controls.
   dtDynGlobals.js converts <table class="zone-field-table"> to a
   <div class="zone-field-table"> before Select2 initialises, so
   these rules apply to real divs with no table formatting context.

   align-items:stretch — every cell in the same flex line grows to
   the tallest cell's height.
   flex-direction:column + justify-content:flex-end on each cell —
   pushes label+input to the bottom of the stretched cell so all
   controls land on the same horizontal baseline regardless of label
   wrap height.
   flex-wrap:wrap — cells that would overflow the card wrap to the
   next line instead.
   .zone-break-cell spans full width to force a new flex line at
   ZoneBreak points.
--------------------------------------------------------------- */
.zone-field-table {
    display: flex;
    flex-direction: column;       /* fields in a zone stack VERTICALLY (one per line) */
    align-items: stretch;
    align-content: flex-start;
    width: 100%;
}

.zone-field-cell {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    flex: 0 0 auto;        /* cells take their natural height; full width per row */
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-width: 100%;
    float: none;
}

/* Image/icon field types set display:flex + centering inline —
   restore row direction so their horizontal layout is preserved. */
.zone-field-cell.zone-cell-inline-flex {
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

/* ZoneBreak forces a new flex line */
.zone-field-cell.zone-break-cell {
    flex: 0 0 100%;
    min-height: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Safety net: prevent float on any remaining real table cells */
.card-body > table > tbody > tr > td,
.card-body > table > tr > td {
    float: none !important;
}

/* ---------------------------------------------------------------
   Card header flex layout — left title / right action buttons
   Wraps gracefully at narrow widths: title stays left, buttons
   wrap right-aligned beneath each other with consistent spacing.
--------------------------------------------------------------- */
.card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px 8px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.card-header .card-header-left {
    flex: 1 1 auto;
    text-align: left;
    min-width: 0;
}

.card-header .card-header-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: flex-start;
    align-content: flex-start;
    gap: 4px;
    flex-shrink: 0;
}

/* form-field-container divs are the actual flex children of card-header-right.
   align-self: flex-start keeps lone wrapped buttons pinned to the top of their row
   instead of floating down to match the height of the previous row. */
.card-header-right .form-field-container {
    align-self: flex-start;
}

/* Individual pill buttons never wrap their own label text */
.btn.rounded-pill {
    white-space: nowrap !important;
}

.btn-inline-spacing > * {
    margin: 0rem 0.375rem 0 0 !important;
}

.card-header-right.non-desktop {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.card-header-right.non-desktop > * {
    display: inline-block;
    margin: 0 !important;
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-header .card-header-right {
        justify-content: flex-start;
        width: 100%;
    }

    .btn-inline-spacing {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .btn-inline-spacing > * {
        margin: 0 !important;
    }
}

/* =========== Filter row inputs inside .listform — uniform 30px height, 14px Arial =========== */
/* shared-components.css sets min-height: 40.5px on .form-control which overrides the inline
   height: 30px on filter text inputs. Higher specificity here wins. */
.listform .form-label {
    font-weight: 700;
}

.listform thead th {
    font-weight: 700;
    padding-top: 1px !important;
    padding-bottom: 1px !important;
}

/* Center checkboxes in grid data cells.
   Must use table-cell (not flex) so consecutive checkbox columns each occupy their own column slot. */
.index-table tbody td:has(> input[type="checkbox"]) {
    display: table-cell !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 6px 8px !important;
}

.index-table tbody td:has(> input[type="checkbox"]) > input[type="checkbox"] {
    margin: 0 !important;
}

.listform .form-control,
.listform .form-select {
    height: 30px;
    min-height: 30px;
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    padding: 2px 8px;
}

/* =========== Select2 inside .listform — match grid font (14px Arial) =========== */
/* Select2 creates its own DOM and inherits from .listform (10px), not from the
   native <select>'s inline style. These rules override so filter dropdowns match
   the 14px Arial used in the data grid cells. */
.listform .select2-container {
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
}
.listform .select2-container--default .select2-selection--single {
    height: 30px;
    min-height: 30px;
}
.listform .select2-container--default .select2-selection--single .select2-selection__rendered {
    font-size: 14px;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 28px;
    padding-left: 6px;
}
.listform .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 28px;
}

/* Align checkbox/toggle filter items with the bottom of the input row
   (other flex-items have a label above the input; the switch has no separate label row) */
.listform .flex-item:has(.switch) {
    align-self: flex-end;
    padding-bottom: 6px;
}

/* Dyslexic Fonts toggle in the navbar — make the pill and label legible on dark background */
.layout-navbar .switch-toggle-slider {
    background-color: #b0c8e8;
    border: 1px solid #d0e4f7;
}
.layout-navbar .switch-input:checked ~ .switch-toggle-slider {
    background-color: #38ef7d;
    border-color: #2ecc6a;
}
.layout-navbar .switch-label {
    color: #ffffff;
    font-weight: 600;
}

/* Pager controls — label vertically centered beside dropdown/input.
   The inline <style> in _PaginationControl.cshtml uses specificity (0,1,0);
   .pagination-wrapper .pagination-control at (0,2,0) overrides it. */
.pagination-wrapper .pagination-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

/* .form-label has margin-bottom: 8px from shared-components.css which inflates its
   layout box, pushing text above center even when align-items: center is set */
.pagination-wrapper .form-label {
    margin-bottom: 0;
    white-space: nowrap;
}

/* Jump-to-page input — match height and style of the Select2 dropdowns beside it */
.pagination-wrapper .pagination-control input[type="number"] {
    height: 38px;
    min-height: 38px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 0 8px;
    font-size: 1rem;
    font-family: inherit;
    width: 60px;
    box-sizing: border-box;
    align-self: center;
}

/* Max Records: its <select> is wrapped in a nested .pagination-control div.
   display:contents collapses that wrapper so the select aligns like all other dropdowns. */
.pagination-wrapper .pagination-control .pagination-control {
    display: contents;
}

/* Select2 arrow — default height is 26px which causes it to float near the top
   when the selection box is taller. 100% height centers the arrow correctly. */
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100% !important;
    top: 0 !important;
}

/* Detail form labels with green ✚ — keep the plus on the same line as the label text
   with at least 2 spaces of gap; never let it wrap underneath. */
label.form-label:has(.ddNew) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}
label.form-label .ddNew {
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: 2px;
}