/* Reset all margin/padding */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    font-family: Arial, sans-serif;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal scrolling */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* Header */
.header-bar {
   width: 100%;
   z-index: 1001;
   left: 0;
   margin: 0;
   padding-left: 0;
}

/* Main wrapper */
#main-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    padding: 0;
    margin: 0;
    width: 100%;
    left: 0;
}

/* Main content */
#main-content {
    flex: 1;
    padding: 2em;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f9f9f9;
}

#main-content > * {
    max-width: 100%;
    width: 100%;
}

/* Footer */
#footer {
    width: 100%;
    background-color: #222;
    color: white;
    text-align: right;
    padding: 1em 3em;
    font-size: 0.8em;
    z-index: 1001;
    position: relative;
}

/* Mobile-specific fixes */
@media screen and (max-width: 768px) {
    /* Prevent right side overflow */
    body, html, #main-wrapper, #main-content, #footer, .header-bar {
        max-width: 100vw;
        width: 100%;
        overflow-x: hidden;
    }
    
    /* Reduce padding on main content for mobile */
    #main-content {
        padding: 1em;
    }
    
    /* Fix footer on mobile */
    #footer {
        padding: 1em;
    }
    
    /* Fix sidebar on mobile */
    #sidebar {
        width: 100% !important;
        max-width: 100vw;
    }
    
    /* Force anything that might overflow to stay contained */
    img, video, iframe, table, pre, code {
        max-width: 100% !important;
        height: auto !important;
    }
}
