/*
 * The look of the original administration (Bootstrap 3 theme: blue gradient header, green and red menu on the left,
 * panels with a blue title bar) on top of Bootstrap 5. Styling only: nothing here changes what a page does.
 * Loaded by App\Modules\Admin\Views\layout after Bootstrap and the layout's own small <style>.
 */

/* the original ran on a 14px base; this is 25% larger (17.5px) so it reads more easily */
html { font-size: 17.5px; }
body { font-family: Helvetica, Arial, sans-serif; background: #f4f4f4; color: #333; }

/* ---------- header band ---------- */
.bfa-header {
    position: relative;
    min-height: 104px;
    color: #fff;
    background: #23538a;   /* flat: the dark end of the original's gradient */
}
.bfa-title {
    display: inline-block;
    margin-left: 14px;
    padding: 6px 0 4px;
    line-height: 1.1;
}
.bfa-title a { display: block; color: #fff; text-decoration: none; }
.bfa-title { text-align: center; }
.bfa-title img { display: block; height: 72px; width: 72px; margin: 0 auto; }   /* the square site logo, 200x200 */
.bfa-title span { display: block; margin-top: 2px; font-size: 1.05em; font-weight: bold; letter-spacing: .03em; text-shadow: 1px 1px 2px #0d0d0d; }
.bfa-headmenu { position: absolute; right: 5px; top: 5px; display: flex; gap: 1px; }
.bfa-headmenu a {
    display: inline-block;
    padding: 1px 5px;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
    text-decoration: none;
    background: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
    border: 1px solid #adadad;
    border-radius: 3px;
}
.bfa-headmenu a:hover, .bfa-headmenu a:focus-visible { background: #e0e0e0; border-color: #8c8c8c; }
.bfa-user {
    position: absolute;
    right: 5px;
    bottom: 3px;
    padding: 2px 5px;
    font-size: .8em;
    font-weight: bold;
    color: #cf0000;
    background: #fff;
    border: thin inset #faf9f9;
    border-radius: 5px;
}
.bfa-user a { color: #337ab7; text-decoration: none; }
.bfa-user a:hover { text-decoration: underline; }

/* ---------- menu on the left ---------- */
.bfa-menu { margin-top: 5px; }
.bfa-menu ul { list-style: none; margin: 0 0 10px; padding: 2px; }
.bfa-menu li { margin: 0; }
.bfa-menu a {
    position: relative;
    display: block;
    padding: 10px 15px;
    margin-bottom: -1px;
    text-decoration: none;
    border: 1px solid #ddd;
}
.bfa-menu li:first-child a { border-top-left-radius: 4px; border-top-right-radius: 4px; }
.bfa-menu li:last-child a { margin-bottom: 0; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; }
.bfa-menu .bfa-features a { color: #3c763d; background: #dff0d8; border-color: #d6e9c6; }
.bfa-menu .bfa-features a:hover, .bfa-menu .bfa-features a:focus-visible { background: #d0e9c6; color: #3c763d; }
.bfa-menu .bfa-manage a { color: #a94442; background: #f2dede; border-color: #ebccd1; }
.bfa-menu .bfa-manage a:hover, .bfa-menu .bfa-manage a:focus-visible { background: #ebcccc; color: #a94442; }
.bfa-menu a.active, .bfa-menu a.active:hover {
    z-index: 2;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, .2);
    background: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%);
    border-color: #2b669a;
}
.bfa-menu .bfa-icon { vertical-align: -2px; margin-right: 7px; }
.bfa-menu .bfa-count {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 2px 6px;
    font-size: 75%;
    font-weight: bold;
    line-height: 1;
    color: #fff;
    background: #5cb85c;
    border-radius: .25em;
}

/* ---------- panels: a blue title bar over the white page ---------- */
.admin-page, .admin-box {
    overflow: hidden;
    border-color: #428bca;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .05);
}
.admin-page { margin-top: 5px; }
.admin-page > h1:first-child, .admin-box > h3:first-child {
    margin: -20px -24px 16px;
    padding: 10px 15px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 1px 1px 2px #0d0d0d;
    background: linear-gradient(to bottom, #428bca 0%, #357ebd 100%);
    border-bottom: 1px solid #357ebd;
}
.admin-box > h3:first-child { margin: -24px -28px 16px; }

/* ---------- buttons: the gradient buttons of the original ---------- */
.btn { border-radius: 4px; text-shadow: 0 -1px 0 rgba(0, 0, 0, .15); }
.btn-primary { --bs-btn-bg: #337ab7; --bs-btn-border-color: #2e6da4; --bs-btn-hover-bg: #286090; --bs-btn-hover-border-color: #204d74; --bs-btn-active-bg: #286090; --bs-btn-active-border-color: #204d74; --bs-btn-disabled-bg: #337ab7; --bs-btn-disabled-border-color: #2e6da4; background-image: linear-gradient(to bottom, #428bca 0%, #2d6ca2 100%); }
.btn-success { --bs-btn-bg: #5cb85c; --bs-btn-border-color: #4cae4c; --bs-btn-hover-bg: #449d44; --bs-btn-hover-border-color: #398439; --bs-btn-active-bg: #449d44; --bs-btn-active-border-color: #398439; --bs-btn-disabled-bg: #5cb85c; --bs-btn-disabled-border-color: #4cae4c; background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%); }
.btn-warning { --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-bg: #f0ad4e; --bs-btn-border-color: #eea236; --bs-btn-hover-bg: #ec971f; --bs-btn-hover-border-color: #d58512; --bs-btn-active-bg: #ec971f; --bs-btn-active-border-color: #d58512; background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%); }
.btn-danger { --bs-btn-bg: #d9534f; --bs-btn-border-color: #d43f3a; --bs-btn-hover-bg: #c9302c; --bs-btn-hover-border-color: #ac2925; --bs-btn-active-bg: #c9302c; --bs-btn-active-border-color: #ac2925; background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%); }
.btn-info { --bs-btn-color: #fff; --bs-btn-hover-color: #fff; --bs-btn-active-color: #fff; --bs-btn-bg: #5bc0de; --bs-btn-border-color: #46b8da; --bs-btn-hover-bg: #31b0d5; --bs-btn-hover-border-color: #269abc; --bs-btn-active-bg: #31b0d5; --bs-btn-active-border-color: #269abc; background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%); }
.btn-secondary, .btn-light, .btn-outline-secondary, .btn-outline-primary, .btn-outline-danger, .btn-outline-success, .btn-outline-dark {
    --bs-btn-color: #333; --bs-btn-bg: #fff; --bs-btn-border-color: #ccc;
    --bs-btn-hover-color: #333; --bs-btn-hover-bg: #e6e6e6; --bs-btn-hover-border-color: #adadad;
    --bs-btn-active-color: #333; --bs-btn-active-bg: #e0e0e0; --bs-btn-active-border-color: #adadad;
    --bs-btn-disabled-color: #777; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: #ccc;
    background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
    text-shadow: 0 1px 0 #fff;
}
.btn-outline-danger { --bs-btn-color: #c9302c; --bs-btn-hover-color: #c9302c; }
.btn-primary:hover, .btn-primary:active, .btn-success:hover, .btn-success:active, .btn-warning:hover, .btn-warning:active,
.btn-danger:hover, .btn-danger:active, .btn-info:hover, .btn-info:active,
.btn-secondary:hover, .btn-light:hover, .btn-outline-secondary:hover, .btn-outline-primary:hover, .btn-outline-danger:hover,
.btn-outline-success:hover, .btn-outline-dark:hover { background-image: none; }

/* ---------- form fields: each in its own grey box with a green label tab, like the original's "formItem" ---------- */
/* a field is a top-level block of a form, a field in a column of a row (Town / State / Zip), or a lone tick box */
:is(.admin-page, .admin-box) form > .mb-3,
:is(.admin-page, .admin-box) form > fieldset.mb-3,
:is(.admin-page, .admin-box) form > .form-check,
:is(.admin-page, .admin-box) form .row > [class*="col"] > .mb-3 {
    position: relative;
    margin-bottom: 8px !important;
    padding: 12px 12px 10px;
    background: #efefef;
    border: 1px solid #c7c7c7;
    border-radius: 3px;
}
:is(.admin-page, .admin-box) form > .form-check { padding: 10px 12px 10px calc(12px + 1.5em) !important; }
:is(.admin-page, .admin-box) form .row { --bs-gutter-x: 8px; }
/* the label (or the legend of a group of tick boxes) is the green tab across the top-left corner of the box */
:is(.admin-page, .admin-box) form > .mb-3 > .form-label,
:is(.admin-page, .admin-box) form > fieldset.mb-3 > legend,
:is(.admin-page, .admin-box) form .row > [class*="col"] > .mb-3 > .form-label {
    display: block;
    float: none;
    width: fit-content;
    min-width: 30%;
    max-width: calc(100% + 24px);
    margin: -12px -12px 10px;
    padding: 3px 10px 3px 8px;
    font-size: .85rem !important;
    font-weight: 400 !important;
    color: #000;
    background: #a3c996;
    border-top-left-radius: 3px;
    border-bottom-right-radius: 10px;
}
:is(.admin-page, .admin-box) form > h2 { margin: 22px 0 10px !important; padding-bottom: 4px; color: #23538a; border-bottom: 2px solid #a3c996; }
/* ---------- number badges: plain weight, no shadow (the buttons' shadow made the digits blur) ---------- */
.badge, .bfa-count { font-weight: 400; text-shadow: none; letter-spacing: .02em; }
.badge { font-size: .86em; }   /* was .75em: about 2px larger */
.bfa-menu .bfa-count { font-size: 92%; padding: 3px 7px; }   /* was 80% */

/* ---------- tables: the grey header bar of the original's lists ---------- */
.admin-page table thead th {
    background: linear-gradient(to bottom, #fafafa 0%, #e4e4e4 100%);
    border-bottom: 1px solid #bbb;
}

/* ---------- login and small pages ---------- */
.admin-box { margin-top: 40px; }

/* ---------- narrow screens: the menu goes above the page ---------- */
@media (max-width: 767.98px) {
    .bfa-header { padding-bottom: 6px; }
    .bfa-title { margin-left: 8px; }
    .bfa-title img { height: 56px; width: 56px; }
    .bfa-headmenu { position: static; margin: 4px 5px 0; flex-wrap: wrap; }
    .bfa-user { position: static; display: inline-block; margin: 4px 5px 0; }
    .bfa-menu { margin-bottom: 10px; }
    /* the menu sits behind a "Menu" button here (see the layout); the buttons of a form row fill the width */
    .bfa-menu-toggle { font-weight: bold; }
    .container-fluid { padding-left: 8px; padding-right: 8px; }
    .admin-page { padding: 14px; margin: 8px 0; }
    .admin-page > h1:first-child { margin: -14px -14px 14px; font-size: 1.05rem; }
    .admin-box { margin: 16px 0; padding: 18px; }
    .admin-box > h3:first-child { margin: -18px -18px 14px; }
    .admin-page .btn, .admin-box .btn { padding-top: .5rem; padding-bottom: .5rem; }   /* easier to hit with a finger */
    .admin-page .btn-sm, .admin-box .btn-sm { padding-top: .35rem; padding-bottom: .35rem; }
    .form-control, .form-select { font-size: 16px; }   /* stops iPhones zooming into a field when it is tapped */
}

/* A Master is using the administration as another user ("sign in as"): a bar that stays in view, with the way back */
.bfa-impersonating { position: sticky; top: 0; z-index: 1040; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem 1rem; padding: .5rem 1rem; background: #f0ad4e; color: #2b1a00; border-bottom: 2px solid #c77c11; }
.bfa-impersonating form { margin: 0; }
