/*
 * Map app shell additions, on top of Bootstrap 5.3 (public/vendor/bootstrap-5.3.9, linked first by
 * templates/mp/_head_libs.html.twig). public/mp/css/app.css is Laravel's built stylesheet with its embedded Bootstrap 4
 * removed and is otherwise left as built; everything the Symfony port adds lives here.
 *
 * 0. Brand: Bootstrap 5's colour variables set to the app's colours, and the Bootstrap 4 variables app.css still reads.
 * 1. The header's Account dropdown (Laravel had a plain link there).
 * 2. Page furniture for the shell's own pages (page header, narrow form cards), then bare-element styling inside
 *    `.mp-content`, so pages of bundles that know nothing about this shell (plain h1/form/label/input/button/table markup)
 *    still look like the app.
 * 3. Semantic button colours, through Bootstrap 5's own --bs-btn-* variables.
 */

/* ---- 0. brand ----------------------------------------------------------------------------------------------------- */
:root {
    /* Laravel's Bootstrap 4 build: 0.9rem / 1.6 body text. */
    --bs-body-font-size: .9rem;
    --bs-body-line-height: 1.6;

    /* The theme blue, and white-text-safe shades for the status colours (badges .text-bg-*, .text-*, .bg-*). Warning and
       info keep Bootstrap's light shades: their .text-bg-* draw dark text on them. */
    --bs-primary: #4263eb;
    --bs-primary-rgb: 66, 99, 235;
    --bs-success: #2b8a3e;
    --bs-success-rgb: 43, 138, 62;
    --bs-danger: #d63939;
    --bs-danger-rgb: 214, 57, 57;
    --bs-secondary: #64748b;
    --bs-secondary-rgb: 100, 116, 139;
    --bs-link-color: #4263eb;
    --bs-link-color-rgb: 66, 99, 235;
    --bs-link-hover-color: #3451d1;
    --bs-link-hover-color-rgb: 52, 81, 209;
    --bs-focus-ring-color: rgba(66, 99, 235, .25);

    /* Bootstrap 4's names, still read by app.css (the header's Account / Upgrade links). */
    --primary: #4263eb;
    --success: #0ed58d;
    --danger: #e3342f;
}

/* Bootstrap 4 underlined links only on hover; Bootstrap 5 always does. Keep the old look for plain links. */
a { text-decoration: none; }
a:not([class]):hover { text-decoration: underline; }

