/**
 * Bootstrap Grid Compatibility CSS
 * Bridges old float-based column classes with new Bootstrap 5 grid system
 * Ensures backward compatibility while maintaining responsive design
 */

/* ========================================
   OLD CLASS TO NEW BOOTSTRAP MAPPING
   ======================================== */

/* Legacy column classes are maintained in main.css for styling */
/* This file ensures they work with Bootstrap's responsive grid */

/* Mobile-first: All columns stack on mobile */
@media (max-width: 991.98px) {
    /* Override old float-based widths on mobile/tablet */
    .leftSideColumn,
    .rightSideContent,
    .rightSideColumn {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Desktop: Maintain column structure with explicit widths */
@media (min-width: 992px) {
    /* Left sidebar on desktop - 20% */
    .leftSideColumn {
        float: none !important;
        width: 20% !important;
        flex: 0 0 20% !important;
    }

    /* Main content on desktop - 60% */
    .rightSideContent {
        float: none !important;
        width: 60% !important;
        flex: 0 0 60% !important;
    }

    /* Right sidebar on desktop - 20% */
    .rightSideColumn {
        float: none !important;
        width: 20% !important;
        flex: 0 0 20% !important;
    }
}

/* ========================================
   SIDEBAR MENU ADJUSTMENTS
   ======================================== */

/* Ensure sidebar menus work responsively */
.leftSideColumn .sideMenu {
    width: 100%;
}

@media (max-width: 991.98px) {
    .leftSideColumn .sideMenu {
        margin-bottom: 20px;
    }

    /* Stack dropdown menus below on mobile instead of to the right */
    .leftSideColumn .sideMenu nav li.parent .rightSideDropdown {
        position: static !important;
        width: 100% !important;
        max-height: none !important;
        margin-top: 5px;
    }
}

/* ========================================
   CONTENT BOX RESPONSIVE
   ======================================== */

.contentBox {
    width: 100%;
}

@media (max-width: 575.98px) {
    .contentBox {
        padding: 15px;
        margin-bottom: 15px;
    }
}

@media (min-width: 576px) {
    .contentBox {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* ========================================
   CLEARFIX FOR LEGACY FLOATS
   ======================================== */

/* Clear floats where needed */
.clearfix::after,
.inner::after {
    content: "";
    display: table;
    clear: both;
}

/* ========================================
   INNER CONTAINER ADJUSTMENTS
   ======================================== */

/* The .inner class was used for container, now handled by Bootstrap */
.inner {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 575.98px) {
    .inner {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* ========================================
   RESPONSIVE UTILITY OVERRIDES
   ======================================== */

/* Ensure Bootstrap responsive utilities work */
@media (max-width: 991.98px) {
    /* Hide desktop-only content on mobile */
    .d-none.d-lg-block {
        display: none !important;
    }

    /* Show mobile-only content */
    .d-block.d-lg-none {
        display: block !important;
    }
}

@media (min-width: 992px) {
    /* Show desktop-only content */
    .d-none.d-lg-block {
        display: block !important;
    }

    /* Hide mobile-only content on desktop */
    .d-block.d-lg-none {
        display: none !important;
    }
}

/* ========================================
   FLEXBOX ALIGNMENT FOR COLUMNS
   ======================================== */

/* Ensure columns align properly in flex container */
aside,
section {
    display: block;
}

/* ========================================
   RESPONSIVE IMAGES IN COLUMNS
   ======================================== */

.leftSideColumn img,
.rightSideContent img,
.rightSideColumn img {
    max-width: 100%;
    height: auto;
}

/* ========================================
   MOBILE NAVIGATION ADJUSTMENTS
   ======================================== */

@media (max-width: 991.98px) {
    /* Make sidebar navigation touch-friendly */
    .leftSideColumn .sideMenu nav a {
        padding: 12px 10px !important;
        font-size: 14px;
    }

    .leftSideColumn .sideMenu h3 a {
        padding: 12px 10px 12px 35px !important;
    }

    /* Increase touch target size */
    .leftSideColumn .sideMenu nav li {
        min-height: 44px;
    }
}

/* ========================================
   BREADCRUMBS RESPONSIVE
   ======================================== */

.breadcrumb {
    margin-bottom: 1rem;
    padding: 0.75rem 0;
}

@media (max-width: 575.98px) {
    .breadcrumb {
        font-size: 12px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========================================
   SPACING ADJUSTMENTS
   ======================================== */

/* Ensure proper spacing between sections on mobile */
@media (max-width: 991.98px) {
    aside + section {
        margin-top: 0;
    }

    section + aside {
        margin-top: 0;
    }
}

/* ========================================
   Z-INDEX MANAGEMENT
   ======================================== */

/* Ensure dropdowns and overlays have proper z-index */
.leftSideColumn .sideMenu nav {
    z-index: 100;
}

.leftSideColumn .sideMenu nav li.parent .rightSideDropdown {
    z-index: 101;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .leftSideColumn,
    .rightSideColumn {
        display: none !important;
    }

    .rightSideContent {
        width: 100% !important;
    }
}
