/* Vobler Category Menu — Horizontal Dropdown */

.vcm-menu {
    --vcm-bg: #23282d;
    --vcm-text: #ffffff;
    --vcm-hover-bg: #0073aa;
    --vcm-hover-text: #ffffff;
    --vcm-sub-bg: #ffffff;
    --vcm-sub-text: #23282d;
    --vcm-sub-hover-bg: #0073aa;
    --vcm-sub-hover-text: #ffffff;
    --vcm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --vcm-font-size: 14px;

    font-family: var(--vcm-font);
    font-size: var(--vcm-font-size);
    line-height: 1.4;
    position: relative;
    z-index: 100;
}

/* The top horizontal menu must overlap the sidebar one (it comes later in the DOM) */
.vcm-menu--horizontal {
    z-index: 1000;
}

/* Root list — horizontal */
.vcm-menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vcm-menu__list--root {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--vcm-bg);
    border-radius: 4px;
}

/* Root items */
.vcm-menu__item {
    position: relative;
    margin: 0;
}

/* Links */
.vcm-menu__link {
    display: block;
    padding: 10px 10px;
    color: var(--vcm-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.vcm-menu__list--root > .vcm-menu__item > .vcm-menu__link:hover,
.vcm-menu__list--root > .vcm-menu__item:hover > .vcm-menu__link {
    background: var(--vcm-hover-bg);
    color: var(--vcm-hover-text);
}

/* Arrow indicator for items with children */
.vcm-menu__item--has-children > .vcm-menu__link::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 6px;
    vertical-align: middle;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
}

/* Submenu arrow points right */
.vcm-menu__list--sub .vcm-menu__item--has-children > .vcm-menu__link::after {
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 4px solid currentColor;
    border-right: none;
}

/* Dropdown submenus */
.vcm-menu__list--sub {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--vcm-sub-bg);
    border: 1px solid #ccc;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
    z-index: 101;
}

/* Show dropdown on hover */
.vcm-menu__item:hover > .vcm-menu__list--sub {
    display: block;
}

/* Nested submenus open to the right */
.vcm-menu__list--sub .vcm-menu__list--sub {
    top: -4px;
    left: 100%;
    border-radius: 4px;
}

/* Submenu links */
.vcm-menu__list--sub .vcm-menu__link {
    color: var(--vcm-sub-text);
    padding: 8px 16px;
}

.vcm-menu__list--sub .vcm-menu__link:hover {
    background: var(--vcm-sub-hover-bg);
    color: var(--vcm-sub-hover-text);
}

/* Count badge */
.vcm-menu__count {
    font-size: 11px;
    color: #999;
    margin-left: 4px;
}

.vcm-menu__list--sub .vcm-menu__link:hover .vcm-menu__count {
    color: rgba(0, 0, 0, 0.7);
}

.vcm-menu__list--root > .vcm-menu__item > .vcm-menu__link .vcm-menu__count {
    color: rgba(0, 0, 0, 0.6);
}

/* =========================================================
   MOBILE CONTROLS (hamburger + accordion expanders)
   Hidden on desktop, where hover handles the dropdowns.
   ========================================================= */

.vcm-menu__burger,
.vcm-menu__expander {
    display: none;
}

/* Hamburger button */
.vcm-menu__burger {
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--vcm-bg);
    color: var(--vcm-text);
    border: none;
    border-radius: 4px;
    font: inherit;
    line-height: 1;
    cursor: pointer;
}

.vcm-menu__burger-icon {
    position: relative;
    display: inline-block;
    width: 22px;
    height: 16px;
    flex: 0 0 auto;
}

.vcm-menu__burger-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

.vcm-menu__burger-icon span:nth-child(1) { top: 0; }
.vcm-menu__burger-icon span:nth-child(2) { top: 7px; }
.vcm-menu__burger-icon span:nth-child(3) { top: 14px; }

