/* 
 * Bootstrap 3 to Bootstrap 5 Migration Styles
 * This file preserves the look and feel of Bootstrap 3.3.7 components
 * when migrating to Bootstrap 5.x
 * 
 * Key areas covered:
 * - Grid system (col-xs-* compatibility)
 * - Container spacing and padding
 * - Navbar structure and alignment
 * - Panel/Card components
 * - Form controls
 * - Modal structures
 * - Visibility utilities
 */

/* ==========================================================================
   GRID SYSTEM COMPATIBILITY
   ========================================================================== */

/* Bootstrap 5 removed col-xs-* prefix, map to col-* for mobile-first */
.col-xs-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-xs-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-xs-3 { flex: 0 0 25%; max-width: 25%; }
.col-xs-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-xs-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-xs-6 { flex: 0 0 50%; max-width: 50%; }
.col-xs-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-xs-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-xs-9 { flex: 0 0 75%; max-width: 75%; }
.col-xs-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-xs-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-xs-12 { flex: 0 0 100%; max-width: 100%; }

/* Preserve Bootstrap 3 row gutters (30px total, 15px on each side) */
.row {
    margin-right: -15px;
    margin-left: -15px;
}

.row > * {
    padding-right: 15px;
    padding-left: 15px;
}

/* ==========================================================================
   CONTAINER COMPATIBILITY
   ========================================================================== */

/* Preserve Bootstrap 3 container behavior */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 768px) {
    .container {
        max-width: 750px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 970px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1170px;
    }
}

