/* Shared presentation for AJAX views. Loaded after the legacy theme. */
:root {
    --th-navy: #173f63;
    --th-navy-dark: #102d48;
    --th-navy-soft: #286b9a;
    --th-bg: #f3f6fa;
    --th-border: #e3eaf1;
    --th-text: #24364b;
    --th-text-muted: #60748a;
}
body { text-rendering: optimizeLegibility; }
body .app-content .content-wrapper { padding: 28px; }
.app-content .content-body, .app-content .card-content,
.app-content .card-body, .content-header > div { min-width: 0; }
.app-content .content-header-title { overflow-wrap: anywhere; letter-spacing: -.3px; }
.app-content .card {
    border: 1px solid var(--th-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 18px rgba(24, 53, 81, .045) !important;
}
.app-content .card .card-body { padding: 24px !important; }
.app-content .card .card-body .tab-content .card {
    border: 0 !important;
    box-shadow: none !important;
}
.app-content .card .card-body .tab-content .card .card-body { padding: 12px 0 !important; }
.header-navbar.navbar-light {
    background: var(--th-navy-dark) !important;
    border-bottom: 2px solid #c7a75b !important;
    box-shadow: 0 3px 16px rgba(16, 45, 72, .12);
}
.header-navbar .navbar-brand .brand-text { font-size: 21px !important; }
.header-navbar .dropdown-menu i { color: var(--th-navy) !important; }
.header-navbar .dropdown-user-link { display: flex; align-items: center; gap: 10px; }
.header-navbar .user-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main-menu .navigation-header img { max-width: 92px; }
.main-menu .navigation-header { padding: 20px 12px !important; }
.main-menu .navigation > li > a { border-radius: 8px !important; }
.main-menu .navigation .menu-content > li.active > a {
    background: #eaf1f8 !important;
    color: var(--th-navy) !important;
    box-shadow: inset 3px 0 0 var(--th-navy);
}
.workspace-hero {
    margin: 0 0 26px;
    padding: 28px 18px;
    align-items: center;
    border: 1px solid #dce6f0;
    border-radius: 18px;
    background: linear-gradient(115deg, #fff 25%, #eaf2f9);
}
.workspace-eyebrow {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 1.2px;
    color: var(--th-navy-soft);
}
.workspace-hero .content-header-title { font-size: clamp(21px, 2vw, 28px) !important; line-height: 1.5; }
.workspace-hero .dash-subtitle { display: block; margin-top: 8px; }
.workspace-hero .content-header-left { margin-bottom: 0 !important; }
.workspace-hero .dash-quicksearch { background: #fff; border-radius: 12px; box-shadow: 0 3px 12px #173f6308; }
.workspace-hero .dash-quicksearch .form-control { min-width: 0; font-size: 14px !important; }
.dash-quick-menu { margin-bottom: 16px !important; }
.dash-quick-btn { border-radius: 14px; min-height: 120px; box-shadow: none; }
.dash-quick-btn > span { font-weight: 500; }
.app-content #block-examples .card { border-top: 1px solid var(--th-border) !important; }
.app-content #block-examples .card h3 { font-size: 36px !important; font-variant-numeric: tabular-nums; }
.app-content #block-examples .card .media-right i { font-size: 28px !important; opacity: .65; }
.app-content #block-examples .card .progress { height: 5px; }
.dash-panel-header { flex-wrap: wrap; gap: 10px; }
.dash-panel-title { min-width: 0; overflow-wrap: anywhere; }
.app-content .btn, .modal .btn { min-height: 42px; border-radius: 9px !important; }
.app-content .btn:hover { transform: none; }
.app-content .form-control, .modal .form-control { min-height: 44px; border-radius: 9px !important; }
.app-content .form-control:focus, .modal .form-control:focus {
    border-color: #598aaf !important;
    box-shadow: 0 0 0 3px rgba(40, 107, 154, .12) !important;
}
.select2-container { max-width: 100%; }
.select2-container .select2-selection--multiple .select2-selection__choice { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.app-content .nav-tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; gap: 4px; scrollbar-width: thin; }
.app-content .nav-tabs .nav-item { flex: 0 0 auto; }
.app-content .nav-tabs .nav-link { padding: 13px 18px !important; white-space: nowrap; }
.app-content .dataTables_wrapper { width: 100%; min-width: 0; }
.app-content .dataTables_filter input { max-width: 100%; min-height: 40px; }
.app-content .dt-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.app-content table.table thead th { background: #f0f5fa !important; color: #34536e !important; font-size: 14px !important; }
.app-content table.table tbody td { font-size: 14px !important; vertical-align: middle; overflow-wrap: anywhere; }
.app-content table.dataTable > tbody > tr.child ul.dtr-details { display: block; width: 100%; }
.app-content table.dataTable > tbody > tr.child ul.dtr-details > li { padding: 9px 0; white-space: normal; overflow-wrap: anywhere; }
.app-content table.dataTable > tbody > tr.child span.dtr-title { min-width: 110px; margin-right: 12px; }
.app-content .dataTables_paginate .pagination { flex-wrap: wrap; gap: 3px; }
.table-responsive { scrollbar-width: thin; }
.modal-dialog { max-width: calc(100% - 32px); }
.modal .modal-content { border-radius: 16px !important; }
.modal .modal-header { align-items: center; }
.modal .modal-header .close { min-width: 44px; min-height: 44px; }
.modal .modal-title { overflow-wrap: anywhere; }
.modal .modal-footer { flex-wrap: wrap; gap: 8px; }
.modal .modal-body { overflow-wrap: anywhere; }
.modal .dash-upload { max-width: 100%; }
.footer.footer-light { background: transparent !important; font-size: 12px; padding: 16px 8px; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
    outline: 3px solid #3885b8 !important;
    outline-offset: 3px;
}
body:not(.fixed-navbar) .app-content.content { margin-left: 0 !important; }
body:not(.fixed-navbar) .footer { margin-left: 0 !important; }
body .login-bg > .content-body { width: 100%; max-width: 920px; }
@media (min-width: 576px) {
    .modal-dialog:not(.modal-lg):not(.modal-xl):not(.modal-sm) { max-width: 560px; }
    .modal-dialog.modal-sm { max-width: 360px; }
}
@media (min-width: 992px) {
    .modal-dialog.modal-lg { max-width: min(1000px, calc(100% - 64px)); }
    .modal-dialog.modal-xl { max-width: min(1200px, calc(100% - 64px)); }
}
@media (max-width: 1199.98px) {
    .workspace-hero > div { flex: 0 0 100%; max-width: 100%; }
    .workspace-hero .content-header-right { margin-top: 20px; }
}
@media (max-width: 767.98px) {
    body .app-content .content-wrapper { padding: 16px; }
    .header-navbar { padding-left: 10px; padding-right: 10px; }
    .header-navbar .navbar-container { background: var(--th-navy-dark); }
    .header-navbar .navbar-header .navbar-brand { padding-left: 0; padding-right: 0; }
    .header-navbar .user-name { max-width: 180px; }
    .header-navbar .dash-bell-menu { position: fixed !important; top: 112px; right: 12px !important; left: 12px !important; width: auto !important; min-width: 0; max-width: none; transform: none !important; }
    .dash-bell-list { max-height: 45vh; }
    .workspace-hero { padding: 20px 4px; margin-bottom: 20px; }
    .app-content .card .card-body { padding: 18px !important; }
    .app-content .content-header-right { display: flex; flex-wrap: wrap; gap: 8px; }
    .app-content .content-header-right > .btn { flex: 1 1 auto; margin: 0; }
    .app-content .nav-tabs .nav-link { font-size: 14px !important; }
    .app-content .tab-content { padding-left: 0 !important; padding-right: 0 !important; }
    .app-content .dataTables_filter { float: none !important; text-align: left !important; width: 100%; }
    .app-content .dataTables_filter label { display: flex; align-items: center; gap: 8px; width: 100%; }
    .app-content .dataTables_filter input { flex: 1; min-width: 0; width: auto !important; margin-left: 0 !important; }
    .app-content .dataTables_info, .app-content .dataTables_paginate { float: none !important; text-align: left !important; padding-top: 12px; }
    .app-content .dataTables_paginate .pagination { justify-content: flex-start !important; }
    .dash-search-meta { display: none; }
    .dash-search-doc { max-width: 38%; overflow: hidden; text-overflow: ellipsis; }
    .modal .modal-body { padding: 16px !important; }
    .modal .modal-body > .col-lg-12 { padding: 0; }
    .modal .modal-footer .btn { flex: 1 1 auto; margin: 0; white-space: normal; }
}
@media (max-width: 575.98px) {
    body .app-content .content-wrapper { padding: 12px; }
    .app-content .card .card-body { padding: 14px !important; }
    .dash-quick-menu .row { margin-left: -6px; margin-right: -6px; }
    .dash-quick-menu .row > div { padding-left: 6px; padding-right: 6px; margin-bottom: 12px !important; }
    .dash-quick-btn { min-height: 108px; padding: 16px 8px; }
    .dash-quicksearch button { display: inline-block; }
    .modal-dialog { margin: 12px auto; max-width: calc(100% - 24px); }
    .modal .modal-header { padding: 12px 16px !important; }
    body .login-bg { padding: 12px; }
    body .login-form-side { padding: 24px 20px; min-width: 0; }
    body .login-shell { border-radius: 16px; }
}
/* Search drawer: only the fields scroll; header and actions stay in view. */
.app-content .kanban-sidebar {
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(100%);
    visibility: hidden;
}
.app-content .kanban-sidebar.show {
    transform: translateX(0);
    visibility: visible;
}
.kanban-sidebar #searchsidebar {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    margin: 0;
    border: 0 !important;
    border-radius: 0 !important;
}
#searchsidebar > .card-header { flex: 0 0 auto; }
#searchsidebar .card-header .card-title { margin-bottom: 0; }
#searchsidebar .close-icon { min-width: 44px; min-height: 44px; }
#searchsidebar #fSearchBook {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
}
#searchsidebar #fSearchBook > .form-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    padding: 0 20px;
}
#searchsidebar .form-body > .row { margin: 0; }
#searchsidebar .form-body > .row > div { padding: 20px 0 !important; }
#searchsidebar .form-section { margin: 12px 0 20px; font-size: 17px !important; }
#searchsidebar .form-group.row { margin-bottom: 18px; }
#searchsidebar .form-group.row > label,
#searchsidebar .form-group.row > div {
    flex: 0 0 100%;
    max-width: 100%;
    text-align: left;
}
#searchsidebar #fSearchBook > .card-footer {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--th-border);
}
#searchsidebar .card-footer .btn { flex: 1 1 auto; margin: 0 !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
