/* ==========================================================================
   WC Mega Menu – Stylesheet  v1.1.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties  (PHP overrides via inline <style> in <head>)
   -------------------------------------------------------------------------- */
:root {
    --wcmm-bg:              #111111;
    --wcmm-text:            #ffffff;
    --wcmm--accent:         #EBF3F7;
    --wcmm-dropdown-bg:     #ffffff;
    --wcmm-dropdown-text:   #000000;
    --wcmm-card-bg:         #ffffff;
    --wcmm-card-radius:     20px;
    --wcmm-card-shadow:     0 2px 8px rgba(0,0,0,.08);
    --wcmm-transition:      0.22s ease;
    --wcmm-z:               99990;
    --wcmm-font:            inherit;
    --wcmm-max-width:       1440px;
    --wcmm-desktop-cols:    5;
    --wcmm-tablet-cols:     3;
    --wcmm-mobile-cols:     2;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
.wcmm-nav *,
.wcmm-nav *::before,
.wcmm-nav *::after {
    box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Outer nav  (full viewport width — sits at whatever position the
   theme places it, e.g. inside Elementor Section set to Full Width)
   -------------------------------------------------------------------------- */
.wcmm-nav {
    position: relative;           /* dropdown anchors to this */
    z-index: var(--wcmm-z);
    font-family: var(--wcmm-font);
    width: 100%;
}

/* Nav bar strip — carries the background colour */
.wcmm-nav__bar {
    background: var(--wcmm-bg);
    width: 100%;
}

/* Centred inner row */
.wcmm-nav__inner {
    max-width: var(--wcmm-max-width);
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
}
.wcmm-parent-label {
    max-width: var(--wcmm-max-width);
    margin: 0 auto;
    padding: 35px 30px 0;
    display: flex;
    align-items: center;
    text-align: end;
    font-size: 25px;
    font-weight: 700;
    /*flex-direction: row-reverse;*/
}
/* --------------------------------------------------------------------------
   Parent category list
   -------------------------------------------------------------------------- */
.wcmm-parent-list {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Each item is position:static so the dropdown spans the full .wcmm-nav */
.wcmm-parent-item {
    position: static;
}

.wcmm-parent-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0px 13px;
    color: var(--wcmm-text);
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
    transition: color var(--wcmm-transition);
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    line-height: 1;
}

.wcmm-parent-link:hover,
.wcmm-parent-item.is-open > .wcmm-parent-link {
    color: var(--wcmm-accent);
}

.wcmm-chevron {
    transition: transform var(--wcmm-transition);
    flex-shrink: 0;
}
.wcmm-parent-item.is-open > .wcmm-parent-link .wcmm-chevron {
    transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   Mega menu dropdown
   Full-width background — breaks out to the width of .wcmm-nav (100vw-ish).
   If the nav is inside a narrower Elementor container, use the JS offset trick
   (handled in mega-menu.js) to stretch it to the viewport edge.
   -------------------------------------------------------------------------- */
/*.wcmm-dropdown {*/
/*    display: none;*/
/*    position: absolute;*/
    /* Stretch full width of the nearest positioned ancestor (.wcmm-nav) */
/*    left: 0;*/
/*    right: 0;*/
/*    top: 2.6em;*/
/*    width: 100%;*/
/*    background: var(--wcmm-dropdown-bg);*/
/*    box-shadow: 0 35px 25px rgba(0,0,0,.06);*/
/*    z-index: calc(var(--wcmm-z) + 1);*/
/*    border-top: 2px solid #ebf3f7a6;*/
/*}*/
.wcmm-dropdown {
    display: none;
    position: absolute;
    /* Remove hardcoded left/right here — JS handles it */
    top: 2.6em;
    width: 100%;  /* fallback */
    background: var(--wcmm-dropdown-bg);
    box-shadow: 0 35px 25px rgba(0,0,0,.06);
    z-index: calc(var(--wcmm-z) + 1);
    border-top: 2px solid #ebf3f7a6;
}

.wcmm-parent-item.is-open > .wcmm-dropdown {
    display: block;
}

/* ── 1440px centred inner ──────────────────────────────────────────────── */
.wcmm-dropdown__inner {
    max-width: var(--wcmm-max-width);
    margin: 0 auto;
    padding: 28px 32px;
    display: flex;
    flex-direction: row;        /* LEFT = products │ RIGHT = child categories */
    align-items: flex-start;
    gap: 40px;
}

/* --------------------------------------------------------------------------
   ① LEFT panel — Product grid
   -------------------------------------------------------------------------- */
.wcmm-products-panel {
    flex: 1 1 auto;
    min-width: 0;
}

.wcmm-products-grid {
    display: grid;
    grid-template-columns: repeat( var(--wcmm-desktop-cols), 1fr );
    gap: 30px;
    min-height: 120px;
    direction: rtl;
}

/* Loading / empty / error states */
.wcmm-products-loading,
.wcmm-products-empty,
.wcmm-products-error {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    color: #999;
    font-size: 14px;
    gap: 10px;
}

.wcmm-products-loading::before {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #ddd;
    border-top-color: var(--wcmm-accent);
    border-radius: 50%;
    animation: wcmm-spin 0.7s linear infinite;
}

@keyframes wcmm-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Product card
   -------------------------------------------------------------------------- */
.wcmm-product-card {
    display: block;
    box-shadow: var(--wcmm-card-shadow);
    overflow: hidden;
    text-decoration: none;
    color: var(--wcmm-dropdown-text);
    transition: transform var(--wcmm-transition);
}

.wcmm-product-card:hover {
    transform: translateY(-3px);
    /*box-shadow: 0 8px 24px rgba(0,0,0,.14);*/
}

.wcmm-product-card__image-wrap {
    position: relative;
    padding-bottom: 100%;   /* 1:1 square */
    overflow: hidden;
    background: transparent;
}

.wcmm-product-card__image-wrap img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
    border-radius: 20px;
}

.wcmm-product-card:hover .wcmm-product-card__image-wrap img {
    /*transform: scale(1.05);*/
}

.wcmm-product-card__info {
    padding: 10px 12px 14px;
    text-align: center;
}

.wcmm-product-card__name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.45;
    text-align: center;
    color: var(--wcmm-dropdown-text);
    margin-bottom: 5px;
}

.wcmm-product-card__price {
    font-size: 16px;
    font-weight: 700;
    color: var(--wcmm-accent);
    text-align: center;
}

.wcmm-product-card__price ins { text-decoration: none; }
.wcmm-product-card__price del {
    color: #bbb;
    font-weight: 500;
    font-size: 16px;
    margin-right: 4px;
}

/* --------------------------------------------------------------------------
   ② RIGHT panel — Child category list
   -------------------------------------------------------------------------- */
.wcmm-children-panel {
    flex: 0 0 220px;
    min-width: 180px;
    /* Optional: align to the right edge of the inner container */
    align-self: flex-start;
}

.wcmm-child-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
}

