/* --- CORE LOGIC: HIDING/SHOWING --- */
#menu ul {
    display: none !important;
}
/* Hide all by default */

/* Only show when container has .is-open class */
#menuwrapper.is-open #menu > li:hover > ul {
    display: block !important;
}

#menuwrapper.is-open .ui-menu-item:hover > ul {
    display: block !important;
}
#menuwrapper {
    display: inline-flex;
    min-width: min-content;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    position: fixed;
    z-index: 2;
}

#menu {
    /* Ensure the menu itself doesn't try to grow */
    flex-grow: 0;
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border: none;
}


.ui-menu-item {
    position: relative;
    list-style: none;
}

/* First level dropdown (Down) */
#menu > li > ul {
    position: absolute;
    top: 100% !important;
    left: 0 !important;
    width: 240px;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 5px 0 !important;
}

/* Sub-levels (Right) */
#menu ul ul {
    top: 0 !important;
    left: 100% !important;
    margin-left: 2px;
}

/* --- STYLING --- */
.ui-menu-icon {
    display: none !important;
}
/* Kill default arrows */

.ui-menu-item-wrapper {
    display: flex !important;
    align-items: center;
    padding: 8px 15px !important;
    border: 1px solid transparent !important;
    font-family: Arial, sans-serif;
    font-size: 14px;
    cursor: pointer;
    background: white;
}

/* Google Blue Hover */
.ui-state-active, .ui-state-focus {
    background: #e8f0fe !important;
    color: #1967d2 !important;
    border: 1px solid transparent !important;
    margin: 0 !important;
}

.ui-menu-item i {
    width: 20px;
    margin-right: 10px;
    color: #5f6368;
    pointer-events: none;
}

.shortcut {
    margin-left: auto;
    color: #70757a;
    font-size: 11px;
    pointer-events: none;
}

/* Submenu Caret (Pure CSS) */
.ui-menu-item:has(ul) > .ui-menu-item-wrapper::after {
    content: "\f0da";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-left: auto;
    padding-left: 10px;
    font-size: 12px;
}

/* Force-remove the highlight when the menu isn't open */
#menuwrapper:not(.is-open) #menu > li > div {
    background-color: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    white-space: nowrap;
}

/* Ensure the top level only highlights on hover if we want it to */
#menu > li > div:hover {
    background-color: #f1f3f4;
}

#menuwrapper .apptitle {
    padding: 5px 15px !important;
    font-size: 20px;
    font-family: Arial, sans-serif;
    text-align: right;
    float: right;
    margin-left: 20px;
    font-weight: 700;
    outline: 2px solid black;
}