/**
 * Bootstrap 2.x to Bootstrap 5 Compatibility Layer
 * FPTB Legacy Portal
 *
 * This file maps Bootstrap 2.x class names to Bootstrap 5 equivalents,
 * allowing gradual migration without breaking existing templates.
 *
 * Created: 2026-01-12
 * Phase 1: Student Portal Foundation - COMPLETE
 */

/* ==========================================================================
   Grid System Compatibility
   Bootstrap 2.x used .span1-12, Bootstrap 5 uses .col-*
   ========================================================================== */

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

.row-fluid > [class*="span"] {
    padding-right: 15px;
    padding-left: 15px;
    box-sizing: border-box;
}

/* Span classes - map to percentage widths */
.span1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.span2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.span3 { flex: 0 0 25%; max-width: 25%; }
.span4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.span5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.span6 { flex: 0 0 50%; max-width: 50%; }
.span7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.span8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.span9 { flex: 0 0 75%; max-width: 75%; }
.span10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.span11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.span12 { flex: 0 0 100%; max-width: 100%; }

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

/* ==========================================================================
   Navbar Compatibility
   Bootstrap 2.x used .navbar-fixed-top with different structure
   ========================================================================== */

.navbar.navbar-fixed-top {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 1030;
}

.navbar-inner {
    min-height: 40px;
    padding-right: 20px;
    padding-left: 20px;
    background-color: #f5f5f5;
    background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);
}

.navbar .brand {
    display: block;
    float: left;
    padding: 10px 20px 10px;
    margin-left: -20px;
    font-size: 20px;
    font-weight: 200;
    color: #777777;
    text-shadow: 0 1px 0 #ffffff;
    text-decoration: none;
}

.navbar .nav {
    position: relative;
    left: 0;
    display: block;
    float: left;
    margin: 0 10px 0 0;
    list-style: none;
    padding-left: 0;
}

.navbar .nav > li {
    float: left;
}

.navbar .nav > li > a {
    float: none;
    padding: 10px 15px;
    color: #777777;
    text-decoration: none;
    text-shadow: 0 1px 0 #ffffff;
}

.navbar .nav > li > a:hover,
.navbar .nav > li > a:focus {
    color: #333333;
    text-decoration: none;
    background-color: transparent;
}

.navbar .nav > .active > a,
.navbar .nav > .active > a:hover,
.navbar .nav > .active > a:focus {
    color: #555555;
    text-decoration: none;
    background-color: #e5e5e5;
    box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125);
}

/* Mobile nav toggle */
.btn-navbar {
    display: none;
    float: right;
    padding: 7px 10px;
    margin-right: 5px;
    margin-left: 5px;
    color: #fff;
    background-color: #ededed;
    border-color: #d4d4d4;
}