.container-fluid {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* ==========================================================================
   NAVBAR COMPATIBILITY
   ========================================================================== */

/* Bootstrap 3 navbar-right alignment */
.navbar-right {
    float: right !important;
    margin-right: -15px;
}

.navbar-nav {
    margin: 7.5px -15px;
}

.navbar-nav > li {
    float: left;
}

.navbar-nav > li > a {
    padding-top: 10px;
    padding-bottom: 10px;
    line-height: 20px;
}

@media (min-width: 768px) {
    .navbar-nav {
        float: left;
        margin: 0;
    }

    .navbar-nav > li {
        float: left;
    }

    .navbar-nav > li > a {
        padding-top: 15px;
        padding-bottom: 15px;
    }

    .navbar-right {
        float: right !important;
        margin-right: 0;
    }
}

/* Navbar header compatibility */
.navbar-header {
    float: left;
}

.navbar-brand {
    float: left;
    padding: 15px 15px;
    font-size: 18px;
    line-height: 20px;
    height: 50px;
}

.navbar-toggle {
    position: relative;
    float: right;
    padding: 9px 10px;
    margin-top: 8px;
    margin-right: 15px;
    margin-bottom: 8px;
    background-color: transparent;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

/* ==========================================================================
   PANEL TO CARD COMPATIBILITY (x_panel is custom)
   ========================================================================== */

/* Preserve panel-like spacing for custom x_panel components */
.panel,
.card {
    margin-bottom: 20px;
    background-color: #fff;
    border: 1px solid transparent;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

.panel-heading,
.card-header {
    padding: 10px 15px;
    border-bottom: 1px solid transparent;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

.panel-body,
.card-body {
    padding: 15px;
}

.panel-footer,
.card-footer {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    border-bottom-right-radius: 3px;
    border-bottom-left-radius: 3px;
}

/* ==========================================================================
   FORM CONTROLS
   ========================================================================== */

/* Preserve Bootstrap 3 form control sizing */
.form-control {
    display: block;
    width: 100%;
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
    transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s;
}

.form-control:focus {
    border-color: #66afe9;
    outline: 0;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
}

/* Form group spacing */
.form-group {
    margin-bottom: 15px;
}

.form-horizontal .form-group {
    margin-right: -15px;
    margin-left: -15px;
}

.form-horizontal .control-label {
    padding-top: 7px;
    margin-bottom: 0;
    text-align: right;
}

/* Input group compatibility */
.input-group {
    position: relative;
    display: table;
    border-collapse: separate;
}

.input-group .form-control {
    position: relative;
    z-index: 2;
    float: left;
    width: 100%;
    margin-bottom: 0;
}

.input-group-addon,
.input-group-btn {
    width: 1%;
    white-space: nowrap;
    vertical-align: middle;
    display: table-cell;
}

.input-group-addon {
    padding: 6px 12px;
    font-size: 14px;
    font-weight: 400;
    line-height: 1;
    color: #555;
    text-align: center;
    background-color: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ==========================================================================
   MODAL COMPATIBILITY
   ========================================================================== */

/* Preserve Bootstrap 3 modal spacing */
.modal-content {
    position: relative;
    background-color: #fff;
    border: 1px solid #999;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    outline: 0;
    box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #e5e5e5;
}

.modal-title {
    margin: 0;
    line-height: 1.42857143;
}

.modal-body {
    position: relative;
    padding: 15px;
}

.modal-footer {
    padding: 15px;
    text-align: right;
    border-top: 1px solid #e5e5e5;
}

.modal-footer .btn + .btn {
    margin-bottom: 0;
    margin-left: 5px;
}

/* ==========================================================================
   BUTTON COMPATIBILITY
   ========================================================================== */

/* Preserve Bootstrap 3 button styling */
.btn {
    display: inline-block;
    padding: 6px 12px;
    margin-bottom: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.42857143;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-image: none;
    border: 1px solid transparent;
    border-radius: 4px;
}

.btn-group > .btn,
.btn-group-vertical > .btn {
    position: relative;
    float: left;
}

.btn-group > .btn:hover,
.btn-group-vertical > .btn:hover,
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus,
.btn-group > .btn:active,
.btn-group-vertical > .btn:active,
.btn-group > .btn.active,
.btn-group-vertical > .btn.active {
    z-index: 2;
}

/* ==========================================================================
   TABLE COMPATIBILITY
   ========================================================================== */

/* Preserve Bootstrap 3 table styles */
.table {
    width: 100%;
    max-width: 100%;
    margin-bottom: 20px;
    background-color: transparent;
}

.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 1px solid #ddd;
}

.table > thead > tr > th {
    vertical-align: bottom;
    border-bottom: 2px solid #ddd;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f9f9f9;
}

/* ==========================================================================
   VISIBILITY UTILITIES
   ========================================================================== */

/* Bootstrap 3 hidden classes */
.hidden {
    display: none !important;
}

.hidden-xs {
    display: none !important;
}

@media (min-width: 768px) {
    .hidden-xs {
        display: block !important;
    }
    table.hidden-xs {
        display: table !important;
    }
    tr.hidden-xs {
        display: table-row !important;
    }
    th.hidden-xs,
    td.hidden-xs {
        display: table-cell !important;
    }
}

.hidden-sm {
    display: block !important;
}

@media (min-width: 768px) and (max-width: 991px) {
    .hidden-sm {
        display: none !important;
    }
}

.hidden-md {
    display: block !important;
}

@media (min-width: 992px) and (max-width: 1199px) {
    .hidden-md {
        display: none !important;
    }
}

.hidden-lg {
    display: block !important;
}

@media (min-width: 1200px) {
    .hidden-lg {
        display: none !important;
    }
}

/* Visible utilities */
.visible-xs {
    display: none !important;
}

@media (max-width: 767px) {
    .visible-xs {
        display: block !important;
    }
    table.visible-xs {
        display: table !important;
    }
    tr.visible-xs {
        display: table-row !important;
    }
    th.visible-xs,
    td.visible-xs {
        display: table-cell !important;
    }
}

/* ==========================================================================
   PULL UTILITIES
   ========================================================================== */

/* Bootstrap 3 pull-left and pull-right */
.pull-left {
    float: left !important;
}

.pull-right {
    float: right !important;
}

/* ==========================================================================
   CLEARFIX
   ========================================================================== */

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* ==========================================================================
   DROPDOWN COMPATIBILITY
   ========================================================================== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    float: left;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    font-size: 14px;
    text-align: left;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ccc;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}

.dropdown-menu > li > a {
    display: block;
    padding: 3px 20px;
    clear: both;
    font-weight: 400;
    line-height: 1.42857143;
    color: #333;
    white-space: nowrap;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    color: #262626;
    text-decoration: none;
    background-color: #f5f5f5;
}

.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
    color: #fff;
    text-decoration: none;
    background-color: #337ab7;
    outline: 0;
}

/* ==========================================================================
   NAV TABS COMPATIBILITY
   ========================================================================== */

.nav-tabs {
    border-bottom: 1px solid #ddd;
}

.nav-tabs > li {
    float: left;
    margin-bottom: -1px;
}

.nav-tabs > li > a {
    margin-right: 2px;
    line-height: 1.42857143;
    border: 1px solid transparent;
    border-radius: 4px 4px 0 0;
}

.nav-tabs > li > a:hover {
    border-color: #eee #eee #ddd;
}

.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
    color: #555;
    cursor: default;
    background-color: #fff;
    border: 1px solid #ddd;
    border-bottom-color: transparent;
}

/* ==========================================================================
   PAGINATION COMPATIBILITY
   ========================================================================== */

.pagination {
    display: inline-block;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
}

.pagination > li {
    display: inline;
}

.pagination > li > a,
.pagination > li > span {
    position: relative;
    float: left;
    padding: 6px 12px;
    margin-left: -1px;
    line-height: 1.42857143;
    color: #337ab7;
    text-decoration: none;
    background-color: #fff;
    border: 1px solid #ddd;
}


/* ==========================================================================
    WELL COMPATIBILITY
   ========================================================================== */

.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, 0.05);
}

