<style>
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    display: flex;
    flex-direction: column;
}

.content {
    flex: 1;
}

footer {
    flex-shrink: 0;
    text-align: center;
    background-color: #333;
    color: #fff;
    padding: 20px 0;
}

/* Styles for Navigation Bar */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    color: #080000;
    padding: 5px;
    position: relative;
    box-shadow: 0 4px 8px 0 #0000FF;
}

.logo {
    position: relative;
    display: flex;
    align-items: center;
}

.logo img {
    width: 80px;
    height: 85px;
    margin-right: 10px;
}

.logo h1 {
    margin-top: 5px;
    font-family: Arial, sans-serif; /* Fallback for Buffalo font */
    font-size: 25px;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001; /* Added z-index */
}

.line {
    width: 25px;
    height: 3px;
    background-color: #ab0606e8;
    margin: 3px 0;
    transition: all 0.3s ease;
}

.nav-links {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
}

.nav-links li {
    margin-right: 10px;
    position: relative;
    font-size: 16px;
}

.nav-links a {
    text-decoration: none;
    color: #070000;
    padding: 10px;
    display: block;
    font-size: 14px;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #0000FF;
}

/* Remove bullets from submenus */
.sub-menu, .nested-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Submenu Styles with transitions - Combined approach */
.sub-menu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    left: 0;
    top: 100%;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    transition: max-height 0.5s ease, opacity 0.4s ease;
    z-index: 1000;
    width: 220px;
    border-radius: 4px;
}

/* Each submenu item */
.sub-menu li {
    border-bottom: 1px solid #eee;
    width: 100%;
}
.sub-menu li:last-child {
    border-bottom: none;
}

/* When hovering parent, reveal submenu with smooth transition */
.nav-links li:hover > .sub-menu {
    max-height: 600px;
    opacity: 1;
}

/* Nested submenu positioning with transitions */
.nested-submenu {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    left: 100%;
    top: 0;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    transition: max-height 0.5s ease, opacity 0.4s ease;
    z-index: 1001;
    width: 220px;
    border-radius: 4px;
}

/* Show nested submenu only when hovering over the parent submenu item */
.sub-menu li:hover > .nested-submenu {
    max-height: 600px;
    opacity: 1;
}

/* Tablet View Optimization (769px to 1024px) */
@media screen and (max-width: 1024px) and (min-width: 769px) {
    .logo h1 {
        font-size: 20px;
    }
    
    .nav-links li {
        margin-right: 5px;
    }
    
    .nav-links a {
        padding: 8px;
        font-size: 13px;
    }
    
    .sub-menu, .nested-submenu {
        width: 200px;
    }
}

@media screen and (max-width: 768px) {
    .nav-links {
        display: none;
        flex-direction: column;
        background-color: #ffffff; /* White background for mobile */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        z-index: 1000;
        box-shadow: 0 5px 10px rgba(0,0,0,0.1);
        padding: 10px 0; /* Added padding */
    }

    .nav-links.active {
        display: flex;
    }

    .menu-toggle {
        display: flex;
        cursor: pointer;
        margin-top: 10px;
        background-color: rgba(235, 235, 235, 0.8);
        padding: 10px;
        z-index: 1001; /* Added z-index */
    }

    /* Hamburger animation */
    .menu-toggle.active .line:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .menu-toggle.active .line:nth-child(2) {
        opacity: 0;
    }

    .menu-toggle.active .line:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .nav-links li {
        margin-right: 0;
        width: 100%;
        border-bottom: 1px solid #f0f0f0;
        background-color: #ffffff; /* Ensure white background */
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    /* Submenus for mobile */
    .sub-menu, .nested-submenu {
        position: static;
        width: 100%;
        box-shadow: none;
        background: #f9f9f9;
        transition: max-height 0.5s ease;
        max-height: 0;
        padding-left: 20px; /* Indent submenus */
    }

    .sub-menu.active, .nested-submenu.active {
        max-height: 500px;
    }

    .nested-submenu {
        background: #f0f0f0;
    }
    
    /* Ensure all direct nav items have white background */
    .nav-links > li {
        background-color: #ffffff;
    }
    
    /* Add space for logo when menu toggle is visible */
    .logo {
        width: 100%;
        padding-right: 60px;
    }
}

/* Small Mobile View (max-width: 480px) */
@media screen and (max-width: 480px) {
    .logo h1 {
        font-size: 16px;
    }
    
    .logo img {
        width: 60px;
        height: 65px;
    }
}
</style>