/* 
 * Bootstrap Compatibility Layer for Pessel Theme
 * This file ensures Pessel theme works with Bootstrap without conflicts
 */

/* Reset some Pessel theme overrides that conflict with Bootstrap */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1050 !important;
    display: none !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    outline: 0 !important;
}

.modal-dialog {
    position: relative !important;
    width: auto !important;
    margin: 0.5rem !important;
    pointer-events: none !important;
}

.modal-content {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    pointer-events: auto !important;
    background-color: #fff !important;
    background-clip: padding-box !important;
    border: 1px solid rgba(0,0,0,.2) !important;
    border-radius: 0.3rem !important;
    outline: 0 !important;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.15) !important;
}

.modal-header {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    padding: 1rem 1rem !important;
    border-bottom: 1px solid #dee2e6 !important;
    border-top-left-radius: calc(0.3rem - 1px) !important;
    border-top-right-radius: calc(0.3rem - 1px) !important;
}

.modal-body {
    position: relative !important;
    flex: 1 1 auto !important;
    padding: 1rem !important;
}

.modal-footer {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0.75rem !important;
    border-top: 1px solid #dee2e6 !important;
    border-bottom-right-radius: calc(0.3rem - 1px) !important;
    border-bottom-left-radius: calc(0.3rem - 1px) !important;
}

/* Bootstrap Nav Tabs Compatibility */
.nav {
    display: flex !important;
    flex-wrap: wrap !important;
    padding-left: 0 !important;
    margin-bottom: 0 !important;
    list-style: none !important;
}

.nav-tabs {
    border-bottom: 1px solid #dee2e6 !important;
}

.nav-tabs .nav-item {
    margin-bottom: -1px !important;
}

.nav-tabs .nav-link {
    border: 1px solid transparent !important;
    border-top-left-radius: 0.25rem !important;
    border-top-right-radius: 0.25rem !important;
    background-color: transparent !important;
    color: #495057 !important;
    padding: 0.5rem 1rem !important;
    text-decoration: none !important;
}

.nav-tabs .nav-link:hover {
    border-color: #e9ecef #e9ecef #dee2e6 !important;
}

.nav-tabs .nav-link.active {
    color: #495057 !important;
    background-color: #fff !important;
    border-color: #dee2e6 #dee2e6 #fff !important;
}

/* Tab Content */
.tab-content > .tab-pane {
    display: none !important;
}

.tab-content > .active {
    display: block !important;
}

/* Bootstrap Button Compatibility */
.btn {
    display: inline-block !important;
    font-weight: 400 !important;
    text-align: center !important;
    vertical-align: middle !important;
    user-select: none !important;
    border: 1px solid transparent !important;
    padding: 0.375rem 0.75rem !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    border-radius: 0.25rem !important;
    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 !important;
}

.btn-primary {
    color: #fff !important;
    background-color: #007bff !important;
    border-color: #007bff !important;
}

.btn-primary:hover {
    color: #fff !important;
    background-color: #0069d9 !important;
    border-color: #0062cc !important;
}

.btn-secondary {
    color: #fff !important;
    background-color: #6c757d !important;
    border-color: #6c757d !important;
}

.btn-secondary:hover {
    color: #fff !important;
    background-color: #5a6268 !important;
    border-color: #545b62 !important;
}

/* Table Compatibility */
.table {
    width: 100% !important;
    margin-bottom: 1rem !important;
    color: #212529 !important;
    background-color: transparent !important;
}

.table th,
.table td {
    padding: 0.75rem !important;
    vertical-align: top !important;
    border-top: 1px solid #dee2e6 !important;
}

.table thead th {
    vertical-align: bottom !important;
    border-bottom: 2px solid #dee2e6 !important;
}

.table-bordered {
    border: 1px solid #dee2e6 !important;
}

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

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

/* Ensure Bootstrap utilities work */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.mt-3 { margin-top: 1rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Fade animation for tabs */
.fade {
    transition: opacity 0.15s linear !important;
}

.fade:not(.show) {
    opacity: 0 !important;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1040 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #000 !important;
}

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

.modal-backdrop.show {
    opacity: 0.5 !important;
}

/* Show class for Bootstrap components */
.show {
    display: block !important;
    opacity: 1 !important;
}

/* Pessel Theme Integration - Make Bootstrap components match Pessel style */
.modal-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%) !important;
    color: white !important;
    border-bottom: none !important;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%) !important;
    color: white !important;
    border-color: #0ea5e9 !important;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%) !important;
    border: none !important;
    border-radius: 8px !important;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0c94d0 0%, #0ea5e9 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3) !important;
}