/* ============================================================
   Bootstrap 3 → 5 Compatibility Shim
   Allows un-migrated pages to render under Bootstrap 5
   DELETE THIS FILE after all templates are migrated (Phase 8)
   ============================================================ */

/* ── Grid: col-xs-* → col-* ── */
.col-xs-1  { flex: 0 0 auto; width: 8.333333%; }
.col-xs-2  { flex: 0 0 auto; width: 16.666667%; }
.col-xs-3  { flex: 0 0 auto; width: 25%; }
.col-xs-4  { flex: 0 0 auto; width: 33.333333%; }
.col-xs-5  { flex: 0 0 auto; width: 41.666667%; }
.col-xs-6  { flex: 0 0 auto; width: 50%; }
.col-xs-7  { flex: 0 0 auto; width: 58.333333%; }
.col-xs-8  { flex: 0 0 auto; width: 66.666667%; }
.col-xs-9  { flex: 0 0 auto; width: 75%; }
.col-xs-10 { flex: 0 0 auto; width: 83.333333%; }
.col-xs-11 { flex: 0 0 auto; width: 91.666667%; }
.col-xs-12 { flex: 0 0 auto; width: 100%; }

/* ── Grid Offsets ── */
.col-xs-offset-0  { margin-left: 0; }
.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-5  { margin-left: 41.666667%; }
.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%; }

/* ── Floats ── */
.pull-left  { float: left !important; }
.pull-right { float: right !important; }

/* ── Visibility (BS3 → BS5 responsive display) ── */
.hidden-xs { display: none !important; }
@media (min-width: 576px)  { .hidden-xs { display: block !important; } }
@media (max-width: 575.98px) { .visible-xs { display: block !important; } }
@media (min-width: 576px)  { .visible-xs { display: none !important; } }

.hidden-sm { display: block !important; }
@media (min-width: 576px) and (max-width: 767.98px) { .hidden-sm { display: none !important; } }
.hidden-md { display: block !important; }
@media (min-width: 768px) and (max-width: 991.98px) { .hidden-md { display: none !important; } }
.hidden-lg { display: block !important; }
@media (min-width: 992px) { .hidden-lg { display: none !important; } }

@media (min-width: 576px) and (max-width: 767.98px) { .visible-sm { display: block !important; } }
@media (min-width: 768px) and (max-width: 991.98px) { .visible-md { display: block !important; } }
@media (min-width: 992px) { .visible-lg { display: block !important; } }

