/*
 * DigiStawi additions to the AdminKit theme (light.css): the few utility classes the views use
 * that AdminKit does not ship, plus the DataTables spacing inside cards.
 */

/* Avatars: a stored picture (background image) or the person's initials. */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0;
    border-radius: 50%;
    background: #e9ecef no-repeat center / cover;
    color: #495057;
    font-weight: 600;
    font-size: .875rem;
    vertical-align: middle;
    flex-shrink: 0;
}
.avatar-xs { width: 1.25rem; height: 1.25rem; font-size: .5rem; }
.avatar-sm { width: 2rem; height: 2rem; font-size: .75rem; }
.avatar-md { width: 3.5rem; height: 3.5rem; font-size: 1.125rem; }
.avatar-lg { width: 4.5rem; height: 4.5rem; font-size: 1.5rem; }
.avatar-xl { width: 6rem; height: 6rem; font-size: 2rem; }
.avatar-2xl { width: 8rem; height: 8rem; font-size: 2.75rem; }

/* Cards: a header holds its title and, on the right, its actions. */
.card-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.card-header .card-title { margin-bottom: 0; }
.card-header > .card-header-tabs { flex: 1 1 100%; }
.card-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.card-table { margin-bottom: 0; }
.card-table > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.card-table > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.card-md > .card-body { padding: 2rem; }
.table-vcenter > :not(caption) > * > * { vertical-align: middle; }

.row-cards { --bs-gutter-y: 1.5rem; }
.row-deck > .col, .row-deck > [class*="col-"] { display: flex; align-items: stretch; }
.row-deck > .col > .card, .row-deck > [class*="col-"] > .card { flex: 1 1 auto; }

.btn-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; padding-left: .5rem; padding-right: .5rem; }

