/**
 * BS3→BS4 Visual Compatibility Overrides for Frontend
 * Purpose: Allow BS4.6.2 CSS to be loaded while BS3-only classes still exist in views
 * Scope: frontend module (customer-facing payment forms)
 * 
 * This file provides backward-compatible aliases so existing BS3 class names
 * continue to work after switching to BS4 CSS. Classes should be migrated to
 * proper BS4 equivalents over time, then this file can be removed.
 */

/* ============================================
   BASE FONT SIZE PIN (BS3 = 14px, BS4 = 16px)
   ============================================ */
html {
  font-size: 14px;
}
body {
  font-size: 14px;
  line-height: 1.42857143;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #333;
}

/* Headings: BS3 used fixed px values, BS4 uses rem (which shifts at 14px base) */
h1, .h1 { font-size: 36px; }
h2, .h2 { font-size: 30px; }
h3, .h3 { font-size: 24px; }
h4, .h4 { font-size: 18px; }
h5, .h5 { font-size: 14px; }
h6, .h6 { font-size: 12px; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: inherit;
  font-weight: 500;
  line-height: 1.1;
  color: inherit;
  margin-top: 10px;
  margin-bottom: 10px;
}

/* ============================================
   GRID: col-xs-* → col-* (BS4 dropped xs prefix)
   ============================================ */
