/* Layout Fix - Ensure sidebar and main content are side by side */

/* Reset any conflicting styles from Bootstrap or other frameworks */
body {
    display: block !important;
    flex-direction: unset !important;
}

.container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ensure sidebar stays fixed on left - below header */
.sidebar {
    position: fixed !important;
    left: 0 !important;
    top: 56px !important;
    bottom: 0 !important;
    width: 250px !important;
    z-index: 1020 !important;
    background-color: #212529 !important;
    height: calc(100vh - 56px) !important;
    overflow-y: auto !important;
    overflow-x: visible !important;
    padding-top: 0 !important;
}

.sidebar-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    background-color: rgba(0, 0, 0, 0.2) !important;
    margin-top: 0 !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.sidebar.collapsed {
    width: 70px !important;
}

/* Ensure sidebar toggle button is always on top of right-side sliders */
.sidebar-toggle-btn {
    position: fixed !important;
    left: 235px !important;
    top: 66px !important;
    z-index: 1060 !important;
    cursor: pointer !important;
}

.sidebar.collapsed ~ .sidebar-toggle-btn,
.sidebar.collapsed .sidebar-toggle-btn {
    left: 55px !important;
}

/* Ensure main content is to the right - CRITICAL */
.main-content {
    margin-left: 250px !important;
    width: calc(100% - 250px) !important;
    position: relative !important;
    display: block !important;
    float: none !important;
    clear: none !important;
    margin-top: 0 !important;
    padding: 25px 25px 20px 25px !important;
    padding-top: 25px !important;
    min-height: calc(100vh - 56px) !important;
    box-sizing: border-box !important;
    max-width: none !important;
    z-index: 1 !important;
}

/* Ensure proper spacing between header and content */
.main-content > h2,
.main-content > .d-flex:first-child {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
}

.main-content > .card:first-child {
    margin-top: 0 !important;
}

body:has(.sidebar.collapsed) .main-content,
.sidebar.collapsed ~ .main-content {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

/* Footer alignment */
footer {
    margin-left: 250px !important;
    width: calc(100% - 250px) !important;
    clear: both !important;
    position: relative !important;
}

body:has(.sidebar.collapsed) footer {
    margin-left: 70px !important;
    width: calc(100% - 70px) !important;
}

/* Payment Details Slider - Right Side Panel */
.payment-details-slider {
    position: fixed;
    top: 56px;
    right: -450px;
    width: 450px;
    height: calc(100vh - 56px);
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.payment-details-slider.show {
    right: 0;
}

.payment-details-slider .slider-header {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.payment-details-slider .slider-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.payment-details-slider .slider-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 18px;
    padding: 0;
}

.payment-details-slider .slider-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.payment-details-slider .slider-body {
    padding: 20px;
}

.payment-details-slider .slider-footer {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Overlay for slider */
.slider-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.slider-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 15px !important;
    }
    
    footer {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .payment-details-slider {
        width: 100%;
        right: -100%;
    }
}

