﻿/*
 * bootstrap5-compat.css
 * ---------------------
 * Restores Bootstrap 4.6 defaults that Civica LR relies on after the move to Bootstrap 5.3.
 * Load straight after bootstrap.min.css (see Views/Shared/_Layout.cshtml).
 * Each block can be removed once the views it covers have been updated to native Bootstrap 5 markup.
 */

/* Colours and corner radii used by Bootstrap 4 */
:root {
    --bs-link-color: #007bff;
    --bs-link-color-rgb: 0, 123, 255;
    --bs-link-hover-color: #0056b3;
    --bs-link-hover-color-rgb: 0, 86, 179;
    --bs-border-radius: .25rem;
    --bs-border-radius-sm: .2rem;
    --bs-border-radius-lg: .3rem;
}

/* Links: Bootstrap 5 underlines all links by default; Bootstrap 4 only underlined on hover */
a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Typography: Bootstrap 5 uses responsive heading sizes and a larger <small> */
h1, .h1 { font-size: 2.5rem; }
h2, .h2 { font-size: 2rem; }
h3, .h3 { font-size: 1.75rem; }
h4, .h4 { font-size: 1.5rem; }
h5, .h5 { font-size: 1.25rem; }
h6, .h6 { font-size: 1rem; }

small, .small {
    font-size: 80%;
}

/* Labels: Bootstrap 5 removed the default bottom margin */
label {
    margin-bottom: .5rem;
}

/* Read-only inputs: Bootstrap 5 no longer greys these out */
.form-control[readonly] {
    background-color: #e9ecef;
    opacity: 1;
}

/* Grid: Bootstrap 4 used 30px gutters (Bootstrap 5 uses 24px) */
.container, .container-fluid, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl,
.row {
    --bs-gutter-x: 30px;
}

/* Grid: Bootstrap 5 makes every direct child of .row full width with gutter padding (.row > *).
   In Bootstrap 4 only .col-* elements were sized, so put non-column children back to normal flex items.
   :where() keeps these at the same specificity as Bootstrap's own .row > * rule, so Bootstrap
   components (.form-control, .btn) and the restore rules below still win. */
.row > :where(:not([class^="col-"]):not([class*=" col-"]):not(.col)) {
    flex-shrink: 1;
    max-width: none;
}

.row > :where(:not([class^="col-"]):not([class*=" col-"]):not(.col):not(.form-control):not(.form-select)) {
    width: auto;
}

.row > :where(:not([class^="col-"]):not([class*=" col-"]):not(.col):not(.form-control):not(.form-select):not(.btn)) {
    padding-right: 0;
    padding-left: 0;
}

/* Restore Site.css widths/padding on non-column children of .row that the rules above would override */
.row > .heading:where(:not([class^="col-"]):not([class*=" col-"])) { width: 100%; }
.row > .link-list:where(:not([class^="col-"]):not([class*=" col-"])) { width: 24px; }
.row > .add-padding-left:where(:not([class^="col-"]):not([class*=" col-"])) { padding-left: 10px; }
.row > .add-padding-right:where(:not([class^="col-"]):not([class*=" col-"])) { padding-right: 2px; }
.row > .border-with-name-alt:where(:not([class^="col-"]):not([class*=" col-"])) { padding-left: 5px; padding-right: 5px; }

/* Columns that are not inside a .row (e.g. the button bars on Batch Posting): Bootstrap 4 gave every .col-* 15px of
   padding; Bootstrap 5 only pads columns that are children of a .row, so their contents lost their indent. */
:not(.row) > :is([class^="col-"], [class*=" col-"]) {
    padding-right: 15px;
    padding-left: 15px;
}

/* Elements that are both a row and a column (e.g. <div class="row col-md-12"> on Batch Posting and Requisitions):
   with the padding above, the -15px margins of the rows inside them cancel out again, so their grids and buttons no
   longer sit off the left of the screen. width: auto lets the row's own negative margins stretch it to the same
   width as the page heading bar (a column's width: 100% stopped it short on the right). */
:not(.row) > .row:is([class^="col-"], [class*=" col-"]) {
    width: auto;
}

/* Restore Site.css top margins on any child of .row (Bootstrap 5 sets margin-top on .row > *) */
.row > .add-margin-top,
.row > .checkDebtAction { margin-top: 10px; }
.row > .small-margin-top { margin-top: 1px; }

/* Modal header: Bootstrap 5 centres items vertically; Bootstrap 4 aligned them to the top */
.modal-header {
    align-items: flex-start;
}

/* Modal close button: .close was removed in Bootstrap 5 (replaced by .btn-close).
   The views still use <button class="close">&times;</button>, so keep the Bootstrap 4 styling. */
.close {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
}

.close:hover {
    color: #000;
    text-decoration: none;
}

.close:not(:disabled):not(.disabled):hover,
.close:not(:disabled):not(.disabled):focus {
    opacity: .75;
}

button.close {
    padding: 0;
    background-color: transparent;
    border: 0;
}

.modal-header .close {
    padding: 1rem 1rem;
    margin: -1rem -1rem -1rem auto;
}