/* app.css sizes .form-control to its compact .75rem; a .form-select beside it matches. */
.form-select { font-size: .75rem; line-height: 1.4; }
.form-select:focus, .form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(66, 99, 235, .15); }
.form-check-input:checked { background-color: #4263eb; border-color: #4263eb; }

/* ---- 1. header: Account dropdown -------------------------------------------------------------------------------- */
header .header-item ul.auth-menu { align-items: center; display: flex; list-style: none; margin: 0; padding: 0; }
header .header-item ul.auth-menu .nav-item.dropdown .dropdown-toggle::after { margin-left: .5em; }
header .header-item ul.auth-menu .dropdown-menu { margin-top: 6px; min-width: 14rem; }
header .header-item ul.auth-menu .dropdown-menu a.dropdown-item {
    background: transparent;
    border: 0;
    border-radius: 0;
    color: #212529;
    font-size: .85rem;
    font-weight: 400;
    padding: .4rem 1.25rem;
}
header .header-item ul.auth-menu .dropdown-menu a.dropdown-item:hover,
header .header-item ul.auth-menu .dropdown-menu a.dropdown-item.active { background: rgba(66, 99, 235, .1); color: #4263eb; }
header .header-item ul.auth-menu .dropdown-menu .dropdown-item-text { font-size: .8rem; }

/* ---- 2. page furniture and bare elements inside the shell --------------------------------------------------------- */
/* Laravel's own rules pad <main>; the boilerplate pages (no containers of their own) sit in .mp-page for a gutter. */
.mp-page { padding: 0 45px; }
.blank .mp-page { padding: 0; }
@media (max-width: 767px) { .mp-page { padding: 0 16px; } }

.mp-content > h1, .mp-content:not(.mp-native) h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 1rem; }

/* Page header: the title on the left, the page's actions on the right. */
.mp-page-header { align-items: center; display: flex; flex-wrap: wrap; gap: .75rem 1rem; justify-content: space-between; margin-bottom: 1.25rem; }
.mp-content .mp-page-header h1 { margin: 0; }
.mp-page-header form { margin: 0; }
/* A form card does not need the full width of a wide screen. */
.mp-card-narrow { max-width: 720px; }
.mp-content .card > .table-responsive > .table > :last-child > tr:last-child > * { border-bottom-width: 0; }
.mp-content .card-header, .mp-content .card-header :is(h2, h3, h4, h5) { font-weight: 700; }
/* The list screens' table card (.dstore-body): DataTables' own controls sit inside it. */
.mp-content .dstore-body.card { padding: 1rem 1.25rem; }

.bold-box h1 { color: #000; font-size: 28px; font-weight: 900; line-height: 32px; margin-bottom: 20px; }
.bold-box h2 { margin-top: 0; }
.bold-box { text-align: left; }
.bold-box h1, .bold-box h2:first-child { text-align: center; }
.bold-box .btn-link, .bold-box > p, .bold-box form + p { text-align: center; }
.bold-box p { margin-top: 12px; }

.mp-content:not(.mp-native) label:not([class]) { display: inline-block; margin-bottom: .5rem; }
.mp-content:not(.mp-native) form > div:not(.form-group):not([class*="mb-"]), .mp-content .form-field { margin-bottom: 15px; }
.mp-content:not(.mp-native) input[type=text]:not(.form-control), .mp-content:not(.mp-native) input[type=email]:not(.form-control),
.mp-content:not(.mp-native) input[type=password]:not(.form-control), .mp-content:not(.mp-native) input[type=number]:not(.form-control),
.mp-content:not(.mp-native) input[type=url]:not(.form-control), .mp-content:not(.mp-native) input[type=search]:not(.form-control),
.mp-content:not(.mp-native) select:not(.form-control):not(.form-select), .mp-content:not(.mp-native) textarea:not(.form-control) {
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    color: #495057;
    display: block;
    font-size: .875rem;
    height: calc(1.6em + .75rem + 2px);
    padding: .375rem .75rem;
    width: 100%;
}
.mp-content:not(.mp-native) textarea:not(.form-control) { height: auto; }
.mp-content:not(.mp-native) input:not(.form-control):not(.form-check-input):focus, .mp-content:not(.mp-native) select:not(.form-control):not(.form-select):focus, .mp-content:not(.mp-native) textarea:not(.form-control):focus {
    border-color: #a1aff5;
    box-shadow: 0 0 0 .2rem rgba(66, 99, 235, .15);
    outline: 0;
}
.mp-content:not(.mp-native) input[type=checkbox]:not(.form-check-input), .mp-content:not(.mp-native) input[type=radio]:not(.form-check-input) { margin-right: .4rem; }
.mp-content .checkbox-row, .mp-content .form-field label[for]:not(.form-check-label) { margin-bottom: 0; }

/* A bare submit is the page's primary action: drawn as .btn.btn-primary. */
.mp-content:not(.mp-native) button[type=submit]:not(.btn), .mp-content:not(.mp-native) button:not([type]):not(.btn) {
    background: #4263eb;
    border: 1px solid #4263eb;
    border-radius: var(--bs-border-radius);
    color: #fff;
    cursor: pointer;
    font-size: .875rem;
    font-weight: 700;
    line-height: 1.5;
    padding: .375rem .75rem;
}
.mp-content:not(.mp-native) button[type=submit]:not(.btn):hover { background: #3451d1; border-color: #3451d1; }
.bold-box form > button[type=submit] { width: 100%; }
.mp-content:not(.mp-native) form[style*="inline"] button, .mp-content:not(.mp-native) form.d-inline button { width: auto; }

/* Bare tables only; a .table is Bootstrap's. */
.mp-content:not(.mp-native) table:not(.table) { background: #fff; border-collapse: collapse; margin: 1rem 0; width: 100%; }
.mp-content:not(.mp-native) table:not(.table) th, .mp-content:not(.mp-native) table:not(.table) td { border-top: 1px solid #dee2e6; padding: .6rem .75rem; text-align: left; vertical-align: top; }
.mp-content:not(.mp-native) table:not(.table) thead th { border-bottom: 2px solid #dee2e6; border-top: 0; }

/* Messages written without Bootstrap's .alert (bundle pages, layout/_flashes.html.twig): drawn like one. A field error
   is an inline line under its field. */
.mp-content .error, .mp-content .alert-error, .mp-content .field-error { color: #721c24; }
.mp-content :is(.error, .alert-error, .success, .flash-success, .flash-error, .flash-info, .flash-warning):not(.alert):not(.field-error) {
    border: 1px solid transparent;
    border-radius: var(--bs-border-radius);
    margin-bottom: 1rem;
    padding: .75rem 1.25rem;
    text-align: left;
}
.mp-content :is(.error, .alert-error, .flash-error):not(.alert):not(.field-error) { background: #f8d7da; border-color: #f5c6cb; }
.mp-content :is(.success, .flash-success):not(.alert) { background: #d4edda; border-color: #c3e6cb; color: #155724; }
.mp-content .flash-info:not(.alert) { background: #d1ecf1; border-color: #bee5eb; color: #0c5460; }
.mp-content .flash-warning:not(.alert) { background: #fff3cd; border-color: #ffeeba; color: #856404; }
.mp-content .field-error { display: block; font-size: .8rem; margin-top: .25rem; }

.mp-content:not(.mp-native) code, .mp-content:not(.mp-native) pre { font-size: 87.5%; }
.mp-impersonation { border-radius: 0; }

/* DataTables builds its own unclassed <select> and <input>; Laravel left them as the browser draws them, so the generic form look above must not reach them. */
.mp-content .dataTables_wrapper select:not(.form-select):not(.form-control), .mp-content .dataTables_wrapper input:not(.form-check-input):not(.form-control) {
    background: initial; border: 1px solid #767676; border-radius: 0; color: inherit; display: inline-block; font-size: inherit; height: auto; padding: 0; width: auto;
}
.mp-content .dataTables_wrapper select:not(.form-select):not(.form-control):focus, .mp-content .dataTables_wrapper input:not(.form-check-input):not(.form-control):focus { border-color: #767676; box-shadow: none; outline: revert; }
.mp-content .location_permission.form-select { padding-right: 2rem; }
/* DataTables' own stylesheet draws borders under the head and around rows; Bootstrap's .table already does. */
.mp-content table.dataTable.table { border-collapse: collapse; }
.mp-content table.dataTable.table.no-footer { border-bottom: 0; }
.mp-content table.dataTable.table > :not(caption) > * > * { border-color: var(--bs-border-color); }
.mp-content table.dataTable.table thead th, .mp-content table.dataTable.table thead td { border-bottom: 1px solid var(--bs-border-color); }

/* ---- 3. semantic button colours --------------------------------------------------------------------------------- */
/* Every action button is a solid colour by what it does, with white text: .btn-primary (save / submit, the theme's
   blue), .btn-success (create / add), .btn-danger (delete / remove / revoke / disconnect), .btn-warning (block /
   reset, a dark amber so white text reads), .btn-secondary (cancel / close / back / ignore), .btn-info (test / preview /
   share, a dark teal). Outline variants of these are drawn solid too (buttons built by JS still use
   btn-outline-danger); the segmented radio labels (.btn-check + .btn-outline-primary) are not touched. Shades meet
   WCAG AA for white text (>= 4.5:1, the danger red ~4.4). The auth card (auth.css) keeps its own single blue button.
   .btn-link stays a link. Only Bootstrap 5's own --bs-btn-* variables are set: its .btn rules do the drawing. */
.btn-primary                         { --mp-btn: #4263eb; --mp-btn-hover: #3451d1; --mp-btn-ring: 66, 99, 235; }
.btn-success                         { --mp-btn: #2b8a3e; --mp-btn-hover: #23712f; --mp-btn-ring: 43, 138, 62; }
.btn-danger, .btn-outline-danger     { --mp-btn: #d63939; --mp-btn-hover: #b52d2d; --mp-btn-ring: 214, 57, 57; }
.btn-warning                         { --mp-btn: #b45309; --mp-btn-hover: #92400e; --mp-btn-ring: 180, 83, 9; }
.btn-secondary, .btn-outline-secondary, .btn-outline-dark
                                     { --mp-btn: #64748b; --mp-btn-hover: #475569; --mp-btn-ring: 100, 116, 139; }
.btn-info                            { --mp-btn: #0e7c86; --mp-btn-hover: #0b6570; --mp-btn-ring: 14, 124, 134; }

.btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info, .btn-outline-danger, .btn-outline-secondary, .btn-outline-dark) {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--mp-btn);
    --bs-btn-border-color: var(--mp-btn);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--mp-btn-hover);
    --bs-btn-hover-border-color: var(--mp-btn-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--mp-btn-hover);
    --bs-btn-active-border-color: var(--mp-btn-hover);
    --bs-btn-disabled-color: #fff;
    --bs-btn-disabled-bg: var(--mp-btn);
    --bs-btn-disabled-border-color: var(--mp-btn);
    --bs-btn-disabled-opacity: .55;
    --bs-btn-focus-shadow-rgb: var(--mp-btn-ring);
    background-image: none;
}
.btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info, .btn-outline-danger, .btn-outline-secondary, .btn-outline-dark):is(:disabled, .disabled, [aria-disabled="true"]) { cursor: not-allowed; }

/* Icon-only buttons in list tables draw their icon grey (app.css); on a coloured button it is white. */
.mp_data_table .action .btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info) i,
.dataTables_wrapper .dt-button.btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info) i,
.mp_data_table .action .btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info):hover i,
.dataTables_wrapper .dt-button.btn:is(.btn-primary, .btn-success, .btn-danger, .btn-warning, .btn-secondary, .btn-info):hover i { color: #fff; font-size: 14px; }
.mp_data_table .action .btn + .btn, .mp_data_table .action .btn + form, .mp_data_table .action form + .btn { margin-left: .25rem; }