/* ── Child link ───────────────────────────────────────────────────────── */
.wcmm-child-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 1px 0px;
    color: var(--wcmm-dropdown-text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    border-radius: 0px;
    transition: color var(--wcmm-transition), background var(--wcmm-transition);
    white-space: nowrap;
    position: relative;
}

.wcmm-child-link:hover,
.wcmm-child-item.is-active > .wcmm-child-link {
    color: var(--wcmm-accent);
    background: rgb(0 0 0 / 0%);
    /*border-bottom: 1px solid transparent;*/
    border-radius: 0;
    width: min-content;
}
.wcmm-child-link:hover{
    border-bottom: 1px solid var(--wcmm-accent);
}

/* ── Left-side arrow indicator ────────────────────────────────────────── */
/*
   Arrow is always in the DOM but invisible by default.
   It slides in from the left and becomes visible on hover / active.
*/
.wcmm-child-arrow {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: var(--wcmm-accent);
    opacity: 0;
    transform: translateX(-6px);
    transition:
        opacity var(--wcmm-transition),
        transform var(--wcmm-transition);
    /* Reserve space so label doesn't jump */
    width: 14px;
}

.wcmm-child-link:hover .wcmm-child-arrow,
.wcmm-child-item.is-active > .wcmm-child-link .wcmm-child-arrow {
    opacity: 1;
    transform: translateX(0);
}

.wcmm-child-label {
    text-align: end;
    font-size: 16px;
}


/* --------------------------------------------------------------------------
   Mobile hamburger button
   -------------------------------------------------------------------------- */
.wcmm-hamburger {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-right: 16px;
    flex-shrink: 0;
}

