/*
 * Bootstrap 3 → Bootstrap 5 Compatibility Layer
 * 
 * This file restores spacing and layout defaults that existed in Bootstrap 3
 * but were changed or removed in Bootstrap 5, ensuring the existing .aspx
 * pages render correctly without individual page modifications.
 */

/* ============================================================
 * 1. RESTORE BODY/CONTAINER SPACING
 * BS3 had larger default container padding; BS5 tightened it.
 * ============================================================ */
body {
    font-size: 14px;       /* BS3 default was 14px, BS5 uses 1rem (16px) */
    line-height: 1.42857;  /* BS3 default line-height */
}

/* ============================================================
 * 2. ROW SPACING
 * In BS3, rows provided visual separation. In BS5, rows are
 * tighter. Add vertical margin to rows for breathing room.
 * ============================================================ */
.row {
    margin-bottom: 10px;
}

/* ============================================================
 * 3. FORM CONTROLS
 * BS3 form-control had more padding/margin. Restore some of
 * that spacing.
 * ============================================================ */
.form-control {
    margin-bottom: 8px;
    padding: 6px 12px;         /* BS3 default padding */
    height: 34px;              /* BS3 default height */
    font-size: 14px;
    line-height: 1.42857;
    border-radius: 4px;
}

textarea.form-control {
    height: auto;
}

/* ============================================================
 * 4. BUTTONS
 * BS3 buttons had slightly different sizing/padding.
 * ============================================================ */
.btn {
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857;
    border-radius: 4px;
}

.btn-lg {
    padding: 10px 16px;
    font-size: 18px;
    border-radius: 6px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 3px;
}

.btn-xs {
    padding: 1px 5px;
    font-size: 12px;
    border-radius: 3px;
}

/* ============================================================
 * 5. ALERTS
 * BS3 alerts had slightly more padding and margin-bottom.
 * ============================================================ */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

/* ============================================================
 * 6. TABLES
 * BS3 tables had more cell padding by default.
 * ============================================================ */
.table > thead > tr > th,
.table > thead > tr > td,
.table > tbody > tr > th,
.table > tbody > tr > td,
.table > tfoot > tr > th,
.table > tfoot > tr > td {
    padding: 8px;
    line-height: 1.42857;
    vertical-align: top;
}

/* ============================================================
 * 7. LABELS / BADGES
 * BS3 used .label class; BS5 renamed it to .badge.
 * Restore .label styling for backward compat.
 * ============================================================ */
.label {
    display: inline;
    padding: .2em .6em .3em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25em;
}

