/* ==========================================================================
   RBU DDE - Bootstrap 3 -> Bootstrap 5.3 compatibility layer
   --------------------------------------------------------------------------
   The Razor views and scripts were written for Bootstrap 3.3.7 +
   Inspinia 2.7.1. This file re-creates the Bootstrap 3 class names that
   Bootstrap 5 removed or renamed, so view markup does not have to change.
   Colours come from the --rbu-* tokens in rbu-theme.css.

   Load order (see App_Start/BundleConfig.cs):
     ~/Content/bootstrap5  ->  ~/Content/rbu-compat (this file)  ->
     ~/Content/css (Inspinia style.css ...)  ->  ...  ->  ~/Content/rbu-theme
   ========================================================================== */

/* ---------- Base ---------------------------------------------------------- */
a { text-decoration: none; }
a:hover, a:focus { text-decoration: none; }
label { display: inline-block; max-width: 100%; margin-bottom: 5px; font-weight: 600; }
legend { float: none; width: 100%; padding: 0; margin-bottom: 15px; font-size: 17px; line-height: inherit; border-bottom: 1px solid var(--rbu-border, #e5e5e5); }
.hidden, .hide { display: none !important; }
.pull-right { float: right !important; }
.pull-left { float: left !important; }
.center-block { display: block; margin-left: auto; margin-right: auto; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-justify { text-align: justify !important; }
.img-responsive { display: block; max-width: 100%; height: auto; }
.img-circle { border-radius: 50% !important; }
.img-rounded { border-radius: 8px !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.caret { display: inline-block; width: 0; height: 0; margin-left: 2px; vertical-align: middle; border-top: 4px dashed; border-right: 4px solid transparent; border-left: 4px solid transparent; }
.page-header { padding-bottom: 9px; margin: 30px 0 20px; border-bottom: 1px solid var(--rbu-border, #eee); }
.list-inline { padding-left: 0; list-style: none; }
.list-inline > li { display: inline-block; padding: 0 5px; }
.clearfix::after, .panel-body::after, .form-group::after, .modal-footer::after { display: block; clear: both; content: ""; }

/* Bootstrap 3 state classes that markup and plugins still use */
.fade.in { opacity: 1; }
.collapse.in { display: block; }
tr.collapse.in { display: table-row; }
tbody.collapse.in { display: table-row-group; }
.modal.in .modal-dialog { transform: none; }
.modal-backdrop.in { opacity: .5; }
.open > .dropdown-menu { display: block; }

/* ---------- Grid ----------------------------------------------------------- */
/* Bootstrap 3 columns were position: relative; views place absolutely
   positioned buttons inside them (e.g. #btnClear with margin-left: 31%). */
[class*="col-xs-"], [class*="col-sm-"], [class*="col-md-"], [class*="col-lg-"] { position: relative; min-height: 1px; }
/* Bootstrap 5 makes every direct child of .row full width; inline content that
   Bootstrap 3 let flow side by side keeps its natural width. */
.row > :is(span, label, a, b, strong, small, i, img, button, input, select):not([class*="col-"]) { width: auto; }

.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6,
.col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { flex: 0 0 auto; }
.col-xs-1 { width: 8.33333333%; }  .col-xs-2 { width: 16.66666667%; }
.col-xs-3 { width: 25%; }          .col-xs-4 { width: 33.33333333%; }
.col-xs-5 { width: 41.66666667%; } .col-xs-6 { width: 50%; }
.col-xs-7 { width: 58.33333333%; } .col-xs-8 { width: 66.66666667%; }
.col-xs-9 { width: 75%; }          .col-xs-10 { width: 83.33333333%; }
.col-xs-11 { width: 91.66666667%; } .col-xs-12 { width: 100%; }

.col-xs-offset-0 { margin-left: 0; }            .col-xs-offset-1 { margin-left: 8.33333333%; }
.col-xs-offset-2 { margin-left: 16.66666667%; } .col-xs-offset-3 { margin-left: 25%; }
.col-xs-offset-4 { margin-left: 33.33333333%; } .col-xs-offset-5 { margin-left: 41.66666667%; }
.col-xs-offset-6 { margin-left: 50%; }
@media (min-width: 576px) {
  .col-sm-offset-0 { margin-left: 0; }            .col-sm-offset-1 { margin-left: 8.33333333%; }
  .col-sm-offset-2 { margin-left: 16.66666667%; } .col-sm-offset-3 { margin-left: 25%; }
  .col-sm-offset-4 { margin-left: 33.33333333%; } .col-sm-offset-5 { margin-left: 41.66666667%; }
  .col-sm-offset-6 { margin-left: 50%; }
}
@media (min-width: 768px) {
  .col-md-offset-0 { margin-left: 0; }            .col-md-offset-1 { margin-left: 8.33333333%; }
  .col-md-offset-2 { margin-left: 16.66666667%; } .col-md-offset-3 { margin-left: 25%; }
  .col-md-offset-4 { margin-left: 33.33333333%; } .col-md-offset-5 { margin-left: 41.66666667%; }
  .col-md-offset-6 { margin-left: 50%; }
}
@media (min-width: 992px) {
  .col-lg-offset-0 { margin-left: 0; }            .col-lg-offset-1 { margin-left: 8.33333333%; }
  .col-lg-offset-2 { margin-left: 16.66666667%; } .col-lg-offset-3 { margin-left: 25%; }
  .col-lg-offset-4 { margin-left: 33.33333333%; } .col-lg-offset-5 { margin-left: 41.66666667%; }
  .col-lg-offset-6 { margin-left: 50%; }
}

/* ---------- Forms ---------------------------------------------------------- */
.form-group { margin-bottom: 15px; }
/* Control and button sizes as in Bootstrap 3. The views' spacing classes
   (mt-20, mt-23, ...) were tuned for these heights, so buttons line up with
   the fields beside them. */
label { line-height: 1.42857; }
.form-control { font-size: 13px; line-height: 1.42857; }
input.form-control:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select.form-control:not([multiple]):not([size]) { height: 34px; padding-top: 6px; padding-bottom: 6px; }
.form-group-sm .form-control, .input-sm,
.form-group-sm input.form-control:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-group-sm select.form-control:not([multiple]):not([size]), select.input-sm, input.input-sm { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; }
.input-group-sm > .form-control, .input-group-sm > input.form-control:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.input-group-sm > select.form-control:not([multiple]):not([size]), .input-group-sm > .input-group-addon { height: 30px; padding: 5px 10px; font-size: 12px; line-height: 1.5; }
textarea.form-control { height: auto; }
/* Bootstrap 5 gives .form-control "appearance: none", which turns a checkbox or
   radio carrying that class into an empty white box. Bootstrap 3 left them native
   and 34px tall, so they sat level with the fields beside them. */
input.form-control:is([type="checkbox"], [type="radio"]) {
    appearance: auto; -webkit-appearance: auto; width: 16px; height: 34px; padding: 0; margin: 0;
    border: 0; background: none; box-shadow: none; accent-color: var(--bs-primary); vertical-align: middle;
}
/* Rows of form fields: columns line up at the bottom, so fields stay level even
   when one label wraps onto two lines, and a column holding only buttons sits
   level with the fields beside it. Rows with textareas, tables or panels are left as they are. */
.row:has(> [class*="col-"] > :is(.form-control, select, .select2-container, .input-group)):not(:has(> [class*="col-"] :is(textarea:not(.select2-search__field), table, .panel, .row, .ibox))) { align-items: flex-end; }
/* In those rows a field wrapped in .form-group would sit 15px higher than a bare
   one (Hostel Capacity), so the group's bottom margin moves to the row. */
.row:has(> [class*="col-"] > :is(.form-control, select, .select2-container, .input-group)):not(:has(> [class*="col-"] :is(textarea:not(.select2-search__field), table, .panel, .row, .ibox))):has(> [class*="col-"] > .form-group:last-child) { margin-bottom: 15px; }
.row:has(> [class*="col-"] > :is(.form-control, select, .select2-container, .input-group)):not(:has(> [class*="col-"] :is(textarea:not(.select2-search__field), table, .panel, .row, .ibox))) > [class*="col-"] > .form-group:last-child { margin-bottom: 0; }
/* A column holding only one or two buttons, spaced with &nbsp; (Admission Verify,
   Fees Collection), keeps them on one line, or the buttons rise above the fields. */
[class*="col-"]:has(> .btn):not(:has(> :not(.btn))):not(:has(> .btn:nth-child(3))) { white-space: nowrap; min-width: max-content; }
/* a small grid inside one labelled field (e.g. a dropdown with an "Add" button beside it):
   centre the two and ignore the button's inline bottom margin */
[class*="col-"]:has(> label) > .row { align-items: center; }
[class*="col-"]:has(> label) > .row > [class*="col-"] > .btn { margin-top: 0 !important; margin-bottom: 0 !important; }
.input-lg { height: 46px; padding: 10px 16px; font-size: 17px; }
.btn { padding: 6px 12px; font-size: 13px; line-height: 1.42857; white-space: nowrap; }
.btn-sm, .btn-group-sm > .btn { padding: 5px 10px; font-size: 12px; line-height: 1.5; }
.btn-lg, .btn-group-lg > .btn { padding: 10px 16px; font-size: 17px; line-height: 1.3333; }
/* Bootstrap 5 shrinks buttons placed directly in .input-group-sm / -lg; views put those
   classes on whole columns, and Bootstrap 3 left such buttons at their normal size */
:is(.input-group-sm, .input-group-lg) > .btn { padding: 6px 12px; font-size: 13px; line-height: 1.42857; }
:is(.input-group-sm, .input-group-lg) > .btn-sm { padding: 5px 10px; font-size: 12px; line-height: 1.5; }
:is(.input-group-sm, .input-group-lg) > .btn-xs { padding: 2px 8px; font-size: 12px; line-height: 1.5; }
.control-label { font-weight: 600; }
.help-block { display: block; margin-top: 5px; margin-bottom: 10px; color: var(--rbu-muted, #737373); font-size: 12px; }
/* Bootstrap 5 removes the native arrow from <select class="form-control">; restore one */
select.form-control:not([multiple]):not([size]) {
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%237a7f99' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 10px;
}
.form-horizontal .form-group { display: flex; flex-wrap: wrap; margin-left: -12px; margin-right: -12px; }
.form-horizontal .form-group > * { padding-left: 12px; padding-right: 12px; }
@media (min-width: 768px) { .form-horizontal .control-label { padding-top: 7px; text-align: right; } }
/* As in Bootstrap 3: .form-inline lines up its fields but does not change the
   container's own layout (DataTables puts this class on its wrapper). */
@media (min-width: 768px) {
  .form-inline .form-group { display: inline-block; margin-bottom: 0; vertical-align: middle; }
  .form-inline .form-control { display: inline-block; width: auto; vertical-align: middle; }
  .form-inline .input-group { display: inline-flex; width: auto; vertical-align: middle; }
  .form-inline .control-label { margin-bottom: 0; vertical-align: middle; }
}
.radio, .checkbox { position: relative; display: block; min-height: 20px; margin-top: 10px; margin-bottom: 10px; }
.radio label, .checkbox label { min-height: 20px; padding-left: 20px; margin-bottom: 0; font-weight: 400; cursor: pointer; }
.radio input[type="radio"], .checkbox input[type="checkbox"] { position: absolute; margin-top: 4px; margin-left: -20px; }
.radio-inline, .checkbox-inline { position: relative; display: inline-block; padding-left: 20px; margin-right: 12px; font-weight: 400; cursor: pointer; }
.radio-inline input[type="radio"], .checkbox-inline input[type="checkbox"] { position: absolute; margin-top: 4px; margin-left: -20px; }
.has-error .form-control { border-color: var(--rbu-danger, #a94442); }
.has-error .help-block, .has-error .control-label { color: var(--rbu-danger, #a94442); }
.has-success .form-control { border-color: var(--rbu-success, #3c763d); }
.input-group-addon {
  display: flex; align-items: center; padding: 6px 12px; font-size: 14px;
  color: var(--rbu-muted, #555); background: var(--rbu-surface-2, #eee);
  border: 1px solid var(--rbu-border, #ccc); border-radius: var(--rbu-radius, 4px); white-space: nowrap;
}
.input-group > .input-group-addon:not(:last-child) { border-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group > .input-group-addon:not(:first-child) { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group-btn { display: flex; }
.input-group-btn > .btn { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ---------- Buttons -------------------------------------------------------- */
.btn-default { color: var(--rbu-text, #333); background-color: var(--rbu-surface, #fff); border-color: var(--rbu-border, #ccc); }
.btn-xs, .btn-group-xs > .btn { padding: 2px 8px; font-size: 12px; line-height: 1.5; border-radius: 6px; }
.btn-block { display: block; width: 100%; }
.btn-block + .btn-block { margin-top: 5px; }
.close {
  float: right; padding: 0; font-size: 22px; font-weight: 700; line-height: 1;
  color: inherit; background: transparent; border: 0; opacity: .7; cursor: pointer;
}
.close:hover { opacity: 1; }

/* ---------- Labels, wells, progress --------------------------------------- */
.label { display: inline-block; padding: .3em .65em; font-size: 75%; font-weight: 600; line-height: 1; color: #fff; text-align: center; white-space: nowrap; vertical-align: baseline; border-radius: 999px; }
.well { min-height: 20px; padding: 19px; margin-bottom: 20px; background: var(--rbu-surface-2, #f5f5f5); border: 1px solid var(--rbu-border, #e3e3e3); border-radius: var(--rbu-radius, 4px); }
.alert-dismissable .close, .alert-dismissible .close { position: relative; top: -2px; right: -8px; color: inherit; }
.progress-bar-success { background-color: var(--rbu-success, #5cb85c); } .progress-bar-info { background-color: var(--rbu-info, #5bc0de); }
.progress-bar-warning { background-color: var(--rbu-warning, #f0ad4e); } .progress-bar-danger { background-color: var(--rbu-danger, #d9534f); }

/* ---------- Panels (204 views) --------------------------------------------- */
.panel { margin-bottom: 20px; background-color: var(--rbu-surface, #fff); border: 1px solid var(--rbu-border, #ddd); border-radius: var(--rbu-radius, 4px); }
.panel-body { padding: 15px; }
.panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-radius: calc(var(--rbu-radius, 4px) - 1px) calc(var(--rbu-radius, 4px) - 1px) 0 0; }
.panel-title { margin: 0; font-size: 15px; color: inherit; }
.panel-title > a { color: inherit; }
.panel-footer { padding: 10px 15px; background: var(--rbu-surface-2, #f5f5f5); border-top: 1px solid var(--rbu-border, #ddd); border-radius: 0 0 var(--rbu-radius, 4px) var(--rbu-radius, 4px); }
.panel-group { margin-bottom: 20px; }
.panel-group .panel { margin-bottom: 8px; }
.panel > .table, .panel > .table-responsive > .table { margin-bottom: 0; }

/* ---------- Tables --------------------------------------------------------- */
.table-condensed > :not(caption) > * > * { padding: 5px 8px; }

/* ---------- Navs, tabs, dropdowns (Bootstrap 3 <li>-based markup) --------- */
.nav > li { position: relative; display: block; }
.nav > li > a { display: block; padding: 10px 15px; }
.nav-stacked { flex-direction: column; }
.nav-tabs > li { margin-bottom: -1px; }
.nav-tabs > li > a { border: 1px solid transparent; border-radius: 6px 6px 0 0; }
.dropdown-menu > li > a { display: block; padding: 7px 16px; clear: both; font-weight: 400; color: var(--rbu-text, #333); white-space: nowrap; }
.dropdown-menu .divider { height: 1px; margin: 6px 0; overflow: hidden; background: var(--rbu-border, #e5e5e5); }
.dropdown-menu.pull-right, .dropdown-menu-right { right: 0; left: auto; }
.dropdown-toggle::after { display: none; } /* Bootstrap 3 markup brings its own .caret */

/* ---------- Pagination (DataTables Bootstrap 3 renderer) ------------------- */
.pagination > li > a, .pagination > li > span {
  position: relative; display: block; padding: 5px 11px; margin-left: 4px;
  color: var(--rbu-text, #337ab7); background: var(--rbu-surface, #fff); border: 1px solid var(--rbu-border, #ddd); border-radius: var(--rbu-pill, 4px);
}
.pagination > .disabled > a, .pagination > .disabled > span { opacity: .5; pointer-events: none; }

/* ---------- Modals (Bootstrap 3 header: close button before the title) ---- */
.modal-header .close { order: 2; margin-left: auto; }
.modal-header .modal-title { order: 1; }
.modal-footer { display: block; text-align: right; }
.modal-footer > .btn + .btn { margin-left: 5px; }
