/* Header Menu Extension - Structural Layout & Dimensions */

/* Connect headerbar directly to vinny-header-menu */
.headerbar {
    margin-bottom: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.vinny-header-menu {
    border-radius: 7px;
    padding: 0;
    margin-top: 0;
    margin-bottom: 6px;
    clear: both;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.vinny-header-menu .inner {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 0;
}

.vinny-header-menu .nav-main {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Desktop Header menu items */
.vinny-header-menu .header-menu-item {
    display: flex;
    align-items: stretch;
    position: relative;
    margin: 0;
    padding: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
}

.vinny-header-menu .header-menu-item:last-child {
    border-right: none;
}

.vinny-header-menu .header-menu-item > a.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 1.1em;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* First and Last Top-Level Item Border-Radius Alignment */
.vinny-header-menu .header-menu-item:first-child > a.nav-link {
    border-bottom-left-radius: 7px;
}

.vinny-header-menu .nav-main:last-child > .header-menu-item:last-child > a.nav-link {
    border-bottom-right-radius: 7px;
}

/* Custom Submenu Arrow Icon */
.vinny-header-menu .header-menu-item > a.nav-link i.menu-arrow {
    margin-left: 4px;
    font-size: 1em;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.vinny-header-menu .header-menu-item:hover > a.nav-link i.menu-arrow,
.vinny-header-menu .header-menu-item.open > a.nav-link i.menu-arrow {
    transform: rotate(180deg);
}

/* Custom Level 2 Submenu Dropdown Desktop */
.vinny-header-menu .vinny-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1050;
    min-width: 220px;
    border-radius: 8px;
    margin: 0;
    padding: 6px 0;
    list-style: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: vinnyMenuSlideDown 0.18s ease forwards;
}

@keyframes vinnyMenuSlideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vinny-header-menu .header-menu-item:hover > .vinny-dropdown-menu {
    display: flex;
    flex-direction: column;
}

.vinny-header-menu .vinny-dropdown-item {
    position: relative;
    margin: 0;
    padding: 0;
}

/* Dropdown links desktop */
.vinny-header-menu .vinny-dropdown-item > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 8px 14px;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.vinny-header-menu .vinny-dropdown-item:last-child > a {
    border-bottom: none;
}

.vinny-header-menu .vinny-dropdown-item > a .item-title-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1;
    margin-right: 8px;
}

.vinny-header-menu .vinny-dropdown-item > a .item-title {
    font-size: 1em;
    font-weight: 600;
    line-height: 1.25;
}

.vinny-header-menu .vinny-dropdown-item > a .item-desc {
    display: block;
    font-size: 0.85em;
    font-weight: 400;
    line-height: 1.35;
    margin-top: 2px;
    opacity: 0.88;
}

.vinny-header-menu .vinny-dropdown-item > a i.item-icon-left {
    display: none !important;
}

.vinny-header-menu .vinny-dropdown-item > a i.item-icon-right {
    display: inline-block !important;
    margin-left: auto;
    font-size: 1.05em;
    flex-shrink: 0;
    align-self: center;
}

.vinny-header-menu .vinny-dropdown-item > a i.submenu-arrow {
    margin-left: 6px;
    font-size: 1em;
    flex-shrink: 0;
    align-self: center;
    transition: color 0.15s ease, transform 0.15s ease;
}

.vinny-header-menu .vinny-dropdown-item:hover > a {
    text-decoration: none;
}

.vinny-header-menu .vinny-dropdown-item:hover > a i.submenu-arrow,
.vinny-header-menu .vinny-dropdown-item.open > a i.submenu-arrow {
    transform: rotate(90deg);
}

/* Custom Level 3 Sub-Submenu Flyout Desktop */
.vinny-header-menu .vinny-subdropdown-menu {
    display: none;
    position: absolute;
    top: -6px;
    left: 100%;
    z-index: 1060;
    min-width: 200px;
    border-radius: 8px;
    margin-left: 2px;
    padding: 6px 0;
    list-style: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: vinnyMenuSlideRight 0.18s ease forwards;
}

@keyframes vinnyMenuSlideRight {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.vinny-header-menu .vinny-dropdown-item.has-submenu:hover > .vinny-subdropdown-menu {
    display: flex;
    flex-direction: column;
}

/* Mobile Responsiveness & Accordion Submenus */
.vinny-header-menu .vinny-mobile-bar {
    display: none;
}

@media (max-width: 700px) {
    .vinny-header-menu {
        margin-left: -5px;
        margin-right: -5px;
        border-radius: 0;
        border-top: 1px solid rgba(0, 0, 0, 0.12);
    }

    .vinny-header-menu .inner {
        padding: 0;
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

    .vinny-header-menu .vinny-mobile-bar {
        display: block;
        width: 100%;
        padding: 0;
        border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    }

    .vinny-header-menu .vinny-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 14px;
        font-weight: 700;
        font-size: 1.1em;
        text-decoration: none;
        text-align: center;
        border-radius: 0;
        transition: background-color 0.2s ease;
    }

    .vinny-header-menu .vinny-mobile-toggle:hover {
        text-decoration: none;
    }

    .vinny-header-menu .nav-main {
        width: 100%;
        max-height: 0;
        opacity: 0;
        overflow: hidden;
        flex-direction: column;
        align-items: stretch;
        transform: translateY(-10px);
        transition: max-height 0.5s ease-in-out, opacity 0.4s ease-in-out, transform 0.5s ease-in-out;
        padding: 0;
    }

    .vinny-header-menu.responsive-open .nav-main {
        max-height: 2000px;
        opacity: 1;
        transform: translateY(0);
        padding-bottom: 0;
    }

    .vinny-header-menu .header-menu-item {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        box-sizing: border-box;
        border-right: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    }

    .vinny-header-menu .header-menu-item:last-child {
        border-bottom: none;
    }

    .vinny-header-menu .header-menu-item > a.nav-link {
        width: 100%;
        justify-content: center;
        text-align: center;
        padding: 12px 14px;
        font-size: 1.05em;
        box-sizing: border-box;
        border-radius: 0 !important;
    }

    /* Disable Desktop Hover Open in Mobile View */
    .vinny-header-menu .header-menu-item:hover > .vinny-dropdown-menu {
        display: none;
    }

    /* Mobile Submenu Container - Closed by default */
    .vinny-header-menu .vinny-dropdown-menu {
        position: static;
        display: none;
        width: 100%;
        border-radius: 0;
        margin: 0;
        padding: 0;
        animation: none;
        box-shadow: none;
        border: none;
    }

    /* Mobile Submenu Open when active class is toggled */
    .vinny-header-menu .header-menu-item.open > .vinny-dropdown-menu {
        display: flex;
        flex-direction: column;
        animation: vinnyMenuSlideDown 0.25s ease forwards;
    }

    .vinny-header-menu .vinny-dropdown-item {
        width: 100%;
        text-align: center;
    }

    /* Mobile Level 2 Items (Centered text, Icon on Left, Arrow on Right) */
    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a {
        position: relative;
        width: 100%;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 10px 14px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-sizing: border-box;
        transform: none !important;
        border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
        border-bottom: none !important;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a .item-desc {
        display: none !important;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a i.item-icon-right {
        display: none !important;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a i.item-icon-left {
        display: inline-block !important;
        margin-right: 6px;
        font-size: 1.05em;
        align-self: center;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a .item-title-group {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-right: 0;
        flex: none;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item > a i.submenu-arrow {
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0;
    }

    .vinny-header-menu .vinny-dropdown-menu > .vinny-dropdown-item:hover > a {
        padding: 10px 14px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
    }

    /* Mobile Sub-Submenu Container - Closed by default */
    .vinny-header-menu .vinny-dropdown-item.has-submenu:hover > .vinny-subdropdown-menu {
        display: none;
    }

    .vinny-header-menu .vinny-subdropdown-menu {
        position: static;
        display: none;
        width: 100%;
        border-radius: 0;
        margin: 0;
        padding: 0;
        animation: none;
        box-shadow: none;
        border: none;
    }

    .vinny-header-menu .vinny-dropdown-item.has-submenu.open > .vinny-subdropdown-menu {
        display: flex;
        flex-direction: column;
        animation: vinnyMenuSlideDown 0.25s ease forwards;
    }

    /* Mobile Level 3 Items (Text on Left, Icon on Right) */
    .vinny-header-menu .vinny-subdropdown-menu > .vinny-dropdown-item > a {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        text-align: left !important;
        position: relative;
        padding: 10px 14px 10px 28px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-sizing: border-box;
        transform: none !important;
        border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
        border-bottom: none !important;
    }

    .vinny-header-menu .vinny-subdropdown-menu > .vinny-dropdown-item > a i.item-icon-left {
        display: none !important;
    }

    .vinny-header-menu .vinny-subdropdown-menu > .vinny-dropdown-item > a i.item-icon-right {
        display: inline-block !important;
        margin-left: auto;
        font-size: 1.05em;
        align-self: center;
    }

    .vinny-header-menu .vinny-subdropdown-menu > .vinny-dropdown-item > a .item-title-group {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        margin-right: 8px;
        flex: 1;
    }

    .vinny-header-menu .vinny-subdropdown-menu > .vinny-dropdown-item:hover > a {
        padding: 10px 14px 10px 28px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
    }
}