/* ── Panels → Cards ── */
.panel {
  background-color: var(--ab-surface-card, #fff);
  border: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-md, 10px);
  margin-bottom: 1.25rem;
  box-shadow: var(--ab-shadow-card, 0 2px 8px rgba(27,42,74,0.06));
}
.panel-body {
  padding: 1.25rem;
}
.panel-heading {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-md, 10px) var(--ab-radius-md, 10px) 0 0;
  background-color: var(--ab-surface-alt, #F0EDE8);
  font-weight: 600;
}
.panel-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--ab-border, #E2DDD5);
  background-color: var(--ab-surface-alt, #F0EDE8);
}
.panel-default { }
.panel-primary {
  border-color: var(--ab-primary, #1B2A4A);
}
.panel-primary > .panel-heading {
  background-color: var(--ab-primary, #1B2A4A);
  color: var(--ab-text-inverse, #fff);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 1rem;
}
.has-error .form-control {
  border-color: var(--ab-danger, #D4574E);
}
.has-error .control-label,
.has-error .help-block {
  color: var(--ab-danger, #D4574E);
}
.has-success .form-control {
  border-color: var(--ab-success, #5B8A72);
}
.help-block {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--ab-text-sm, 0.875rem);
  color: var(--ab-text-secondary, #6B6B6B);
}

/* ── Buttons ── */
.btn-default {
  color: var(--ab-text, #2D2D2D);
  background-color: var(--ab-surface-card, #fff);
  border-color: var(--ab-border, #E2DDD5);
}
.btn-default:hover,
.btn-default:focus {
  background-color: var(--ab-surface-alt, #F0EDE8);
  border-color: var(--ab-border-dark, #C5BFB5);
}

/* ── Input Groups (BS3 addons) ── */
.input-group-addon {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ab-text, #2D2D2D);
  text-align: center;
  white-space: nowrap;
  background-color: var(--ab-surface-alt, #F0EDE8);
  border: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-sm, 6px);
}
.input-group-btn {
  display: flex;
}

/* ── Wells → Light card ── */
.well {
  background-color: var(--ab-surface-alt, #F0EDE8);
  border: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-md, 10px);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

/* ── Thumbnails ── */
.thumbnail {
  display: block;
  padding: 4px;
  background-color: var(--ab-surface-card, #fff);
  border: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-sm, 6px);
  transition: border-color var(--ab-transition-base, 250ms ease);
}

/* ── Labels → Badges ── */
.label {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: var(--ab-radius-xs, 4px);
}
.label-default { background-color: var(--ab-text-secondary, #6B6B6B); color: #fff; }
.label-primary { background-color: var(--ab-primary, #1B2A4A); color: #fff; }
.label-success { background-color: var(--ab-success, #5B8A72); color: #fff; }
.label-info    { background-color: var(--ab-info, #4A90B8); color: #fff; }
.label-warning { background-color: var(--ab-warning, #E6A940); color: #fff; }
.label-danger  { background-color: var(--ab-danger, #D4574E); color: #fff; }

/* ── img-responsive → img-fluid ── */
.img-responsive {
  max-width: 100%;
  height: auto;
}

/* ── sr-only → visually-hidden ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Navbar compat ── */
.navbar-default {
  background-color: var(--ab-surface-card, #fff);
  border-bottom: 1px solid var(--ab-border, #E2DDD5);
}
.navbar-right {
  margin-left: auto !important;
}
.navbar-toggle {
  padding: 0.25rem 0.75rem;
  font-size: 1.25rem;
  line-height: 1;
  background-color: transparent;
  border: 1px solid var(--ab-border, #E2DDD5);
  border-radius: var(--ab-radius-sm, 6px);
  cursor: pointer;
}
.navbar-toggle .icon-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background-color: var(--ab-text-secondary, #6B6B6B);
  margin: 4px 0;
}

/* ── Divider in dropdowns ── */
li.divider,
.divider {
  height: 0;
  margin: 0.5rem 0;
  overflow: hidden;
  border-top: 1px solid var(--ab-border, #E2DDD5);
}

/* ── Caret ── */
.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;
}

/* ── Text helpers ── */
.text-muted { color: var(--ab-text-muted, #9A9A9A) !important; }
.text-primary { color: var(--ab-primary, #1B2A4A) !important; }
.text-success { color: var(--ab-success, #5B8A72) !important; }
.text-info    { color: var(--ab-info, #4A90B8) !important; }
.text-warning { color: var(--ab-warning, #E6A940) !important; }
.text-danger  { color: var(--ab-danger, #D4574E) !important; }

/* ── List group ── */
.list-group-item {
  border-color: var(--ab-border, #E2DDD5);
}

/* ── Glyphicon placeholder (until replaced with Bootstrap Icons) ── */
.glyphicon {
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.glyphicon-remove::before,
.glyphicon-remove-circle::before { content: "\F62A"; } /* bi-x-circle */
.glyphicon-ok::before,
.glyphicon-ok-circle::before     { content: "\F26B"; } /* bi-check-circle */
.glyphicon-search::before        { content: "\F52A"; } /* bi-search */
.glyphicon-star::before          { content: "\F586"; } /* bi-star-fill */
.glyphicon-star-empty::before    { content: "\F588"; } /* bi-star */
.glyphicon-chevron-left::before  { content: "\F284"; } /* bi-chevron-left */
.glyphicon-chevron-right::before { content: "\F285"; } /* bi-chevron-right */
.glyphicon-chevron-down::before  { content: "\F282"; } /* bi-chevron-down */
.glyphicon-chevron-up::before    { content: "\F283"; } /* bi-chevron-up */
.glyphicon-plus::before          { content: "\F4FE"; } /* bi-plus */
.glyphicon-minus::before         { content: "\F2EA"; } /* bi-dash */
.glyphicon-pencil::before        { content: "\F4CA"; } /* bi-pencil */
.glyphicon-trash::before         { content: "\F5DE"; } /* bi-trash */
.glyphicon-calendar::before      { content: "\F1E5"; } /* bi-calendar */
.glyphicon-user::before          { content: "\F4E1"; } /* bi-person */
.glyphicon-envelope::before      { content: "\F32F"; } /* bi-envelope */
.glyphicon-phone::before         { content: "\F4E2"; } /* bi-telephone */
.glyphicon-home::before          { content: "\F3DE"; } /* bi-house */
.glyphicon-cog::before,
.glyphicon-wrench::before        { content: "\F3E5"; } /* bi-gear */
.glyphicon-refresh::before       { content: "\F116"; } /* bi-arrow-clockwise */
.glyphicon-download::before      { content: "\F30A"; } /* bi-download */
.glyphicon-upload::before        { content: "\F607"; } /* bi-upload */
.glyphicon-info-sign::before     { content: "\F431"; } /* bi-info-circle */
.glyphicon-question-sign::before { content: "\F504"; } /* bi-question-circle */
.glyphicon-warning-sign::before  { content: "\F33B"; } /* bi-exclamation-triangle */
.glyphicon-ban-circle::before    { content: "\F53D"; } /* bi-slash-circle */
.glyphicon-eye-open::before      { content: "\F341"; } /* bi-eye */
.glyphicon-eye-close::before     { content: "\F343"; } /* bi-eye-slash */
.glyphicon-map-marker::before    { content: "\F3E8"; } /* bi-geo-alt */
.glyphicon-heart::before         { content: "\F3E1"; } /* bi-heart */
.glyphicon-heart-empty::before   { content: "\F3E1"; } /* bi-heart */
.glyphicon-camera::before        { content: "\F1E7"; } /* bi-camera */
.glyphicon-picture::before       { content: "\F3F4"; } /* bi-image */
.glyphicon-time::before          { content: "\F293"; } /* bi-clock */
.glyphicon-list::before          { content: "\F479"; } /* bi-list */
.glyphicon-check::before         { content: "\F26A"; } /* bi-check */
.glyphicon-log-out::before       { content: "\F1C3"; } /* bi-box-arrow-right */
