/**
 * Sticky Footer V2 - More aggressive approach for SP Page Builder
 * This version accounts for SP Page Builder's wrapper elements
 */

/* Ensure full height hierarchy */
html {
    height: 100%;
}

body.site {
    min-height: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* SP Page Builder adds its own wrappers */
body.site > .body-wrapper,
body.site > .offcanvas-init {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

/* Inner wrapper needs to grow */
.body-innerwrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Main content area should expand */
#sp-main-body,
.com-sppagebuilder,
.sppb-container-inner {
    flex: 1 0 auto;
}

/* Force footer to bottom */
#sp-footer {
    flex-shrink: 0;
    margin-top: auto !important;
    width: 100%;
}

/* Alternative method using min-height calculation */
@supports not (display: flex) {
    .body-innerwrapper {
        min-height: calc(100vh - 200px); /* Adjust based on your header/footer height */
    }
}

/* Ensure proper z-index stacking */
#sp-header,
#sp-header.header-sticky {
    position: relative;
    z-index: 999;
}

#sp-main-body {
    position: relative;
    z-index: 1;
}

#sp-footer {
    position: relative;
    z-index: 1;
}

/* Debug helper - uncomment to see element boundaries */
/*
body * {
    border: 1px solid rgba(255,0,0,0.1) !important;
}
*/