/* ==========================================================================
   THUMBNAIL COMPATIBILITY
   ========================================================================== */

.thumbnail {
    display: block;
    padding: 4px;
    margin-bottom: 20px;
    line-height: 1.42857143;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: border 0.2s ease-in-out;
}

.thumbnail > img,
.thumbnail a > img {
    margin-right: auto;
    margin-left: auto;
}

/* ==========================================================================
   RESPONSIVE EMBED COMPATIBILITY
   ========================================================================== */

.embed-responsive {
    position: relative;
    display: block;
    height: 0;
    padding: 0;
    overflow: hidden;
}

.embed-responsive-16by9 {
    padding-bottom: 56.25%;
}

.embed-responsive-4by3 {
    padding-bottom: 75%;
}

/* ==========================================================================
   DL-HORIZONTAL COMPATIBILITY
   ========================================================================== */

.dl-horizontal dt {
    float: left;
    width: 160px;
    overflow: hidden;
    clear: left;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dl-horizontal dd {
    margin-left: 180px;
}

@media (max-width: 767px) {
    .dl-horizontal dt {
        float: none;
        width: auto;
        clear: none;
        text-align: left;
    }
    .dl-horizontal dd {
        margin-left: 0;
    }
}

/* ==========================================================================
   CUSTOM LAYOUT PRESERVATION (from layout.css)
   ========================================================================== */

/* Preserve custom right_col behavior with Bootstrap 3 spacing */
.right_col {
    padding: 10px 20px 0;
}

@media (min-width: 768px) {
    .nav-md .right_col {
        margin-left: 230px;
    }
}

/* Preserve top_nav custom structure */
.top_nav {
    display: block;
    margin-left: 230px;
}

.nav-sm .top_nav {
    margin-left: 70px;
}

/* Preserve container.body custom behavior */
.container.body {
    width: 100%;
    padding: 0;
}

.container.body .right_col,
.container.body .top_nav {
    width: 100%;
    margin: 0;
}

/* Preserve left_col menu behavior */
.left_col {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    overflow-y: auto;
}

/* ==========================================================================
   TEXT ALIGNMENT UTILITIES
   ========================================================================== */

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.text-justify {
    text-align: justify !important;
}

/* ==========================================================================
   CONTEXTUAL COLORS (maintain Bootstrap 3 color scheme)
   ========================================================================== */

.text-muted {
    color: #777 !important;
}

.text-primary {
    color: #337ab7 !important;
}

.text-success {
    color: #3c763d !important;
}

.text-info {
    color: #31708f !important;
}

.text-warning {
    color: #8a6d3b !important;
}

.text-danger {
    color: #a94442 !important;
}


/* Background colors */
.bg-primary {
    background-color: #337ab7 !important;
    color: #fff;
}

/* ==========================================================================
   CARET COMPATIBILITY
   ========================================================================== */

.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;
}

/* ==========================================================================
   CLOSE BUTTON COMPATIBILITY
   ========================================================================== */

.close {
    float: right;
    font-size: 21px;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    filter: alpha(opacity=20);
    opacity: 0.2;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
    filter: alpha(opacity=50);
    opacity: 0.5;
}

/* ==========================================================================
   HELPER CLASSES
   ========================================================================== */

.center-block {
    display: block;
    margin-right: auto;
    margin-left: auto;
}

.show {
    display: block !important;
}

.invisible {
    visibility: hidden;
}

.text-hide {
    font: 0/0 a;
    color: transparent;
    text-shadow: none;
    background-color: transparent;
    border: 0;
}

.affix {
    position: fixed;
}

/* ==========================================================================
   RESPONSIVE UTILITIES EXTENSION
   ========================================================================== */

/* Visible print */
.visible-print {
    display: none !important;
}

@media print {
    .visible-print {
        display: block !important;
    }
    table.visible-print {
        display: table !important;
    }
    tr.visible-print {
        display: table-row !important;
    }
    th.visible-print,
    td.visible-print {
        display: table-cell !important;
    }
}

/* Hidden print */
@media print {
    .hidden-print {
        display: none !important;
    }
}

/* Make SweetAlert2 look closer to Bootstrap 3 sizing */
.swal2-popup {
    font-size: 1.0rem !important;
}

.swal2-title {
    font-size: 1.5rem !important;
}

.swal2-html-container {
    font-size: 1.0rem !important;
}

.swal2-styled {
    font-size: 1.0rem !important;
}