/* ==========================================================================
   UFAA responsive layer (2026-11-09)
   Loaded LAST on every page layout (staff, jobseeker, auth, public) so it can
   correct the theme without editing it. Goals: nothing wider than the screen,
   wide tables scroll inside their card (not the page), controls are a usable
   size on touch screens, nothing hidden under the floating buttons, one font.
   Pair: static/assets/js/ufaa-responsive.js (wraps tables in scroll boxes).
   ========================================================================== */

:root {
    --ufaa-font:          "Segoe UI", "Open Sans", Roboto, "Helvetica Neue", Arial, "Liberation Sans", "DejaVu Sans", sans-serif;
    --ufaa-fab-clearance: 5.5rem;

    /* Brand colour tokens live in ufaa-tokens.css */
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* One font family everywhere (the theme mixed Open Sans and Segoe UI). */
body, button, input, select, textarea, .btn, .form-control, .form-select, .table, .nav-link,
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--ufaa-font);
}
/* The theme sets card text to "Open Sans" with no fallback; when that web font
   isn't available (offline / Google Fonts blocked) cards fell back to a serif. */
.card .card-body, .text-sans-serif { font-family: var(--ufaa-font) !important; }

body { -webkit-font-smoothing: antialiased; scrollbar-gutter: stable; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { text-wrap: balance; }
p { text-wrap: pretty; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--ufaa-navy); }

/* Media never wider than its box. */
img, video, iframe, canvas, svg:not(.svg-inline--fa) { max-width: 100%; }
img:not([height]) { height: auto; }

/* ── Layout: stop flex/grid children from growing wider than their parent ── */
.card > .card-body, .card > .card-header, .card > .card-footer,
.row > [class*="col"], .tab-content, .tab-pane, .modal-body { min-width: 0; }
.card > .card-body, .card > .card-header, .card > .card-footer { max-width: 100%; }
.main-content, .container-fluid { min-width: 0; }

/* Long words, URLs, e-mails and references wrap instead of pushing the page. */
.card-body, .card-header, .modal-body, .alert, dd, .kv-val, .kv-row, .list-group-item,
p, li, label, .form-text, small, .badge {
    overflow-wrap: break-word;
}
.btn { overflow-wrap: normal; word-break: normal; }   /* never letter-per-line buttons */

/* ── Tables: scroll inside their own box, uniform header row ─────────────── */
.ufaa-table-scroll,
.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
}
.ufaa-table-scroll > table, .table-responsive > table { margin-bottom: 0; }
/* soft edge shadows hint that there is more to scroll */
.ufaa-table-scroll {
    background:
        linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 24px 100% no-repeat local,
        linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 24px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(29, 37, 91, .16), rgba(29, 37, 91, 0)) left center / 10px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(29, 37, 91, .16), rgba(29, 37, 91, 0)) right center / 10px 100% no-repeat scroll;
}
.ufaa-table-scroll > table > thead th,
.table-responsive > table > thead th,
.dataTables_wrapper table > thead th { white-space: nowrap; vertical-align: middle; }
.ufaa-table-scroll > table > tbody td, .dataTables_wrapper table > tbody td { vertical-align: middle; }
/* Long cell text wraps (within a sensible width) instead of one endless line:
   the theme sets every .table cell to nowrap, so a long applicant label or
   vacancy title made the table thousands of pixels wide. Headers stay one line. */
.ufaa-table-scroll > table > tbody > tr > td, .table-responsive > table > tbody > tr > td,
table.dataTable > tbody > tr > td {
    white-space: normal;
    max-width: 28rem;
    min-width: 5.5rem;
}
/* an outer .table-responsive around a DataTable no longer scrolls the
   controls; the table has its own scroll box inside the DataTables wrapper */
.table-responsive:has(> .dataTables_wrapper) { overflow-x: visible; }
.dataTables_wrapper > .ufaa-table-scroll, .dataTables_wrapper .ufaa-table-scroll { margin-top: .5rem; margin-bottom: .5rem; }

/* DataTables controls: tidy and stacked on small screens */
.dataTables_wrapper { max-width: 100%; }
.dataTables_wrapper .row { margin-left: 0; margin-right: 0; }
.dataTables_wrapper .pagination, .pagination { flex-wrap: wrap; gap: 2px; }
@media (max-width: 767.98px) {
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate { text-align: left !important; float: none !important; }
    .dataTables_wrapper .dataTables_filter label,
    .dataTables_wrapper .dataTables_filter input { width: 100%; margin-left: 0 !important; }
    .dataTables_wrapper .dataTables_paginate { margin-top: .5rem; display: flex; justify-content: center; }
    .dataTables_wrapper .row > [class*="col-"] { width: 100%; justify-content: flex-start !important; }
}