.col-xs-1 { flex: 0 0 8.333333%; max-width: 8.333333%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-2 { flex: 0 0 16.666667%; max-width: 16.666667%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-3 { flex: 0 0 25%; max-width: 25%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-4 { flex: 0 0 33.333333%; max-width: 33.333333%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-5 { flex: 0 0 41.666667%; max-width: 41.666667%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-6 { flex: 0 0 50%; max-width: 50%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-7 { flex: 0 0 58.333333%; max-width: 58.333333%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-8 { flex: 0 0 66.666667%; max-width: 66.666667%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-9 { flex: 0 0 75%; max-width: 75%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-10 { flex: 0 0 83.333333%; max-width: 83.333333%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-11 { flex: 0 0 91.666667%; max-width: 91.666667%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }
.col-xs-12 { flex: 0 0 100%; max-width: 100%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }

/* col-*-offset-N → offset-*-N */
.col-xs-offset-1 { margin-left: 8.333333%; }
.col-xs-offset-2 { margin-left: 16.666667%; }
.col-xs-offset-3 { margin-left: 25%; }
.col-xs-offset-4 { margin-left: 33.333333%; }
.col-xs-offset-6 { margin-left: 50%; }
.col-sm-offset-1 { margin-left: 8.333333%; }
.col-sm-offset-2 { margin-left: 16.666667%; }
.col-sm-offset-3 { margin-left: 25%; }
.col-sm-offset-4 { margin-left: 33.333333%; }
.col-md-offset-1 { margin-left: 8.333333%; }
.col-md-offset-2 { margin-left: 16.666667%; }
.col-md-offset-3 { margin-left: 25%; }
.col-md-offset-4 { margin-left: 33.333333%; }
.col-lg-offset-1 { margin-left: 8.333333%; }
.col-lg-offset-2 { margin-left: 16.666667%; }
.col-lg-offset-3 { margin-left: 25%; }

/* ============================================
   INPUT GROUP: input-group-addon → input-group-text
   ============================================ */
.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #495057;
  text-align: center;
  white-space: nowrap;
  background-color: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
}
.input-group > .input-group-addon:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}
.input-group > .input-group-addon:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 0;
}
.input-group > .input-group-addon + .form-control {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.input-group > .form-control + .input-group-addon {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* ============================================
   BUTTONS
   ============================================ */
/* btn base: match BS3 padding (6px 12px) and font-size (14px) */
.btn {
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857143;
  border-radius: 4px;
}

/* btn-default (removed in BS4) */
.btn-default {
  color: #333;
  background-color: #fff;
  border-color: #ccc;
}
.btn-default:hover, .btn-default:focus {
  color: #333;
  background-color: #e6e6e6;
  border-color: #adadad;
}

/* btn-primary: match BS3 blue */
.btn-primary {
  background-color: #337ab7;
  border-color: #2e6da4;
}
.btn-primary:hover, .btn-primary:focus {
  background-color: #286090;
  border-color: #204d74;
}

/* btn-xs (removed in BS4, map to btn-sm size) */
.btn-xs {
  padding: 1px 5px;
  font-size: 12px;
  line-height: 1.5;
  border-radius: 3px;
}

/* ============================================
   LABELS → BADGES
   ============================================ */
.label {
  display: inline;
  padding: 0.2em 0.6em 0.3em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 0.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; color: #333; }
.label-danger { background-color: #d9534f; }

/* ============================================
   UTILITIES
   ============================================ */
/* pull-left / pull-right (BS4 uses float-left/float-right) */
.pull-left { float: left !important; }
.pull-right { float: right !important; }

/* hidden (BS4 uses d-none) */
.hidden { display: none !important; }

/* ============================================
   FORMS
   ============================================ */
/* form-group: BS3 margin-bottom was 15px */
.form-group {
  margin-bottom: 15px;
}

/* form-control: match BS3 height (34px) and padding */
.form-control {
  height: 34px;
  padding: 6px 12px;
  font-size: 14px;
  line-height: 1.42857143;
  border-radius: 4px;
  border: 1px solid #ccc;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
  color: #555;
  background-color: #fff;
}
.form-control:focus {
  border-color: #66afe9;
  outline: 0;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

/* page-header (BS3 component, fully removed in BS4 — no replacement utility exists).
   Used by the form-builder's "header" field type as a section divider. */
.page-header {
  padding-bottom: 9px;
  margin: 40px 0 20px;
  border-bottom: 1px solid #eee;
}

/* checkbox / radio wrapper divs (BS4 replaced these with .form-check; 13 payment-history
   search forms still use the original BS3 <div class="checkbox">/<div class="radio"> pattern) */
.radio,
.checkbox {
  position: relative;
  display: block;
  margin-top: 10px;
  margin-bottom: 10px;
}
.radio-inline,
.checkbox-inline {
  position: relative;
  display: inline-block;
  padding-left: 20px;
  margin-bottom: 0;
  font-weight: 400;
  vertical-align: middle;
  cursor: pointer;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
  margin-top: 0;
  margin-left: 10px;
}

/* control-label (BS4 uses col-form-label, but control-label still needs to work) */
.control-label {
  padding-top: calc(0.375rem + 1px);
  padding-bottom: calc(0.375rem + 1px);
  margin-bottom: 0;
  font-weight: 700;
  text-align: right;
}
@media (max-width: 767.98px) {
  .control-label {
    text-align: left;
  }
}

/* form-horizontal: in BS4 this class doesn't exist but shouldn't break */
.form-horizontal .form-group {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

/* Custom checkbox using background image: hide native input */
.label_check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* Payment response page: table-like layout for response details */
.response-detail {
  display: flex;
  padding: 4px 0;
}
.response-detail .detail-label {
  font-weight: 700;
  min-width: 160px;
  display: inline-block;
}

/* ============================================
   NAVIGATION / TABS (BS3 structure compat)
   ============================================ */
/* BS3 nav-tabs uses li > a, BS4 uses .nav-item > .nav-link 
   These rules ensure the old structure still works */
.nav-tabs > li {
  margin-bottom: -1px;
}
.nav-tabs > li > a {
  display: block;
  padding: 0.5rem 1rem;
  margin-right: 2px;
  line-height: 1.42857143;
  border: 1px solid transparent;
  border-radius: 0.25rem 0.25rem 0 0;
  color: #337ab7;
  text-decoration: none;
}
.nav-tabs > li > a:hover {
  border-color: #e9ecef #e9ecef #dee2e6;
  text-decoration: none;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
  color: #495057;
  cursor: default;
  background-color: #fff;
  border: 1px solid #dee2e6;
  border-bottom-color: transparent;
}

/* ============================================
   MODALS (BS3 uses .fade.in, BS4 uses .fade.show)
   The BS4 JS handles this automatically, but
   ensure .in still works for any hardcoded references
   ============================================ */
.fade.in { opacity: 1; }
.modal.in .modal-dialog {
  transform: translate(0, 0);
}
.collapse.in { display: block; }

/* Real BS3 CSS is still loaded elsewhere (yii\bootstrap\BootstrapAsset, pulled in by
   AppAsset and by several formgenerate.php/_form.php views). BS3's own
   .modal.fade .modal-dialog{transform:translate(0,-25%)} rule matches BS4-opened modals
   (class="modal fade show") because BS4's JS adds `.show`, not BS3's `.in` — so BS3's
   own reset rule (.modal.in .modal-dialog) never fires and the dialog stays translated
   off its resting position, making it effectively invisible. !important here guarantees
   this wins over BS3's rule regardless of <link> load order between the two stylesheets. */
.modal.show .modal-dialog {
  -webkit-transform: none !important;
  transform: none !important;
}
.modal.fade:not(.show) .modal-dialog {
  -webkit-transform: translate(0, -50px) !important;
  transform: translate(0, -50px) !important;
}
.modal-backdrop.show {
  opacity: .5 !important;
}
.modal.show {
  display: block !important;
  opacity: 1 !important;
}

/* ============================================
   CLOSE BUTTON (BS3 position compat)
   ============================================ */
.modal-header .close {
  margin: -1rem -1rem -1rem auto;
  padding: 1rem;
}

/* alert-dismissable (BS3's original — misspelled — class, aliased to alert-dismissible
   in real BS3 via CSS. BS4 dropped the alias and only styles the correct spelling, so
   site/index.php and bpcl/_send_otp.php's flash-message close buttons lost this. */
.alert-dismissable {
  padding-right: 35px;
}
.alert-dismissable .close {
  position: relative;
  top: -2px;
  right: -21px;
  color: inherit;
}

/* ============================================
   CARET (BS4 removed .caret, uses ::after on dropdown-toggle instead)
   Keep .caret for views that still use <span class="caret">
   ============================================ */
.caret {
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  vertical-align: middle;
  border-top: 4px dashed;
  border-top: 4px solid\9;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
}
.dropdown-toggle::after {
  display: none;
}