.label-default { background-color: #777; }
.label-primary { background-color: #337ab7; }
.label-success { background-color: #5cb85c; }
.label-info    { background-color: #5bc0de; }
.label-warning { background-color: #f0ad4e; }
.label-danger  { background-color: #d9534f; }

/* ============================================================
 * 8. PANELS → CARDS compatibility
 * BS3 had .panel, BS5 uses .card. Keep .panel working.
 * ============================================================ */
.panel {
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,.05);
}

.panel-heading {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    border-radius: 3px 3px 0 0;
}

.panel-body {
    padding: 15px;
}

.panel-footer {
    padding: 10px 15px;
    border-top: 1px solid #ddd;
    border-radius: 0 0 3px 3px;
    background-color: #f5f5f5;
}

.panel-default > .panel-heading { background-color: #f5f5f5; }
.panel-primary > .panel-heading { background-color: #337ab7; color: #fff; border-color: #337ab7; }
.panel-success > .panel-heading { background-color: #dff0d8; border-color: #d6e9c6; }
.panel-info > .panel-heading    { background-color: #d9edf7; border-color: #bce8f1; }
.panel-warning > .panel-heading { background-color: #fcf8e3; border-color: #faebcc; }
.panel-danger > .panel-heading  { background-color: #f2dede; border-color: #ebccd1; }

/* ============================================================
 * 9. WELL (removed in BS5)
 * ============================================================ */
.well {
    min-height: 20px;
    padding: 19px;
    margin-bottom: 20px;
    background-color: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0,0,0,.05);
}

/* ============================================================
 * 10. HEADINGS - restore BS3 margin
 * ============================================================ */
h1, h2, h3, h4, h5, h6 {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ============================================================
 * 11. PARAGRAPHS - restore BS3 margin
 * ============================================================ */
p {
    margin: 0 0 10px;
}

/* ============================================================
 * 12. GRID COLUMN SPACING
 * BS3 used 15px padding on each side of columns. BS5 uses
 * gutter variables. Ensure consistent padding.
 * ============================================================ */
.row > [class*="col-"] {
    padding-right: 15px;
    padding-left: 15px;
}

/* ============================================================
 * 13. CONTAINER PADDING
 * BS3 .container had 15px L/R padding by default
 * ============================================================ */
.container {
    padding-right: 15px;
    padding-left: 15px;
}

/* ============================================================
 * 14. BS3 col-xs-* backward compatibility
 * Map col-xs-* to default col-* behavior (already default in
 * BS5, but if any stray col-xs- classes remain in sub-pages)
 * ============================================================ */
.col-xs-1  { flex: 0 0 auto; width: 8.33333%; }
.col-xs-2  { flex: 0 0 auto; width: 16.66667%; }
.col-xs-3  { flex: 0 0 auto; width: 25%; }
.col-xs-4  { flex: 0 0 auto; width: 33.33333%; }
.col-xs-5  { flex: 0 0 auto; width: 41.66667%; }
.col-xs-6  { flex: 0 0 auto; width: 50%; }
.col-xs-7  { flex: 0 0 auto; width: 58.33333%; }
.col-xs-8  { flex: 0 0 auto; width: 66.66667%; }
.col-xs-9  { flex: 0 0 auto; width: 75%; }
.col-xs-10 { flex: 0 0 auto; width: 83.33333%; }
.col-xs-11 { flex: 0 0 auto; width: 91.66667%; }
.col-xs-12 { flex: 0 0 auto; width: 100%; }

/* ============================================================
 * 15. GLYPHICONS backward compatibility
 * Map the most commonly used glyphicons to FontAwesome 5
 * (FontAwesome is already loaded globally). This allows any
 * remaining glyphicon references in sub-pages to show icons.
 * ============================================================ */
.glyphicon {
    font-family: "Font Awesome 5 Free" !important;
    font-weight: 900;
    font-style: normal;
    display: inline-block;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.glyphicon-search::before      { content: "\f002"; }
.glyphicon-plus::before        { content: "\f067"; }
.glyphicon-minus::before       { content: "\f068"; }
.glyphicon-ok::before          { content: "\f00c"; }
.glyphicon-remove::before      { content: "\f00d"; }
.glyphicon-pencil::before      { content: "\f303"; }
.glyphicon-trash::before       { content: "\f2ed"; }
.glyphicon-download::before    { content: "\f019"; }
.glyphicon-upload::before      { content: "\f093"; }
.glyphicon-refresh::before     { content: "\f021"; }
.glyphicon-home::before        { content: "\f015"; }
.glyphicon-user::before        { content: "\f007"; }
.glyphicon-cog::before         { content: "\f013"; }
.glyphicon-envelope::before    { content: "\f0e0"; }
.glyphicon-star::before        { content: "\f005"; }
.glyphicon-star-empty::before  { content: "\f005"; font-weight: 400; }
.glyphicon-chevron-left::before  { content: "\f053"; }
.glyphicon-chevron-right::before { content: "\f054"; }
.glyphicon-chevron-up::before    { content: "\f077"; }
.glyphicon-chevron-down::before  { content: "\f078"; }
.glyphicon-arrow-left::before    { content: "\f060"; }
.glyphicon-arrow-right::before   { content: "\f061"; }
.glyphicon-arrow-up::before      { content: "\f062"; }
.glyphicon-arrow-down::before    { content: "\f063"; }
.glyphicon-calendar::before      { content: "\f073"; }
.glyphicon-lock::before          { content: "\f023"; }
.glyphicon-save::before          { content: "\f0c7"; }
.glyphicon-file::before          { content: "\f15b"; }
.glyphicon-print::before         { content: "\f02f"; }
.glyphicon-list::before          { content: "\f03a"; }
.glyphicon-check::before         { content: "\f00c"; }
.glyphicon-warning-sign::before  { content: "\f071"; }
.glyphicon-info-sign::before     { content: "\f05a"; }
.glyphicon-exclamation-sign::before { content: "\f06a"; }
.glyphicon-eye-open::before      { content: "\f06e"; }
.glyphicon-eye-close::before     { content: "\f070"; }
.glyphicon-ban-circle::before    { content: "\f05e"; }
.glyphicon-th::before            { content: "\f00a"; }
.glyphicon-th-list::before       { content: "\f00b"; }

/* ============================================================
 * 16. data-dismiss → data-bs-dismiss compatibility
 * BS3 used data-dismiss, BS5 uses data-bs-dismiss. 
 * This CSS doesn't fix the JS behavior but keeps visual 
 * styles consistent. If you have dismiss buttons,
 * update them to data-bs-dismiss in HTML.
 * ============================================================ */

/* ============================================================
 * 17. MISC SPACING FIXES
 * ============================================================ */

/* Add spacing between adjacent rows like BS3 provided */
.row + .row {
    margin-top: 5px;
}

/* BS3's &nbsp; spacer rows - ensure they provide real space */
.row:empty,
.row:blank {
    min-height: 20px;
}