.btn-navbar .icon-bar {
    display: block;
    width: 18px;
    height: 2px;
    background-color: #f5f5f5;
    border-radius: 1px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

.btn-navbar .icon-bar + .icon-bar {
    margin-top: 3px;
}

.nav-collapse {
    height: auto;
    overflow: visible;
}

/* ==========================================================================
   Button Compatibility
   Bootstrap 2.x button classes
   ========================================================================== */

/* Size variants */
.btn-large,
.btn.large {
    padding: 11px 19px;
    font-size: 17.5px;
    border-radius: 6px;
}

.btn-small,
.btn.small {
    padding: 2px 10px;
    font-size: 11.9px;
    border-radius: 3px;
}

.btn-mini {
    padding: 0 6px;
    font-size: 10.5px;
    border-radius: 3px;
}

/* Ensure btn base styles work */
.btn {
    display: inline-block;
    padding: 4px 12px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: 4px;
    text-decoration: none;
}

.btn:hover,
.btn:focus {
    text-decoration: none;
}

/* Color variants - Bootstrap 2.x names */
.btn-primary {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.btn-success {
    color: #fff;
    background-color: #198754;
    border-color: #198754;
}

.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #bb2d3b;
    border-color: #b02a37;
}

.btn-warning {
    color: #000;
    background-color: #ffc107;
    border-color: #ffc107;
}

.btn-info {
    color: #fff;
    background-color: #0dcaf0;
    border-color: #0dcaf0;
}

/* Bootstrap 2.x default button */
.btn:not([class*="btn-"]) {
    color: #333;
    background-color: #f8f9fa;
    border-color: #d3d9df;
}

.btn:not([class*="btn-"]):hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

/* ==========================================================================
   Form Compatibility
   Bootstrap 2.x form classes
   ========================================================================== */

.form-horizontal .control-group {
    margin-bottom: 20px;
}

.form-horizontal .control-label {
    float: left;
    width: 160px;
    padding-top: 5px;
    text-align: right;
}

.form-horizontal .controls {
    margin-left: 180px;
}

.control-group {
    margin-bottom: 10px;
}

/* Input sizing */
.input-mini {
    width: 60px;
}

.input-small {
    width: 90px;
}

.input-medium {
    width: 150px;
}

.input-large {
    width: 210px;
}

.input-xlarge {
    width: 270px;
}

.input-xxlarge {
    width: 530px;
}

/* Uneditable input */
.uneditable-input {
    display: block;
    padding: 4px 6px;
    background-color: #fafafa;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.025);
    cursor: not-allowed;
}

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

.help-inline {
    display: inline-block;
    padding-left: 5px;
    color: #737373;
}

/* ==========================================================================
   Alert Compatibility
   Bootstrap 2.x alert classes
   ========================================================================== */

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

/* Bootstrap 2.x used alert-error, BS5 uses alert-danger */
.alert-error {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

/* Close button in alerts */
.alert .close {
    position: relative;
    top: -2px;
    right: -21px;
    float: right;
    font-size: 21px;
    font-weight: bold;
    line-height: 20px;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: 0.2;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.alert .close:hover {
    opacity: 0.4;
    text-decoration: none;
}

/* Fade transition */
.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.fade.in {
    opacity: 1;
}

/* ==========================================================================
   Label & Badge Compatibility
   Bootstrap 2.x label classes
   ========================================================================== */

.label {
    display: inline-block;
    padding: 2px 4px;
    font-size: 11.844px;
    font-weight: bold;
    line-height: 14px;
    color: #fff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    vertical-align: baseline;
    background-color: #999;
    border-radius: 3px;
}

/* Bootstrap 2.x used label-important, BS5 uses bg-danger */
.label-important {
    background-color: #dc3545;
}

.label-warning {
    background-color: #ffc107;
    color: #000;
    text-shadow: none;
}

.label-success {
    background-color: #198754;
}

.label-info {
    background-color: #0dcaf0;
    color: #000;
    text-shadow: none;
}

.label-inverse {
    background-color: #333;
}

/* ==========================================================================
   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);
}

.well-large {
    padding: 24px;
    border-radius: 6px;
}

.well-small {
    padding: 9px;
    border-radius: 3px;
}

/* ==========================================================================
   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;
    list-style: none;
    background-color: #fff;
    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: normal;
    line-height: 20px;
    color: #333;
    white-space: nowrap;
    text-decoration: none;
}

.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
    color: #fff;
    background-color: #0d6efd;
}

.dropdown-menu .divider {
    height: 1px;
    margin: 9px 0;
    overflow: hidden;
    background-color: #e5e5e5;
}

.open > .dropdown-menu {
    display: block;
}

/* 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;
}

/* ==========================================================================
   Navigation Pills & Tabs
   ========================================================================== */

.nav-pills,
.nav-tabs {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.nav-pills > li,
.nav-tabs > li {
    float: left;
}

.nav-pills > li > a {
    padding: 8px 12px;
    margin: 2px;
    border-radius: 5px;
    text-decoration: none;
    color: #0d6efd;
}

.nav-pills > li > a:hover {
    background-color: #e9ecef;
}

.nav-pills > .active > a,
.nav-pills > .active > a:hover {
    color: #fff;
    background-color: #0d6efd;
}

.nav-stacked > li {
    float: none;
}

.nav-stacked > li > a {
    display: block;
}

/* ==========================================================================
   Table Compatibility
   ========================================================================== */

.table {
    width: 100%;
    margin-bottom: 20px;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 8px;
    line-height: 20px;
    text-align: left;
    vertical-align: top;
    border-top: 1px solid #ddd;
}

.table th {
    font-weight: bold;
}

.table thead th {
    vertical-align: bottom;
}

.table-striped tbody > tr:nth-child(odd) > td,
.table-striped tbody > tr:nth-child(odd) > th {
    background-color: #f9f9f9;
}

.table-bordered {
    border: 1px solid #ddd;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #ddd;
}

/* ==========================================================================
   Icon Compatibility (Glyphicons to Bootstrap Icons mapping concept)
   Note: For full icon support, consider adding Bootstrap Icons CSS
   ========================================================================== */

[class^="icon-"],
[class*=" icon-"] {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-top: 1px;
    line-height: 14px;
    vertical-align: text-top;
}

/* Common icons - using Unicode fallbacks */
.icon-arrow-right::before { content: "\2192"; }
.icon-arrow-left::before { content: "\2190"; }
.icon-ok::before { content: "\2713"; }
.icon-remove::before { content: "\2717"; }
.icon-user::before { content: "\1F464"; }
.icon-search::before { content: "\1F50D"; }
.icon-plus::before { content: "+"; }
.icon-minus::before { content: "-"; }
.icon-home::before { content: "\1F3E0"; }
.icon-file::before { content: "\1F4C4"; }
.icon-print::before { content: "\1F5A8"; }

/* ==========================================================================
   Utility Classes
   ========================================================================== */

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

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

.clearfix::after {
    display: block;
    clear: both;
    content: "";
}

.hide {
    display: none !important;
}

.show {
    display: block !important;
}

.invisible {
    visibility: hidden;
}

.text-left {
    text-align: left;
}

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

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

.muted {
    color: #999;
}

/* Unstyled list */
.unstyled {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

/* ==========================================================================
   Carousel Compatibility
   ========================================================================== */

.carousel {
    position: relative;
}

.carousel-inner {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.carousel-inner > .item {
    display: none;
    position: relative;
    transition: transform 0.6s ease-in-out;
}

.carousel-inner > .item.active {
    display: block;
}

/* ==========================================================================
   Modal Compatibility
   ========================================================================== */

.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    display: none;
    overflow: hidden;
    outline: 0;
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -25%);
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    background-color: #000;
}

.modal-backdrop.fade {
    opacity: 0;
}

.modal-backdrop.in,
.modal-backdrop.show {
    opacity: 0.5;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 767px) {
    .row-fluid {
        flex-direction: column;
    }

    .row-fluid > [class*="span"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .nav-collapse {
        height: 0;
        overflow: hidden;
    }

    .nav-collapse.in {
        height: auto;
        overflow: visible;
    }

    .btn-navbar {
        display: block;
    }

    .navbar .nav {
        float: none;
        margin: 0;
    }

    .navbar .nav > li {
        float: none;
    }

    .navbar .nav > li > a {
        display: block;
        padding: 10px;
    }

    .form-horizontal .control-label {
        float: none;
        width: auto;
        text-align: left;
        padding-top: 0;
    }

    .form-horizontal .controls {
        margin-left: 0;
    }

    .input-large,
    .input-xlarge,
    .input-xxlarge {
        width: 100%;
        box-sizing: border-box;
    }
}

/* ==========================================================================
   Print Styles - Preserve existing print.css behavior
   ========================================================================== */

@media print {
    .navbar,
    .btn-navbar,
    .nav-collapse {
        display: none !important;
    }

    .container-fluid {
        width: 100%;
        padding: 0;
    }
}
