/* ClassicRO EO theme layout fixes.
 * Kept separate from the legacy theme stylesheet so these overrides are easy
 * to maintain without rewriting the original theme rules.
 */

#RO_TETE_DE_PAGE {
    position: relative;
}

/*
 * Desktop navigation: exactly seven items participate in the grid.
 * The legacy mobile MENU control must not consume an eighth grid cell.
 */
@media (min-width: 769px) {
    #RO_MENU {
        position: relative;
        z-index: 1000;
        width: 100%;
        max-width: 1004px;
        height: 54px;
        margin: 8px auto 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr)) 240px repeat(3, minmax(0, 1fr));
        align-items: start;
        list-style: none;
    }

    /* Never allow the mobile trigger to participate in the desktop grid. */
    #RO_MENU > #RO_MENU_MOBILE {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    /*
     * Remove the legacy #RO_MENU li { width:100px; } sizing entirely.
     * The six ordinary items are sized by the grid, while HOME owns the fixed
     * centre column so it stays geometrically centred over its artwork.
     */
    #RO_MENU > li:not(#RO_MENU_MOBILE) {
        position: relative;
        z-index: 1001;
        display: block;
        width: auto !important;
        min-width: 0 !important;
        height: 54px !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #RO_MENU > li > a {
        position: relative;
        z-index: 1002;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        width: 100%;
        height: 54px;
        padding: 15px 5px 0;
        white-space: nowrap;
        text-align: center;
        text-decoration: none;
        cursor: pointer;
        pointer-events: auto;
    }

    #RO_MENU > li > a:hover {
        text-decoration: underline;
    }

    /* Preserve the original 240px highlighted HOME treatment in the centre. */
    #RO_MENU > #RO_MENU_PREMIUM {
        width: auto !important;
        min-width: 0 !important;
        padding: 0 !important;
        background-position: center 8px !important;
    }

    #RO_MENU_PREMIUM > a {
        width: 100% !important;
        padding: 10px 0 0 !important;
        text-align: center;
        font-size: 18px;
    }
}

/*
 * On small screens hand control back to the EO theme's original mobile menu
 * rules and script. These declarations only ensure the mobile trigger is not
 * accidentally suppressed by a desktop override.
 */
@media (max-width: 768px) {
    #RO_MENU_MOBILE {
        display: block;
    }
}

/*
 * The original carousel is a 1005x268 absolute click target. Even with a
 * lower z-index, it has historically intercepted clicks over the navigation
 * in some browser/layout combinations. HOME already has its own real link,
 * so the decorative carousel layer should not receive pointer events.
 */
#RO_INTERFACE {
    z-index: 1;
}

#RO_CARROUSEL {
    z-index: 1;
    pointer-events: none !important;
}

/*
 * Admin tools belong to the page, not the browser viewport. The legacy
 * theme pinned this menu to the right with position:fixed and a large
 * negative margin, making lower entries unreachable on shorter displays.
 */
#ro_adminmenu {
    display: block;
    position: static;
    right: auto;
    width: 100%;
    min-height: 0;
    margin: 0 0 22px;
    clear: both;
    text-align: left;
}

#ro_adminmenu .list-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border: 1px solid #e7e7e7;
    background: rgba(255, 255, 255, 0.94);
}

#ro_adminmenu .list-group > .list-group-item {
    width: auto;
    flex: 0 0 auto;
    padding: 9px 13px !important;
    border: 1px solid #dedede;
    border-radius: 4px !important;
    margin: 0;
}

#ro_adminmenu .ro-adminmenu-title {
    flex-basis: 100% !important;
    border: 0 !important;
    border-bottom: 1px solid #e7e7e7 !important;
    border-radius: 0 !important;
    padding: 2px 3px 9px !important;
    background: transparent;
    font-size: 14px;
}

@media (max-width: 1050px) {
    #ro_adminmenu .list-group > .list-group-item {
        flex: 1 1 145px;
        text-align: center;
    }

    #ro_adminmenu .ro-adminmenu-title {
        flex-basis: 100% !important;
        text-align: left;
    }
}