.wcmm-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--wcmm-text);
    border-radius: 2px;
    transition: transform var(--wcmm-transition), opacity var(--wcmm-transition);
}

.wcmm-hamburger.is-open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.wcmm-hamburger.is-open span:nth-child(2) { opacity: 0; }
.wcmm-hamburger.is-open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ==========================================================================
   OFFCANVAS  –  Tablet (≤ 1024px) + Mobile (≤ 768px)
   Hamburger opens a right-to-left slide-in panel.
   Parent categories are accordion items; child categories are sub-accordions.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Show hamburger on tablet + mobile
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .wcmm-hamburger { display: flex; }

    /* Hide the desktop horizontal nav list — replaced by offcanvas */
    .wcmm-parent-list { display: none !important; }

    /* Desktop dropdowns never open at this breakpoint */
    .wcmm-dropdown { display: none !important; }
}

/* --------------------------------------------------------------------------
   Overlay / backdrop
   -------------------------------------------------------------------------- */
.wcmm-offcanvas-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: calc(var(--wcmm-z) + 10);
    opacity: 0;
    transition: opacity .3s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.wcmm-offcanvas-overlay.is-visible {
    display: block;
}

.wcmm-offcanvas-overlay.is-active {
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Offcanvas panel  –  slides in from RIGHT
   -------------------------------------------------------------------------- */
.wcmm-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 92vw;
    height: 100%;
    background: #ffffff;
    z-index: calc(var(--wcmm-z) + 11);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    overflow: hidden;
}

.wcmm-offcanvas.is-open {
    transform: translateX(0);
    box-shadow: -6px 0 32px rgba(0,0,0,.35);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.wcmm-offcanvas__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
    background: var(--wcmm-bg);
}

.wcmm-offcanvas__title {
    color: var(--wcmm-text);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .3px;
    margin: 0;
}

.wcmm-offcanvas__close {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 34px;
    height: 34px;
    background-color: transparent !important;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #fff;
    transition: background .2s;
    flex-shrink: 0;
}

.wcmm-offcanvas__close:hover {
    background: rgba(255,255,255,.16);
}

.wcmm-offcanvas__close svg {
    display: block;
    overflow: visible;
}

/* ── Scrollable body ───────────────────────────────────────────────────── */
.wcmm-offcanvas__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.wcmm-offcanvas__body::-webkit-scrollbar { width: 4px; }
.wcmm-offcanvas__body::-webkit-scrollbar-track { background: transparent; }
.wcmm-offcanvas__body::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

/* --------------------------------------------------------------------------
   Offcanvas accordion  –  Parent categories
   -------------------------------------------------------------------------- */
.wcmm-oc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── Parent item ───────────────────────────────────────────────────────── */
.wcmm-oc-parent-item {
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.wcmm-oc-parent-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 38px 10px 20px;
    background: transparent !important;
    border: none;
    color: #000;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: color .2s, background .2s;
    text-decoration: none;
}

.wcmm-oc-parent-btn:hover {
    background: rgba(255,255,255,.04);
    color: var(--wcmm-accent);
}

.wcmm-oc-parent-item.is-expanded > .wcmm-oc-parent-btn {
    color: var(--wcmm-accent);
}

/* Chevron rotates on expand */
.wcmm-oc-chevron {
    flex-shrink: 0;
    color: #000;
    transition: transform .25s ease, color .2s;
}

.wcmm-oc-parent-item.is-expanded > .wcmm-oc-parent-btn .wcmm-oc-chevron {
    transform: rotate(180deg);
    color: var(--wcmm-accent);
}

/* ── Collapsible children container ──────────────────────────────────── */
.wcmm-oc-children-wrap {
    /* Collapse: height 0, no visibility */
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s cubic-bezier(.4, 0, .2, 1);
    background: rgb(240 240 240 / 42%);
}

.wcmm-oc-parent-item.is-expanded > .wcmm-oc-children-wrap {
    max-height: 2000px; /* large enough; CSS transition animates from 0 */
}

/* ── Child category list ───────────────────────────────────────────────── */
.wcmm-oc-child-list {
    list-style: none;
    margin: 0;
    padding: 6px 0;
}

.wcmm-oc-child-item {
    border-bottom: 1px solid rgba(255,255,255,.04);
}

/* Child row: label + expand toggle */
.wcmm-oc-child-row {
    display: flex;
    align-items: center;
}