.form-hint { display: block; margin-top: .25rem; color: #6c757d; font-size: .8125rem; }
.form-footer { margin-top: 1.5rem; }
.subheader { font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; }
.list-inline-dots .list-inline-item + .list-inline-item::before { content: "\00B7"; margin-right: .5rem; }

.icon { width: 1.25rem; height: 1.25rem; stroke-width: 1.5; vertical-align: -.2em; }

/* A plain .btn (no colour variant) is a secondary action: AdminKit draws it borderless, so it
   read as text beside a primary button. Give it an outline. light.css hard-codes .btn's colours
   (no --bs-btn-* variables), so set the properties themselves; the :not() list also outranks
   AdminKit's `.card-actions a`. */
.btn:not(.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info, .btn-light, .btn-dark, .btn-link, .btn-close, [class*="btn-outline-"], [class*="btn-ghost-"]) {
    color: var(--bs-body-color, #495057);
    background-color: var(--bs-card-bg, transparent);
    border-color: var(--bs-border-color, #ced4da);
}
.btn:not(.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info, .btn-light, .btn-dark, .btn-link, .btn-close, [class*="btn-outline-"], [class*="btn-ghost-"]):is(:hover, :focus-visible, .active) {
    color: var(--bs-body-color, #495057);
    background-color: rgba(127, 127, 127, .1);
    border-color: #adb5bd;
}

/* AdminKit greys every link in a card header (`.card-actions a`), which beats a link button's
   own colour: "Add member" read grey on blue. Give coloured link buttons their text back. */
.card-actions a:is(.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-info, .btn-dark) { color: #fff; }
.card-actions a.btn-warning, .card-actions a.btn-light { color: #000; }
.card-actions a.btn-outline-primary:not(:hover) { color: var(--bs-primary, #02842a); }
.card-actions a.btn-outline-primary:hover { color: #fff; }
.card-actions a.btn-ghost-primary:not(:hover) { color: var(--bs-primary, #02842a); }
.card-actions a.btn-ghost-danger:not(:hover) { color: var(--bs-danger, #dc3545); }

/* Ghost buttons: text-coloured until hovered. */
.btn-ghost-primary, .btn-ghost-secondary, .btn-ghost-danger, .btn-ghost-success, .btn-ghost-warning {
    background: transparent;
    border-color: transparent;
}
.btn-ghost-primary { color: var(--bs-primary); }
.btn-ghost-secondary { color: var(--bs-secondary); }
.btn-ghost-danger { color: var(--bs-danger); }
.btn-ghost-success { color: var(--bs-success); }
.btn-ghost-warning { color: var(--bs-warning); }
.btn-ghost-primary:hover { background: var(--bs-primary); color: #fff; }
.btn-ghost-secondary:hover { background: var(--bs-secondary); color: #fff; }
.btn-ghost-danger:hover { background: var(--bs-danger); color: #fff; }
.btn-ghost-success:hover { background: var(--bs-success); color: #fff; }
.btn-ghost-warning:hover { background: var(--bs-warning); color: #fff; }

/* Light badges (statuses): tinted background, coloured text. */
.bg-blue-lt { background-color: #e1ecfa !important; color: #3b7ddd !important; }
.bg-azure-lt { background-color: #e0f2fb !important; color: #2a9fd6 !important; }
.bg-green-lt { background-color: #ddf3ec !important; color: #1a9068 !important; }
.bg-yellow-lt { background-color: #fdf3dc !important; color: #b07c00 !important; }
.bg-orange-lt { background-color: #fdeadb !important; color: #d0661b !important; }
.bg-red-lt { background-color: #fbe2e2 !important; color: #c8333a !important; }
.bg-secondary-lt { background-color: #eceef0 !important; color: #5c656e !important; }

/* Group switcher in the top bar. */
#tenantSwitchDropdown { display: inline-flex; align-items: center; }
#tenantSwitchDropdown + .dropdown-menu { max-height: 60vh; overflow-y: auto; }

/* DataTables inside cards. */
.card > .dt-container > .dt-layout-row, .card .table-responsive > .dt-container > .dt-layout-row { padding: .5rem 1rem; margin: 0; }
.card .dt-container .dt-layout-table { padding: 0; }

/* Dark theme (dark.css, body[data-theme=dark], set for Dark and for Auto on a dark system). */
body[data-theme=dark] .avatar { background-color: #3e4676; color: #e9ecef; }
body[data-theme=dark] .bg-blue-lt { background-color: rgba(59, 125, 221, .2) !important; color: #8bb3ee !important; }
body[data-theme=dark] .bg-azure-lt { background-color: rgba(42, 159, 214, .2) !important; color: #7fc6e8 !important; }
body[data-theme=dark] .bg-green-lt { background-color: rgba(28, 187, 140, .2) !important; color: #6fd6b5 !important; }
body[data-theme=dark] .bg-yellow-lt { background-color: rgba(252, 185, 44, .2) !important; color: #fcd27a !important; }
body[data-theme=dark] .bg-orange-lt { background-color: rgba(253, 126, 20, .2) !important; color: #feb06e !important; }
body[data-theme=dark] .bg-red-lt { background-color: rgba(220, 53, 69, .2) !important; color: #f08a94 !important; }
body[data-theme=dark] .bg-secondary-lt { background-color: rgba(108, 117, 125, .25) !important; color: #c3c8cd !important; }
body[data-theme=dark] .form-hint, body[data-theme=dark] .subheader { color: #adb5bd; }

/* Select2 (every <select>, see initSelect2() in _pages.js) drawn like AdminKit's .form-select:
   same height, border, radius and focus ring; red when the field is invalid; dark theme too. */
.select2-container { width: 100% !important; }
.select2-container .select2-selection--single,
.select2-container .select2-selection--multiple {
    min-height: calc(1.5em + .6rem + 2px);
    border: 1px solid #ced4da;
    border-radius: .2rem;
    background-color: #fff;
    font-size: .875rem;
}
.select2-container .select2-selection--single { height: auto; }
.select2-container .select2-selection--single .select2-selection__rendered {
    padding: .3rem 2.55rem .3rem .85rem;
    line-height: 1.5;
    color: #495057;
}
.select2-container .select2-selection--single .select2-selection__arrow { height: 100%; right: .5rem; }
.select2-container .select2-selection--single .select2-selection__clear { margin-right: .25rem; color: #6c757d; }
.select2-container .select2-selection--multiple .select2-selection__rendered { padding: .15rem .5rem; }
.select2-container .select2-selection--multiple .select2-selection__choice {
    margin-top: .2rem;
    border: 0;
    border-radius: .2rem;
    background-color: rgba(2, 132, 42, .12);
    color: #02842a;
}
.select2-container--focus .select2-selection,
.select2-container--open .select2-selection {
    border-color: #80c294 !important;
    box-shadow: 0 0 0 .2rem rgba(2, 132, 42, .25);
    outline: 0;
}
.select2-dropdown { border-color: #ced4da; border-radius: .2rem; font-size: .875rem; z-index: 1060; }
.select2-search--dropdown .select2-search__field { border: 1px solid #ced4da; border-radius: .2rem; padding: .3rem .6rem; outline: 0; }
.select2-results__option { padding: .4rem .85rem; }
.select2-container .select2-results__option--highlighted[aria-selected] { background-color: #02842a; color: #fff; }
.select2-container--disabled .select2-selection { background-color: #e9ecef !important; }
select.is-invalid + .select2-container .select2-selection { border-color: #dc3545 !important; }
select.is-invalid ~ .invalid-feedback { display: block; }

body[data-theme="dark"] .select2-container .select2-selection--single,
body[data-theme="dark"] .select2-container .select2-selection--multiple,
body[data-theme="dark"] .select2-dropdown,
body[data-theme="dark"] .select2-search--dropdown .select2-search__field {
    background-color: #222e3c;
    border-color: #7a828a;
    color: #bdc0c5;
}
body[data-theme="dark"] .select2-container .select2-selection--single .select2-selection__rendered { color: #bdc0c5; }
body[data-theme="dark"] .select2-container .select2-selection--single .select2-selection__placeholder { color: #91979e; }
body[data-theme="dark"] .select2-container .select2-selection--single .select2-selection__arrow b { border-top-color: #bdc0c5; }
body[data-theme="dark"] .select2-results__option[aria-selected="true"] { background-color: #2b3947; }
body[data-theme="dark"] .select2-container--disabled .select2-selection { background-color: #2b3947 !important; }

/* DataTables right-aligns columns it detects as numbers or dates; member numbers, phones and
   dates read better on the left like every other column. Amounts opt in with .text-end. */
table.dataTable th.dt-type-numeric, table.dataTable td.dt-type-numeric,
table.dataTable th.dt-type-date, table.dataTable td.dt-type-date { text-align: left; }
table.dataTable th.dt-type-numeric div.dt-column-header, table.dataTable th.dt-type-date div.dt-column-header { flex-direction: row; }
table.dataTable th.text-end, table.dataTable td.text-end { text-align: right; }
.dt-length select { width: auto; display: inline-block; margin-right: .35rem; }
.card .dt-container > .dt-layout-table:first-child { margin-top: 0 !important; }

/* AdminKit pads only an inner .alert-message; the views put text straight into .alert. */
.alert { padding: .75rem 1rem; }
.alert > .alert-message { padding: 0; border: 0; }

/* Page header (layouts.app): a larger title; the trail beside it is small and uses "/" (light.css ships a broken divider). */
.page-header .page-title {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.breadcrumb {
    --bs-breadcrumb-divider: "/";
}

/* The main menu in the logo's navy, with its greens and lime for the active item (both themes). */
#sidebar {
    --menu-bg: #06295a;
    --menu-bg-deep: #031b3d;
    --menu-text: rgba(229, 238, 250, .78);
    --menu-text-strong: #fff;
    --menu-muted: #8aa6cc;
    --menu-accent: #7ed957;
    --menu-hover: rgba(255, 255, 255, .06);
}
#sidebar, #sidebar .sidebar-content { background: linear-gradient(180deg, var(--menu-bg) 0%, var(--menu-bg-deep) 100%); }
#sidebar .sidebar-brand { display: flex; align-items: center; padding: .75rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, .08); }
#sidebar .sidebar-brand:hover .brand-logo-stawi, #sidebar .sidebar-brand:focus-visible .brand-logo-stawi { color: #a6ec82; }
#sidebar .sidebar-brand:focus-visible { outline: 2px solid var(--menu-accent); outline-offset: -4px; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; }
.brand-logo-mark { flex: none; display: block; }
.brand-logo-word { font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.brand-logo-digi { color: #fff; }
.brand-logo-stawi { color: var(--menu-accent, #7ed957); transition: color .2s ease; }
#sidebar .sidebar-header { color: var(--menu-muted); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
#sidebar .sidebar-link, #sidebar .sidebar-link i, #sidebar .sidebar-link svg { color: var(--menu-text); background: transparent; }
#sidebar .sidebar-link { border-left: 3px solid transparent; transition: background-color .15s ease, color .15s ease; }
#sidebar .sidebar-link:hover, #sidebar .sidebar-link:hover i, #sidebar .sidebar-link:hover svg { color: var(--menu-text-strong); }
#sidebar .sidebar-link:hover { background: var(--menu-hover); }
#sidebar .sidebar-item.active > .sidebar-link, #sidebar .sidebar-item.active .sidebar-link:hover {
    background: linear-gradient(90deg, rgba(126, 217, 87, .18), rgba(126, 217, 87, .04) 70%, transparent);
    border-left-color: var(--menu-accent);
    color: var(--menu-text-strong);
}
#sidebar .sidebar-item.active > .sidebar-link i, #sidebar .sidebar-item.active > .sidebar-link svg { color: var(--menu-accent); }
#sidebar .sidebar-dropdown .sidebar-link { border-left: 0; color: #b4c6e0; background: transparent; }
#sidebar .sidebar-dropdown .sidebar-item.active .sidebar-link, #sidebar .sidebar-dropdown .sidebar-link:hover { color: var(--menu-accent); background: transparent; }