/* Hamburger morphs into an X when open */
.vcm-menu.is-open .vcm-menu__burger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.vcm-menu.is-open .vcm-menu__burger-icon span:nth-child(2) { opacity: 0; }
.vcm-menu.is-open .vcm-menu__burger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile */
@media (max-width: 768px) {
    /* --- per-level accordion (both layouts) --- */
    .vcm-menu__item--has-children {
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .vcm-menu__item--has-children > .vcm-menu__link {
        flex: 1 1 auto;
    }

    /* Hover arrow is replaced by a real tappable button on touch */
    .vcm-menu__item--has-children > .vcm-menu__link::after {
        display: none;
    }

    .vcm-menu__expander {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
        width: 44px;
        min-height: 40px;
        padding: 0;
        background: transparent;
        border: none;
        color: inherit;
        cursor: pointer;
    }

    .vcm-menu__expander::before {
        content: '';
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 6px solid currentColor;
        transition: transform 0.2s;
    }

    .vcm-menu__item.is-expanded > .vcm-menu__expander::before {
        transform: rotate(180deg);
    }

    /* Submenus collapse — shown only when their item is expanded.
       On touch the desktop :hover rule can stick open, so neutralise it here
       and drive submenus solely by the .is-expanded class (toggled via JS). */
    .vcm-menu__list--sub,
    .vcm-menu__item:hover > .vcm-menu__list--sub {
        position: static;
        display: none;
        min-width: 0;
        max-width: none;
        max-height: none;
        overflow: visible;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--vcm-hover-bg);
        border-radius: 0;
        margin-left: 16px;
        padding: 0;
    }

    .vcm-menu__item.is-expanded > .vcm-menu__list--sub {
        display: block;
        flex-basis: 100%;
    }

    /* --- horizontal menu collapses behind the hamburger --- */
    /* Span the full width of whatever wrapper the header puts the menu in and
       keep everything left-aligned (the header may inherit text-align:center). */
    .ct-shortcode:has(> .vcm-menu--horizontal),
    .vcm-menu--horizontal {
        width: 100%;
    }

    .vcm-menu--horizontal,
    .vcm-menu--horizontal .vcm-menu__link {
        text-align: left;
    }

    .vcm-menu--horizontal .vcm-menu__burger {
        display: flex;
        justify-content: flex-start;
    }

    .vcm-menu--horizontal .vcm-menu__list--root {
        display: none;
        flex-direction: column;
        margin-top: 4px;
    }

    .vcm-menu--horizontal.is-open .vcm-menu__list--root {
        display: flex;
    }
}


/* =========================================================
   SIDEBAR LAYOUT  (.vcm-menu--sidebar)
   Vertical menu; on hover the submenu flies out to the right.
   ========================================================= */

.vcm-menu--sidebar {
    width: 100%;
    z-index: 100;
}

/* Root list — vertical, white background + gray border */
.vcm-menu--sidebar .vcm-menu__list--root {
    display: block;
    flex-wrap: nowrap;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    padding: 0;
}

.vcm-menu--sidebar .vcm-menu__item {
    position: relative;
    margin: 0;
}

/* Separators between root items */
.vcm-menu--sidebar .vcm-menu__list--root > .vcm-menu__item + .vcm-menu__item {
    border-top: 1px solid #ececec;
}

/* Rounded corners matching the border on the edge items (overflow:hidden not allowed — it would clip the flyout) */
.vcm-menu--sidebar .vcm-menu__list--root > .vcm-menu__item:first-child > .vcm-menu__link {
    border-radius: 6px 6px 0 0;
}

.vcm-menu--sidebar .vcm-menu__list--root > .vcm-menu__item:last-child > .vcm-menu__link {
    border-radius: 0 0 6px 6px;
}

/* Full-width row link */
.vcm-menu--sidebar .vcm-menu__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 16px;
    line-height: 1.5;
    white-space: normal;
}

.vcm-menu--sidebar .vcm-menu__label {
    flex: 1 1 auto;
}

/* Highlight of the whole root-level row — light gray background, white text */
.vcm-menu--sidebar .vcm-menu__list--root > .vcm-menu__item:hover > .vcm-menu__link,
.vcm-menu--sidebar .vcm-menu__list--root > .vcm-menu__item > .vcm-menu__link:hover {
    background: #cfcfcf;
    color: #000000;
}

/* Arrow on items with children — always pointing right */
.vcm-menu--sidebar .vcm-menu__item--has-children > .vcm-menu__link::after {
    flex: 0 0 auto;
    margin-left: 4px;
    border-left: 4px solid currentColor;
    border-right: none;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

/* Flyout panel to the right */
.vcm-menu--sidebar .vcm-menu__list--sub {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 240px;
    max-width: 340px;
    /* No overflow clipping: a nested flyout sits outside this box (left: 100%) and
       would be cut off by overflow-y: auto, so the 2nd level never showed. */
    overflow: visible;
    background: #cfcfcf;
    border: 1px solid #c2c2c2;
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    padding: 6px 0;
    z-index: 101;
}

/* Invisible "bridge" on the left so the cursor doesn't lose the flyout in the gap */
.vcm-menu--sidebar .vcm-menu__item--has-children > .vcm-menu__list--sub::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 100%;
}

.vcm-menu--sidebar .vcm-menu__item:hover > .vcm-menu__list--sub {
    display: block;
}

/* Nested flyouts keep opening to the right */
.vcm-menu--sidebar .vcm-menu__list--sub .vcm-menu__list--sub {
    top: -6px;
    left: 100%;
}

.vcm-menu--sidebar .vcm-menu__list--sub .vcm-menu__link {
    padding: 8px 14px;
    color: #000000;
}

.vcm-menu--sidebar .vcm-menu__list--sub .vcm-menu__link:hover {
    background: #bdbdbd;
    color: #000000;
}

/* Product count */
.vcm-menu--sidebar .vcm-menu__count {
    flex: 0 0 auto;
    margin-left: 0;
    font-size: 12px;
    color: #000000;
    opacity: 1;
}

/* On mobile the sidebar menu duplicates the top (hamburger) menu, so hide it
   entirely — navigation is handled by the horizontal menu in the header. */
@media (max-width: 768px) {
    .vcm-menu--sidebar {
        display: none;
    }
}
