/* Bootstrap 5 Migration Fixes */
/* Add this file to fix layout issues after BS5 upgrade */

/* Fix for navbar styling */
.navbar {
    border-bottom: solid 2px #eee;
}

/* Fix for Quill editor overflow */
#quill-editor {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.ql-container {
    font-size: 14px;
}

.ql-editor {
    min-height: 150px;
}

/* Fix for bootstrap-select with Bootstrap 5 */
.bootstrap-select > .dropdown-toggle {
    width: 100%;
    padding: 6px 12px;
    font-size: 14px;
}

.bootstrap-select .dropdown-menu {
    font-size: 14px;
}

.bootstrap-select > .dropdown-toggle.bs-placeholder,
.bootstrap-select > .dropdown-toggle.bs-placeholder:hover,
.bootstrap-select > .dropdown-toggle.bs-placeholder:focus,
.bootstrap-select > .dropdown-toggle.bs-placeholder:active {
    color: #6c757d;
}

/* Fix for container gutters - Bootstrap 5 increased padding */
.container,
.container-fluid,
.container-sm,
.container-md,
.container-lg,
.container-xl,
.container-xxl {
    padding-right: 15px;
    padding-left: 15px;
}

/* Fix for font size - Bootstrap 5 changed from 14px to 16px base */
html {
    font-size: 14px; /* Bootstrap 3 default */
}

body {
    font-size: 14px;
    line-height: 1.42857143; /* Bootstrap 3 default */
}

/* Restore Bootstrap 3 heading sizes */
h1 {
    font-size: 36px;
}

h2 {
    font-size: 30px;
}

h3 {
    font-size: 24px;
}

h4 {
    font-size: 18px;
}

h5 {
    font-size: 14px;
}

h6 {
    font-size: 12px;
}

/* Fix button font sizes */
.btn {
    font-size: 14px;
    padding: 6px 12px;
}

.btn-sm {
    font-size: 12px;
    padding: 5px 10px;
}

.btn-lg {
    font-size: 18px;
    padding: 10px 16px;
}

/* Fix form control font sizes */
.form-control {
    font-size: 14px;
    height: 34px; /* Bootstrap 3 default */
    padding: 6px 12px;
}

.form-control-sm {
    font-size: 12px;
    height: 30px;
    padding: 5px 10px;
}

.form-control-lg {
    font-size: 18px;
    height: 46px;
    padding: 10px 16px;
}

/* Fix input-group sizing */
.input-group-text {
    font-size: 14px;
    padding: 6px 12px;
}

/* Fix table font sizes */
.table {
    font-size: 14px;
}

/* Fix navbar font sizes */
.navbar {
    font-size: 14px;
}

/* Fix breadcrumb font sizes */
.breadcrumb {
    font-size: 14px;
}

/* Fix alert font sizes */
.alert {
    font-size: 14px;
}

/* Fix badge font sizes */
.badge {
    font-size: 12px;
}

/* Fix card font sizes */
.card {
    font-size: 14px;
}

/* Fix for form-horizontal spacing (removed in BS5) */
.form-horizontal .row {
    margin-bottom: 1rem;
}

/* Fix for input groups with icons */
.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
}

/* Fix for table-condensed (removed in BS5) */
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
    padding: 0.3rem;
}

/* Fix for breadcrumb active item (BS5 changed structure) */
.breadcrumb .active {
    color: #6c757d;
}

/* Fix for close button (BS5 changed to btn-close) */
.btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: 0.25em;
    color: #000;
    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.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
    border: 0;
    border-radius: 0.25rem;
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 0.75;
}

/* Fix for badge (BS5 requires bg-* classes) */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.25rem;
}

.badge:empty {
    display: none;
}

/* Fix for label spacing */
label {
    margin-bottom: 0.5rem;
}

/* Fix for form-control spacing */
.form-control {
    margin-bottom: 0;
}

/* Fix for alert spacing */
.alert {
    margin-bottom: 1rem;
}

/* Fix for panel-like cards */
.card {
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 0.75rem 1.25rem;
    background-color: #f7f7f9;
    border-bottom: 1px solid rgba(0,0,0,.125);
}

.card-body {
    padding: 1.25rem;
}

/* Fix for media objects (removed in BS5) */
.media {
    display: flex;
    align-items: flex-start;
}

.media-body {
    flex: 1;
}

.media-left {
    margin-right: 1rem;
}

/* Fix for list-style-none (removed in BS5) */
.list-style-none {
    padding-left: 0;
    list-style: none;
}

/* Fix for sr-only (renamed to visually-hidden in BS5) */
.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;
}

/* Fix for modal dialog centering */
.modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
}

/* Fix for checkbox spacing in forms */
.checkbox {
    margin-bottom: 1rem;
}

.checkbox label {
    display: inline-block;
    cursor: pointer;
}

/* Fix for progress bar */
.progress {
    height: 1rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: #e9ecef;
    border-radius: 0.25rem;
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    background-color: #0d6efd;
    transition: width 0.6s ease;
}

.progress-bar-striped {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position-x: 1rem;
    }
}

/* Fix for flatpickr integration with Bootstrap */
.flatpickr-calendar {
    z-index: 1056 !important; /* Above modals */
}

/* Fix for input-group with flatpickr */
.input-group .flatpickr-input {
    border-radius: 0.25rem 0 0 0.25rem;
}

/* Fix for bootstrap-table search box */
.bootstrap-table .search input {
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

/* Hide the search submit button (not needed with live search) */
.bootstrap-table .fixed-table-toolbar .search button,
.fixed-table-toolbar .search button,
.search button[type="submit"] {
    display: none !important;
}

/* Fix Bootstrap Table buttons - replace btn-default with proper styling */
.bootstrap-table .btn-default,
.fixed-table-toolbar .btn-default {
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.bootstrap-table .btn-default:hover,
.fixed-table-toolbar .btn-default:hover {
    color: #212529;
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

/* Replace glyphicon icons with Font Awesome for Bootstrap Table */
.bootstrap-table .glyphicon-refresh::before,
.bootstrap-table .icon-refresh::before {
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free", "FontAwesome";
    content: "\f021";
    font-weight: 900;
}

.bootstrap-table .glyphicon,
.bootstrap-table .icon-refresh {
    display: inline-block;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}

/* Hide glyphicon base styles since we're replacing them */
.bootstrap-table .glyphicon {
    font-family: "Font Awesome 5 Free", "Font Awesome 6 Free", "FontAwesome" !important;
}

/* Fix for bootstrap-table toolbar buttons */
.bootstrap-table .fixed-table-toolbar .columns button,
.bootstrap-table .fixed-table-toolbar button[name="refresh"] {
    padding: 0.375rem 0.75rem;
    font-size: 14px;
    line-height: 1.5;
    color: #212529;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
}

.bootstrap-table .fixed-table-toolbar .columns button:hover,
.bootstrap-table .fixed-table-toolbar button[name="refresh"]:hover {
    background-color: #e2e6ea;
    border-color: #adb5bd;
}

/* Fix for bottom-padding utility (custom class) */
.bottom-padding {
    margin-bottom: 1rem;
}

/* Fix for card border colors */
.card.border-primary {
    border-color: #0d6efd !important;
}

.card.border-info {
    border-color: #0dcaf0 !important;
}

/* Fix for headline custom class */
.headline h1 {
    margin-bottom: 0;
}

/* Fix for form-horizontal (removed in BS5) */
.form-horizontal .mb-3 {
    clear: both;
}

/* Responsive table fix */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for text-danger in validation */
.text-danger {
    color: #dc3545 !important;
}

/* Fix for alert-dismissible */
.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
}
