/*
 * menu.css
 * Custom styles for the fixed top navigation bar.
 */

/* Global box-sizing for consistent layout */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Remove default body margin */
body {
    margin: 0;
}

/* Main navigation bar styling */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 45px;
    background-color: #F8F8F8;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
}

/* Style the main menu unordered list */
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
    height: 100%;
}

/* Style each main menu list item */
nav ul li {
    position: relative;
    height: 100%;
}

/* Style the links within the menu */
nav ul li a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 15px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.3s ease;
    border-radius: 8px;
}

/* Hover effect for main menu links */
nav ul li a:hover {
    background-color: rgba(255, 255, 255, 0.4);
    color: #000;
    transform: translateY(-2px);
}

/* Submenu styling */
.submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    background-color: lightgrey;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    min-width: 150px;
    padding: 8px 0;
    border-radius: 8px;
    z-index: 999;
    /* This next line is key: ensures the submenu grows with content */
    height: auto;
}

/* Show the submenu when the parent list item is hovered over */
.has-submenu:hover > .submenu {
    display: block;
}

/* Style each list item within the submenu */
.submenu li {
    padding: 0;
    margin: 0;
}

/* Style the links within the submenu to fill their parent container */
.submenu li a {
    /* The next line is the most important change: it makes the link a block element */
    display: block;
    width: 100%;
    padding: 10px 20px;
    transition: background-color 0.2s ease;
    border-radius: 0;
    text-decoration: none;
    color: #333;
}

/* Hover effect for submenu links */
.submenu li a:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: none; /* No lift effect on submenu items */
}