html, body {
    height: 100%;
    margin: 0;
    font-family: sans-serif;
    font-size: 0.9rem;
    color: white;
}

html, body, header, footer {
    background: #333;
}

.container, header {
    display: flex;
}

.product-column {
    text-align: right;
}

.product-input {
    height: 1.5rem;
    width: 4.5rem;
    padding: 0.5rem;
}

.product-label {
    padding: 1rem;
    font-size: 0.8rem;
}

.product-box {
    padding-left: 0.2rem;
    font-size: 0.8rem;
}

#submitBtn:disabled { background: #ccc; cursor: not-allowed; }
#submitBtn { background: #333; color: white; border: none; cursor: pointer; font-size: 1rem; margin: 8px 0; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }

.info-row {
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.info-label {
    padding-right: 1rem;
}

.container {
    flex-direction: column;
    height: 100%;
}

header {
    position: fixed;
    z-index: 20;
    justify-content: space-between;
}

header, main, footer {
    width: 100%;
    align-items: center;
    padding: 0.5rem;
}

main {
    z-index: 10;
    background: #fff;
    color: #000;
    flex: 1;
    overflow-y: auto;
}

footer {
    position: fixed;
    bottom: 0;
    z-index: 20;
    text-align: center;
}

/* Basic Reset and Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

ul {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Header and Navigation Bar */
.page-header {
    background-color: #333;
    color: white;
    padding: 10px 20px;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.menu-bar {
    display: flex;
}

.menu-bar li {
    position: relative;
}

.menu-bar > li > a, .dropdown-btn {
    display: block;
    padding: 5px;
    color: white;
    background-color: #333;
    border: none;
    border-right: 1px solid dimgrey;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.menu-bar a:hover, .menu-bar button:hover, .menu-bar a:focus, .menu-bar button:focus {
    background-color: #555;
}

/* Submenu Styling */
.submenu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #333;
    min-width: 140px;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.submenu .submenu {
    top: 0;
    left: 100%;
}

/* Show submenu on hover for mouse users (desktop) */
.has-submenu:hover > .submenu, 
.has-submenu:focus-within > .submenu {
    display: block;
}

.submenu li a {
    width: 100%;
    height: 100%;
    display: block;
    padding: 5px;
}

.submenu li:hover {
    background-color: #555;
}

/* FIX: Ensure JS-toggled menus always display correctly */
.submenu.is-open {
    display: block !important;
}

/* Responsive/Mobile Styles */
@media (max-width: 768px) {
    #menu-toggle {
        display: block; /* Show hamburger on mobile */
    }

    .menu-bar {
        display: none; /* Hide main menu by default on mobile */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 44px; /* Adjust based on header height */
        left: 0;
        background-color: #333;
        max-height: calc(100vh - 125px); /* Fill the rest of the screen */
        overflow-y: auto;               /* Allow vertical scrolling */
        -webkit-overflow-scrolling: touch;
    }
    
    .menu-bar.is-open {
        display: flex; /* Show when toggled open */
    }

    .menu-bar li {
        border-bottom: 1px solid #444;
        width: 100%;
    }
    
    /* Prevent hover effects from triggering on mobile */
    .has-submenu:hover > .submenu, 
    .has-submenu:focus-within > .submenu {
        display: none; 
    }

    .submenu, .submenu .submenu {
        position: relative; /* Stacks submenus vertically on mobile */
        top: auto;
        left: auto;
        background-color: #333;
        box-shadow: none;
        padding-left: 20px;
    }
    
    footer {
        font-size: 0.7rem;
    }
}
