/**
 * Bootstrap 5 Migration - CSS Compatibility Fixes
 * This file addresses Bootstrap 4 to 5 migration issues and maintains visual consistency
 */

/* Fix for removed utility classes in Bootstrap 5 */
.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

/* Maintain Bootstrap 4 jumbotron-like styling for hero sections */
.jumbotron {
    padding: 2rem 1rem;
    margin-bottom: 2rem;
    background-color: #e9ecef;
    border-radius: 0.375rem;
}

.jumbotron .display-4 {
    font-size: 3.5rem;
    font-weight: 300;
    line-height: 1.2;
}

.jumbotron .lead {
    font-size: 1.25rem;
    font-weight: 300;
}

/* Fix for close button styling in modals */
.btn-close {
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='m.235.232l15.535 15.536l-.707.707L.528.939zm15.536.235L.235 15.767l-.707-.707L15.064.525z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    width: 1em;
    height: 1em;
    padding: 0.25em 0.25em;
    color: #000;
    border: 0;
    border-radius: 0.375rem;
    opacity: 0.5;
}

.btn-close:hover {
    color: #000;
    text-decoration: none;
    opacity: 0.75;
}

/* Badge compatibility fixes */
.badge {
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

/* Form control and select fixes */
.form-control,
.form-select {
    font-size: 1rem;
    line-height: 1.5;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    color: #212529;
    background-color: #fff;
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgb(13 110 253 / 25%);
}

/* Table styling improvements for Bootstrap 5 */
.table-hover tbody tr:hover {
    color: #212529;
    background-color: rgba(0, 0, 0, 0.075);
}

/* Card styling consistency */
.card {
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    border-top-left-radius: calc(0.375rem - 1px);
    border-top-right-radius: calc(0.375rem - 1px);
}

/* Navigation improvements */
.nav-link {
    color: #0d6efd;
    text-decoration: none;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.nav-link:hover,
.nav-link:focus {
    color: #0a58ca;
    text-decoration: underline;
}

/* Button improvements */
.btn {
    border-radius: 0.375rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

/* Dropdown improvements */
.dropdown-menu {
    border-radius: 0.375rem;
    border: 1px solid rgba(0, 0, 0, 0.175);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.175);
}

.dropdown-item {
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #1e2125;
    background-color: #e9ecef;
}

/* Modal improvements */
.modal-content {
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.175);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: calc(0.5rem - 1px);
    border-top-right-radius: calc(0.5rem - 1px);
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-bottom-right-radius: calc(0.5rem - 1px);
    border-bottom-left-radius: calc(0.5rem - 1px);
}

/* Sidebar improvements */
.sidebar .nav-link {
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Alert improvements */
.alert {
    border-radius: 0.375rem;
    border: 1px solid transparent;
}

/* Utility class additions for backward compatibility */
.mr-1 {
    margin-right: 0.25rem !important;
}

.mr-2 {
    margin-right: 0.5rem !important;
}

.mr-3 {
    margin-right: 1rem !important;
}

.mr-4 {
    margin-right: 1.5rem !important;
}

.mr-5 {
    margin-right: 3rem !important;
}

.ml-1 {
    margin-left: 0.25rem !important;
}

.ml-2 {
    margin-left: 0.5rem !important;
}

.ml-3 {
    margin-left: 1rem !important;
}

.ml-4 {
    margin-left: 1.5rem !important;
}

.ml-5 {
    margin-left: 3rem !important;
}

.pr-1 {
    padding-right: 0.25rem !important;
}

.pr-2 {
    padding-right: 0.5rem !important;
}

.pr-3 {
    padding-right: 1rem !important;
}

.pr-4 {
    padding-right: 1.5rem !important;
}

.pr-5 {
    padding-right: 3rem !important;
}

.pl-1 {
    padding-left: 0.25rem !important;
}

.pl-2 {
    padding-left: 0.5rem !important;
}

.pl-3 {
    padding-left: 1rem !important;
}

.pl-4 {
    padding-left: 1.5rem !important;
}

.pl-5 {
    padding-left: 3rem !important;
}

.float-left {
    float: left !important;
}

.float-right {
    float: right !important;
}

/* Font weight compatibility */
.font-weight-bold {
    font-weight: 700 !important;
}

.font-weight-normal {
    font-weight: 400 !important;
}

.font-weight-light {
    font-weight: 300 !important;
}

/* Title shadow effect for headers */
.title-shadow {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Ensure box-shadow class still works */
.box-shadow {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Additional responsive improvements */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Print styles for better compatibility */
@media print {

    .btn,
    .dropdown,
    .nav,
    .sidebar {
        display: none !important;
    }

    .modal {
        position: static !important;
        display: block !important;
    }

    .modal-dialog {
        margin: 0 !important;
        max-width: none !important;
    }
}