/**
 * Bootstrap Version-Specific Overrides
 * 
 * This file contains CSS that fixes Bootstrap 5 specific issues.
 * When upgrading to Bootstrap 6, update this file with new fixes.
 * 
 * Current Bootstrap Version: 5.3.3
 */

/* ============================================
   FORM ELEMENTS - Bootstrap 5 Fixes
   ============================================ */

/* Fix form-group spacing (removed in BS5) */
.form-group,
.js-form-item,
.form-item {
  margin-bottom: 1rem;
}

/* Fix control-label (removed in BS5) */
.control-label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Fix form-control width */
.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* ============================================
   BUTTONS - Bootstrap 5 Fixes
   ============================================ */

/* btn-default removed in BS5, map to btn-secondary */
.btn-default {
  color: #333;
  background-color: #fff;
  border-color: #ccc;
}

.btn-default:hover,
.btn-default:focus {
  color: #333;
  background-color: #e6e6e6;
  border-color: #adadad;
}

/* ============================================
   PANELS → CARDS Migration
   ============================================ */

/* Panel classes removed in BS5, provide fallback */
.panel {
  position: relative;
  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-top-left-radius: 3px;
  border-top-right-radius: 3px;
  background-color: #f5f5f5;
}

.panel-title {
  margin-top: 0;
  margin-bottom: 0;
  font-size: 16px;
  font-weight: 500;
}

.panel-body {
  padding: 15px;
}

.panel-footer {
  padding: 10px 15px;
  background-color: #f5f5f5;
  border-top: 1px solid #ddd;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
}

/* Panel variants */
.panel-default {
  border-color: #ddd;
}

.panel-primary {
  border-color: #337ab7;
}

.panel-primary > .panel-heading {
  color: #fff;
  background-color: #337ab7;
  border-color: #337ab7;
}

/* ============================================
   UTILITY CLASSES - Bootstrap 5 Changes
   ============================================ */

/* Hidden classes renamed in BS5 */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* Pull classes removed in BS5 */
.pull-left {
  float: left !important;
}

.pull-right {
  float: right !important;
}

/* Text alignment */
.text-left {
  text-align: left !important;
}

.text-right {
  text-align: right !important;
}

.text-center {
  text-align: center !important;
}

/* ============================================
   FORM VALIDATION - Bootstrap 5 Changes
   ============================================ */

/* Error state styling */
.has-error .form-control {
  border-color: #a94442;
}

.has-error .control-label {
  color: #a94442;
}

.help-block {
  display: block;
  margin-top: 5px;
  margin-bottom: 10px;
  color: #737373;
}

.has-error .help-block {
  color: #a94442;
}

/* ============================================
   ALERTS - Bootstrap 5 Changes
   ============================================ */

/* Alert close button positioning */
.alert-dismissible .close {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.75rem 1.25rem;
  color: inherit;
}

/* ============================================
   NAVBAR - Bootstrap 5 Changes
   ============================================ */

/* Navbar form spacing */
.navbar-form {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* ============================================
   GRID SYSTEM - Bootstrap 5 Adjustments
   ============================================ */

/* Ensure container behavior */
.container-fluid {
  width: 100%;
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
}

/* Row negative margins */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

/* ============================================
   RESPONSIVE UTILITIES - Bootstrap 5 Changes
   ============================================ */

/* Visible/Hidden classes for different breakpoints */
@media (max-width: 767.98px) {
  .hidden-xs {
    display: none !important;
  }
}

@media (min-width: 768px) and (max-width: 991.98px) {
  .hidden-sm {
    display: none !important;
  }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
  .hidden-md {
    display: none !important;
  }
}

@media (min-width: 1200px) {
  .hidden-lg {
    display: none !important;
  }
}