/* The link text — navigates on click */
.wcmm-oc-child-link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: #000;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s;
}

.wcmm-oc-child-link:hover,
.wcmm-oc-child-item.is-expanded > .wcmm-oc-child-row > .wcmm-oc-child-link {
    color: var(--wcmm-accent);
}

/* Left arrow on child link — same slide-in as desktop */
.wcmm-oc-child-arrow {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: #000;
    opacity: 0;
    transform: translateX(-5px);
    transition: opacity .2s, transform .2s;
    width: 14px;
}

.wcmm-oc-child-link:hover .wcmm-oc-child-arrow,
.wcmm-oc-child-item.is-expanded > .wcmm-oc-child-row > .wcmm-oc-child-link .wcmm-oc-child-arrow {
    opacity: 1;
    transform: translateX(0);
    color: var(--wcmm-accent);
}

/* Toggle button to expand child products */
.wcmm-oc-child-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    color: #000;
    transition: color .2s, transform .25s ease;
    padding: 0;
    margin-right: 25px;
}

.wcmm-oc-child-toggle:hover {
    color: var(--wcmm-accent);
}

.wcmm-oc-child-item.is-expanded > .wcmm-oc-child-row > .wcmm-oc-child-toggle {
    transform: rotate(180deg);
    color: #000;
    background: transparent !important;
}

/* ── Child product panel (collapsible) ─────────────────────────────────── */
.wcmm-oc-product-wrap {
    max-height: 0;
    overflow: hidden;
    transition: max-height .4s cubic-bezier(.4, 0, .2, 1);
    background: transparent;
}

.wcmm-oc-child-item.is-expanded > .wcmm-oc-product-wrap {
    max-height: 1400px;
}

.wcmm-oc-product-inner {
    padding: 14px 16px 18px;
}

/* 2-col grid inside offcanvas */
.wcmm-oc-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Reuse .wcmm-product-card styles, small overrides */
.wcmm-oc-product-grid .wcmm-product-card {
    box-shadow: none;
    background: rgba(255,255,255, 0);
}

.wcmm-oc-product-grid .wcmm-product-card__name {
    font-size: 15px;
}

.wcmm-oc-product-grid .wcmm-product-card__price {
    font-size: 15px;
}

/* Loading / empty inside offcanvas */
.wcmm-oc-loading,
.wcmm-oc-empty,
.wcmm-oc-error {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 10px;
    color: rgba(255,255,255,.4);
    font-size: 12px;
    gap: 8px;
}

.wcmm-oc-loading::before {
    content: '';
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.15);
    border-top-color: var(--wcmm-accent);
    border-radius: 50%;
    animation: wcmm-spin 0.7s linear infinite;
}

/* --------------------------------------------------------------------------
   Body scroll-lock when offcanvas is open
   -------------------------------------------------------------------------- */
body.wcmm-no-scroll {
    overflow: hidden;
}


/* ==========================================================================
   RTL Overrides  (Hebrew, Arabic, etc.)
   ========================================================================== */
[dir="rtl"] .wcmm-dropdown__inner {
    flex-direction: row-reverse;
}

[dir="rtl"] .wcmm-dropdown {
    /* Ensure dropdown text/content flows RTL */
    direction: rtl;
}

[dir="rtl"] .wcmm-parent-list {
    flex-direction: row-reverse;
}

[dir="rtl"] .wcmm-child-list {
    align-items: flex-start;
}

[dir="rtl"] .wcmm-child-link {
    flex-direction: row-reverse;
}

[dir="rtl"] .wcmm-child-arrow {
    transform: translateX(6px);
}
[dir="rtl"] .wcmm-child-link:hover .wcmm-child-arrow,
[dir="rtl"] .wcmm-child-item.is-active > .wcmm-child-link .wcmm-child-arrow {
    transform: translateX(0);
}

[dir="rtl"] .wcmm-offcanvas {
    right: auto;
    left: 0;
    transform: translateX(-100%);
}
[dir="rtl"] .wcmm-offcanvas.is-open {
    transform: translateX(0);
    box-shadow: 6px 0 32px rgba(0,0,0,.35);
}

[dir="rtl"] .wcmm-oc-parent-btn {
    text-align: right;
    padding: 10px 20px 10px 38px;
}

[dir="rtl"] .wcmm-oc-child-toggle {
    margin-right: 0;
    margin-left: 25px;
}