/* ── Tabs / pill rows: swipe sideways instead of overflowing ─────────────── */
@media (max-width: 767.98px) {
    .nav-tabs, .ufaa-scroll-x {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar, .ufaa-scroll-x::-webkit-scrollbar { display: none; }
    .nav-tabs > .nav-item, .ufaa-scroll-x > * { flex: 0 0 auto; }
}

/* ── Page header (breadcrumb + title) never squeezes into a sliver ───────── */
@media (max-width: 767.98px) {
    #navbarBlur .breadcrumb, #navbarBlur h6, #navbarBlur .font-weight-bolder {
        max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    #navbarBlur .container-fluid { flex-wrap: nowrap; }
}

/* ── Touch screens: usable tap targets (≈40px), no iOS zoom on focus ────── */
@media (pointer: coarse) {
    #iconNavbarSidenav, #dropdownMenuButton, #userDropdown, .navbar .nav-link.p-0 {
        min-width: 40px; min-height: 40px;
        display: inline-flex; align-items: center; justify-content: center;
        padding: .25rem !important;
    }
    .btn:not(.btn-link):not(.btn-close) { min-height: 38px; }
    .btn-sm:not(.btn-link), .btn-xs:not(.btn-link) {
        min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
    }
    .page-link { min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center; }
    .dropdown-item { padding-top: .55rem; padding-bottom: .55rem; }
    .form-check-input { width: 1.15rem; height: 1.15rem; }
    /* page-specific icon buttons that were 16–22px */
    .close-btn, .btn-expand, .btn-select-all, .btn-close {
        min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center;
    }
    .form-switch .form-check-input { width: 2.2rem; }
}
@media (max-width: 575.98px) {
    input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea,
    .form-control, .form-select, .select2-container .select2-selection { font-size: 16px !important; }
}
/* Oversized buttons: cap height so a long label wraps neatly instead */
.btn { max-width: 100%; }
.btn-lg { line-height: 1.3; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.select2-container { max-width: 100%; }
.form-control, .form-select, .input-group { max-width: 100%; }
@media (max-width: 575.98px) {
    .input-group { flex-wrap: wrap; }
    .input-group > .form-control, .input-group > .form-select { min-width: 0; flex: 1 1 60%; }
}

/* ── Modals & SweetAlert on phones ─────────────────────────────────────── */
@media (max-width: 575.98px) {
    .modal-dialog { margin: .5rem; max-width: calc(100vw - 1rem); }
    .modal-body { max-height: calc(100vh - 11rem); overflow-y: auto; -webkit-overflow-scrolling: touch; }
    .swal2-popup { width: calc(100vw - 1.5rem) !important; font-size: .95rem; }
}

/* ── Floating buttons (accessibility + Copilot) never cover content ─────── */
main.main-content, body > .main-content, .ufaa-page-end-gap { padding-bottom: var(--ufaa-fab-clearance) !important; }
/* sticky/fixed bottom action bars keep their buttons clear of the floating buttons */
.sticky-bar, .sticky-bottom, .fixed-bottom { padding-right: 5.5rem !important; }
@media (max-width: 1199.98px) {
    .sticky-bar, .sticky-bottom, .fixed-bottom { padding-left: 4.5rem !important; }
}
@media (max-width: 575.98px) {
    .asw-menu-btn, .asw-widget .asw-menu-btn { width: 44px !important; height: 44px !important; }
}

/* ── Sidebar overlay on phones: content behind it can't be tapped by accident */
@media (max-width: 1199.98px) {
    .g-sidenav-pinned .sidenav { z-index: 1050; }
}

/* ── Charts keep their box ─────────────────────────────────────────────── */
.chart, .chart-container, [class*="chart-wrap"] { position: relative; max-width: 100%; }

/* ── Stage filter pills (Board pages). Not .nav-pills: the theme turns those
   into an animated "moving tab" that overlapped the links. ─────────────── */
.ufaa-pills { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding-left: 0; }
.ufaa-pills .nav-link {
    border: 1px solid #E4DFD2; border-radius: 999px; padding: .35rem .8rem; font-size: .8rem;
    color: var(--ufaa-navy); background: #fff; display: inline-flex; align-items: center; gap: .35rem; min-height: 34px;
}
.ufaa-pills .nav-link:hover { border-color: var(--ufaa-gold); }
.ufaa-pills .nav-link.active { background: var(--ufaa-navy); border-color: var(--ufaa-navy); color: #fff; }
.ufaa-pills .nav-link.active .badge { background: rgba(255, 255, 255, .25) !important; }
.ufaa-pills .nav-link.text-muted { opacity: .65; }
@media (max-width: 767.98px) {
    .ufaa-pills { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
    .ufaa-pills::-webkit-scrollbar { display: none; }
    .ufaa-pills .nav-item { flex: 0 0 auto; }
}

/* Any direct child of a card (not only .card-body) must not outgrow it —
   cards are flex columns, so wide tables used to stretch them and get cut. */
.card > * { min-width: 0; max-width: 100%; }

/* ── Top bar on phones/tablets: title shrinks with an ellipsis, icons stay ─ */
@media (max-width: 991.98px) {
    #navbarBlur > .container-fluid { flex-wrap: nowrap; gap: .5rem; align-items: center; }
    #navbarBlur nav[aria-label="breadcrumb"] { min-width: 0; flex: 1 1 auto; }
    #navbarBlur .breadcrumb { flex-wrap: nowrap; margin-right: 0 !important; }
    #navbarBlur .breadcrumb-item { white-space: nowrap; }
    #navbarBlur .breadcrumb-item.active, #navbarBlur nav[aria-label="breadcrumb"] h6 {
        min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
    }
    #navbarBlur #navbar { flex: 0 0 auto; width: auto !important; margin-top: 0 !important; margin-right: 0 !important; }
    #navbarBlur #navbar > .ms-md-auto { display: none !important; }        /* empty search slot */
    #navbarBlur #navbar .navbar-nav { flex-direction: row; align-items: center; gap: .15rem; }
    #navbarBlur #navbar .navbar-nav > .nav-item { padding-left: .15rem !important; padding-right: .15rem !important; }
    #navbarBlur #navbar .navbar-nav > .nav-item:not(:has(*)) { display: none !important; }
}
@media (max-width: 400px) {
    #navbarBlur.mx-4 { margin-left: .75rem !important; margin-right: .75rem !important; }
}


/* ── Scrolling: let the PAGE scroll, not a 100vh box inside it ─────────────
   The theme made <main> a fixed-height scroll container (plus 4px of page
   scroll from its top margin) — two scrollbars, no momentum hand-off and the
   mobile address bar never collapses. The sticky top bar still sticks. */
main.main-content.max-height-vh-100 {
    max-height: none !important;
    height: auto !important;
    min-height: 100vh;
    overflow-y: visible !important;
    overflow-x: clip !important;
}

/* DataTables page-size select: wide enough that the number never sits under the arrow */
.dataTables_wrapper .dataTables_length select {
    min-width: 4.75rem; padding-right: 1.9rem !important; background-position: right .55rem center;
    display: inline-block; width: auto;
}
.dataTables_wrapper .dataTables_filter input { box-sizing: border-box; max-width: 100%; }

/* Phones: base_hr wraps every page in .container-fluid and many pages add
   their own .container-fluid inside, doubling the 24px side gutters (48px
   lost each side on a 390px screen). Keep one 12px gutter. */
@media (max-width: 575.98px) {
    main.main-content > .container-fluid { padding-left: .75rem; padding-right: .75rem; }
    main.main-content .container-fluid .container-fluid,
    main.main-content .container-fluid .container { padding-left: 0; padding-right: 0; }
}

/* Published recruitment lists (2026-11-09): each list type has its own
   colour, icon and wording so "all applicants", "shortlisted" and
   "appointed" can't be confused. Used on the public pages and HR pages. */
.rl-badge { display:inline-flex; align-items:center; gap:.35rem; border-radius:999px; padding:.25rem .7rem;
            font-size:.78rem; font-weight:700; letter-spacing:.01em; line-height:1.3; border:1px solid transparent; }
.rl-applicants  { background:#e0ecff; color:var(--ufaa-navy); border-color:#b9d0f5; }
.rl-shortlisted { background:#fdf0d5; color:#7a4d00; border-color:#efd39a; }
.rl-appointed   { background:#dcf5e3; color:#1e5c31; border-color:#a9dcb9; }
.rl-banner { border-radius:.75rem; padding:1rem 1.15rem; border:1px solid; border-left-width:6px; margin-bottom:1.25rem; }
.rl-banner.rl-applicants  { border-left-color:var(--ufaa-navy); }
.rl-banner.rl-shortlisted { border-left-color:#b7791f; }
.rl-banner.rl-appointed   { border-left-color:#1f7a3f; }
.rl-banner .rl-stage { font-size:.72rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; opacity:.85; }
.rl-banner .rl-title { font-size:1.35rem; font-weight:800; margin:.15rem 0 .35rem; display:flex; align-items:center; gap:.5rem; }
.rl-banner p { margin:0; color:inherit !important; font-size:.92rem; }
.rl-card-top { border-radius:.5rem .5rem 0 0; padding:.6rem 1rem; font-weight:800; font-size:.95rem;
               display:flex; align-items:center; gap:.45rem; border-bottom:1px solid; }
.rl-filter { display:flex; flex-wrap:wrap; gap:.4rem; margin-bottom:1rem; }
.rl-filter a { text-decoration:none !important; transition:.15s; }
.rl-filter a.rl-off { background:#fff; color:#344767; border-color:#d6dbe6; }
.rl-filter a[aria-current="page"] { box-shadow:0 0 0 2px var(--ufaa-navy); }

/* Navbar dropdowns — notifications bell and user menu (2026-11-09).
   Below 992px the theme made these menus position:static, so opening one
   pushed the navbar card open; on desktop the menu hung off the card's
   edge. They now float as a panel: under their button on desktop, and
   full-width under the navbar card on phones/tablets. */
.navbar-main .navbar-nav .nav-item.dropdown > .dropdown-menu {
    position: absolute !important;
    top: calc(100% + .5rem) !important;
    right: 0 !important;
    left: auto !important;
    margin: 0 !important;
    transform: none !important;
    border: 1px solid #e8eaf0;
    border-radius: .9rem;
    box-shadow: 0 14px 34px rgba(29, 37, 91, .16), 0 2px 6px rgba(29, 37, 91, .06);
    background: #fff;
    z-index: 1060;
    transition: opacity .15s ease, visibility .15s ease;
}
.navbar-main .navbar-nav .nav-item.dropdown > .dropdown-menu::before { content: none !important; }
/* anchor menus to the navbar card (sticky = positioned), not the small icon */
.navbar-main { position: sticky; }
.navbar-main .navbar-collapse,
.navbar-main .navbar-nav,
.navbar-main .navbar-nav .nav-item.dropdown { position: static !important; }
#notifDropdownList {
    width: 360px;
    min-width: 0 !important;
    max-width: calc(100vw - 2rem);
    max-height: min(70vh, 460px) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
}
#notifDropdownList .dropdown-item { white-space: normal; }
@media (max-width: 991.98px) {
    /* phones / tablets: full card width */
    .navbar-main .navbar-nav .nav-item.dropdown > .dropdown-menu {
        top: calc(100% + .5rem) !important;
        left: 0 !important;
        right: 0 !important;
        width: auto !important;
        max-width: none !important;
    }
    #notifDropdownList { max-height: min(65vh, 440px) !important; }
}
/* the short user menu stays a compact panel at the right, even on phones */
.navbar-main #userDropdown + .dropdown-menu { left: auto !important; right: 0 !important; width: auto !important; min-width: 12rem; }
/* While open, navbar menus are moved to <body> (ufaa-responsive.js) and
   placed here, above every page banner / card. */
.dropdown-menu.ufaa-floating-menu {
    position: fixed !important;
    transform: none !important;
    margin: 0 !important;
    inset: auto;
    z-index: 1075 !important;          /* above page content and the sticky navbar; below modals' backdrop + dialogs */
    max-width: calc(100vw - 16px) !important;
    border: 1px solid #e8eaf0;
    border-radius: .9rem;
    box-shadow: 0 14px 34px rgba(29, 37, 91, .16), 0 2px 6px rgba(29, 37, 91, .06);
    background: #fff;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}
.dropdown-menu.ufaa-floating-menu::before { content: none !important; }
.dropdown-menu.ufaa-floating-menu[aria-labelledby="userDropdown"] { min-width: 12rem; }

/* Sidebar (2026-11-09): header fixed at the top, menu scrolls on its own with
   the browser's native scroll, never chaining into the page, and the last
   items clear the accessibility button in the bottom-left corner. */
#sidenav-main {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;          /* .navbar wraps by default */
    align-items: stretch !important;
    justify-content: flex-start !important;
    height: calc(100vh - 2rem) !important;
    max-height: none !important;
    overflow: hidden !important;
}
#sidenav-main > .sidenav-header,
#sidenav-main > hr { flex: 0 0 auto; }
#sidenav-main > #sidenav-scrollbar,
#sidenav-main > #sidenav-collapse-main {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(29, 37, 91, .25) transparent;
    -webkit-overflow-scrolling: touch;
}
#sidenav-main > #sidenav-scrollbar::-webkit-scrollbar,
#sidenav-main > #sidenav-collapse-main::-webkit-scrollbar { width: 6px; }
#sidenav-main > #sidenav-scrollbar::-webkit-scrollbar-thumb,
#sidenav-main > #sidenav-collapse-main::-webkit-scrollbar-thumb { background: rgba(29, 37, 91, .25); border-radius: 6px; }
#sidenav-scrollbar > #sidenav-collapse-main {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}
#sidenav-scrollbar { padding-bottom: 0 !important; }
#sidenav-main .navbar-nav { padding-bottom: 5.5rem !important; }

/* Shared pager (templates/includes/_pager.html), 2026-11-09 */
.ufaa-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem;
              padding: .75rem 1rem; border-top: 1px solid #eef0f4; font-size: .78rem; }
.ufaa-pager-info { color: #67748e; }
.ufaa-pager ul { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; }
.ufaa-pager a, .ufaa-pager span.current, .ufaa-pager span.disabled, .ufaa-pager span.gap {
    display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-width: 2.1rem; height: 2.1rem;
    padding: 0 .6rem; border-radius: .5rem; border: 1px solid #d6dbe6; background: #fff; color: var(--ufaa-navy);
    font-weight: 700; text-decoration: none; line-height: 1; transition: .15s; }
.ufaa-pager a:hover { border-color: var(--ufaa-gold); background: #fffaf0; color: var(--ufaa-navy); }
.ufaa-pager span.current { background: var(--ufaa-navy); border-color: var(--ufaa-navy); color: #fff; }
.ufaa-pager span.disabled { color: #b8c0cc; background: #f8f9fc; }
.ufaa-pager span.gap { border-color: transparent; background: transparent; min-width: 1.2rem; padding: 0; }
.ufaa-pager .fas { font-size: .65rem; }
@media (max-width: 575.98px) {
    .ufaa-pager { justify-content: center; }
    .ufaa-pager-info { width: 100%; text-align: center; }
    .ufaa-pager-word { display: none; }
}

/* ── Browser surfaces (2026-11-11) ──────────────────────────────────────
   Text selection, input caret, placeholder, focus ring, link underlines.
   The Soft UI theme ships a pink focus ring (#e293d3); this layer loads
   last, so these rules reliably override it everywhere. ────────────── */

/* Text selection: navy background with gold-soft text */
::selection      { background: var(--ufaa-navy); color: var(--ufaa-gold-soft); }
::-moz-selection { background: var(--ufaa-navy); color: var(--ufaa-gold-soft); }

/* Input caret */
input, textarea, [contenteditable] { caret-color: var(--ufaa-navy); }

/* Placeholder: consistent muted grey across browsers.
   #67748e on #fff is ~5.2:1 — passes WCAG AA for normal text. */
::placeholder { color: var(--ufaa-muted); opacity: 1; }

/* Focus ring: brand gold box-shadow replaces Soft UI's pink ring */
.form-control:focus, .form-select:focus {
    border-color: var(--ufaa-gold-mid) !important;
    box-shadow: 0 0 0 3px rgba(195, 149, 69, .18) !important;
    outline: 0 !important;
}
/* Suppress duplicate outline on inputs during keyboard navigation so the
   gold box-shadow is the sole ring */
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none !important; }

/* Keyboard-only focus ring for buttons, links, and all other controls */
:focus-visible {
    outline: 2px solid var(--ufaa-navy);
    outline-offset: 2px;
}
/* Mouse-triggered focus on links: no ring */
a:focus:not(:focus-visible) { outline: none; }

/* Link underlines: lifted clear of descenders, 1px weight */
a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
