/* =============================================================================
   Modern Sticky Footer Layout with Flexbox
   Compatible with Bootstrap 5.3.8 and modern CSS standards
   ============================================================================= */

/* Modern flexbox sticky footer approach */
html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Wrapper for form element to maintain flex layout */
#form1 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Main content area grows to fill available space */
main {
    flex: 1 0 auto;
    padding-bottom: 2rem; /* Add some spacing before footer */
}

/* Footer always stays at bottom */
footer,
.site-footer {
    flex-shrink: 0;
    margin-top: auto !important;
    width: 100%;
    position: relative;
    bottom: 0;
}

/* Ensure footer has proper styling */
.site-footer {
    background-color: #212529 !important; /* Bootstrap dark */
    color: #f8f9fa !important;
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

/* Remove legacy absolute positioning approach */
#footer {
    position: static;
    height: auto;
    background-color: transparent;
}

/* Modern container styles with CSS custom properties */
.container {
    --container-padding-x: 1rem;
    padding-left: var(--container-padding-x);
    padding-right: var(--container-padding-x);
}

/* Improved text styling */
.text-muted {
    margin: 1.25rem 0;
    line-height: 1.6;
}

/* Enhanced code styling */
code {
    font-size: 0.875em;
    font-weight: 500;
    background-color: var(--bs-gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

/* Modern focus styles for better accessibility */
code:focus {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Responsive container padding */
@media (min-width: 576px) {
    .container {
        --container-padding-x: 1.5rem;
    }
}

@media (min-width: 768px) {
    .container {
        --container-padding-x: 2rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    code {
        border: 1px solid var(--bs-border-color);
    }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Additional sticky footer support for edge cases */
.sticky-footer {
    position: relative;
    bottom: 0;
    width: 100%;
    margin-top: auto !important;
}

/* Ensure proper spacing when content is minimal */
body > form,
body > #form1 {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Fix for any wrapper divs */
.wrapper,
.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
