/* =========================================================
   Dynamic Multi-Level Mega Menu (MasterMover style)
   Styled to match the Industries mega menu:
   gray rounded "ALL CATEGORY" sidebar + chevron items +
   active highlight + white content card on the right.
   ========================================================= */

.afmm-wrap {
    --afmm-col-w: 300px;
    --afmm-side-bg: #ececec;
    --afmm-divider: #bcbcbc;
    --afmm-active: #f9f7f1;
    --afmm-accent: var(--accent, #c9a24b);
    /* Panel height, matched to the Industries mega menu sidebar. */
    --afmm-h: 462px;
}

.afmm {
    width: 100%;
}

.afmm-grid {
    display: flex;
    align-items: stretch;
    gap: 24px;
    min-height: var(--afmm-h); /* matches Industries menu height; panel never jumps */
    max-width: 100%;
}

/* ---- Columns (the gray sidebar block) ---- */
.afmm-columns {
    display: flex;
    flex: 0 1 auto; /* size to the columns, like the Industries sidebar (no empty grey) */
    background: var(--afmm-side-bg);
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    align-self: stretch; /* fill the panel height like the Industries sidebar */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.afmm-columns::-webkit-scrollbar {
    height: 6px;
}

.afmm-columns::-webkit-scrollbar-track {
    background: transparent;
}

.afmm-columns::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.afmm-col {
    width: var(--afmm-col-w);
    flex: 0 0 var(--afmm-col-w);
    max-height: var(--afmm-h);
    overflow-y: auto;
    /* Reserve scrollbar space in EVERY column so the chevrons line up
       identically whether or not a column actually overflows. */
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.afmm-col::-webkit-scrollbar {
    width: 6px;
}

.afmm-col::-webkit-scrollbar-track {
    background: transparent;
}

.afmm-col::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.afmm-col + .afmm-col {
    border-left: 1px solid #d8d8d8;
}

.afmm-col-title {
    font-size: 20px;
    line-height: 28px;
    color: #020104;
    font-weight: 600;
    margin: 0 0 20px;
    padding: 25px 30px 0;
}

/* Reset the dark .stellarnav2 dropdown styling that would otherwise
   bleed into these nested <ul>/<a> elements. */
.afmm .afmm-col ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    width: auto !important;
}

.afmm .afmm-col li {
    border-bottom: 1px solid var(--afmm-divider);
    background: transparent;
}

.afmm .afmm-col li:last-child {
    border-bottom: none;
}

.afmm .afmm-node {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 31px !important;
    font-size: 18px !important;
    line-height: 28px;
    font-weight: 500;
    color: #202020 !important;
    background: transparent !important;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.afmm .afmm-node:hover {
    background: var(--afmm-active) !important;
    color: #000 !important;
}

.afmm .afmm-node.is-active {
    background: var(--afmm-active) !important;
    font-weight: 600;
    color: #000 !important;
}

.afmm-node .afmm-chev {
    flex: 0 0 auto;
    font-size: 16px;
    color: #8a8a8a;
    transition: color 0.2s ease, transform 0.2s ease;
}

.afmm-node.is-active .afmm-chev {
    color: var(--afmm-accent);
    transform: translateX(2px);
}

/* ---- Product preview / content card ---- */
.afmm-preview {
    flex: 1 1 320px;
    min-width: 300px;
    border: 1px solid #dcdcdc;
    border-radius: 12px;
    padding: 20px 22px;
    overflow-y: auto;
    max-height: var(--afmm-h);
}

.afmm-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #020104;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e6e6e6;
}

.afmm-products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.afmm-product {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 18px 8px 8px;
    border: 1px solid #898989;
    border-radius: 8px;
    text-decoration: none;
    color: #202020;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.afmm-product:hover {
    border-color: var(--afmm-accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    color: #000;
}

.afmm-product-img {
    flex: 0 0 55px;
    width: 55px;
    height: 57px;
    border-radius: 12px;
    background: #ececec;
    padding: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.afmm-product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.afmm-product-body {
    min-width: 0;
}

.afmm-product-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #202020;
    margin: 0 0 3px;
}

.afmm-product-desc {
    display: -webkit-box;
    font-size: 12px;
    line-height: 1.4;
    color: #777;
    margin: 0;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.afmm-viewall {
    display: inline-block;
    margin-top: 20px;
    background: #202020;
    color: #f9f5ed;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    padding: 10.5px 32px;
    text-decoration: none;
    transition: background 0.2s ease;
}

.afmm-viewall:hover {
    background: #000;
    color: #fff;
}

/* ---- Empty / no products state ---- */
.afmm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 280px;
    color: #9a9a9a;
}

.afmm-empty i {
    font-size: 42px;
    margin-bottom: 14px;
    color: #cfcfcf;
}

.afmm-empty p {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

/* Smaller desktops */
@media (max-width: 1440.99px) {
    .afmm-wrap { --afmm-col-w: 270px; }
    .afmm-node { font-size: 16px !important; padding: 16px 24px !important; }
    .afmm-col-title { font-size: 18px; padding: 22px 24px 0; }
}

@media (max-width: 1366.99px) {
    .afmm-wrap { --afmm-col-w: 250px; }
    .afmm-node { font-size: 14px !important; padding: 14px 22px !important; }
    .afmm-col-title { font-size: 16px; padding: 20px 22px 0; margin-bottom: 16px; }
    .afmm-preview-title { font-size: 15px; }
    .afmm-product-name { font-size: 13px; }
    .afmm-product-desc { font-size: 11px; }
    .afmm-viewall { font-size: 12px; }
}

@media (max-width: 1280.99px) {
    .afmm-wrap { --afmm-col-w: 240px; }
    .afmm-node { font-size: 13.5px !important; padding: 13px 20px !important; }
    .afmm-col-title { font-size: 15px; }
}

/* ---- Keep the chevron pinned to a consistent right edge ----
   The node is flex with space-between, so the chevron already sits at the
   right; lock its column so it lines up identically in every column and at
   every breakpoint, and never gets pushed by long labels. */
.afmm-node {
    padding-right: 24px !important;
}
.afmm-node > span:first-child,
.afmm-node-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
}
.afmm-node .afmm-chev {
    margin-left: auto;
}

/* =========================================================
   Tablet / small-desktop: panel must fit the viewport.
   The columns block scrolls horizontally; the preview shrinks
   but stays usable. (Below 991px the mobile nav takes over.)
   ========================================================= */
@media (max-width: 1100.99px) {
    .afmm-wrap { --afmm-col-w: 220px; }
    .afmm-grid { gap: 16px; }
    .afmm-node { font-size: 13px !important; padding: 12px 18px !important; }
    .afmm-node { padding-right: 20px !important; }
    .afmm-col-title { font-size: 14px; padding: 18px 18px 0; margin-bottom: 14px; }
    .afmm-preview { flex: 1 1 280px; min-width: 260px; padding: 16px; }
    .afmm-products { grid-template-columns: 1fr; }
}

@media (max-width: 991.99px) {
    /* Stack the columns above the preview so nothing overflows the panel. */
    .afmm-grid {
        flex-direction: column;
        min-height: 0;
    }
    .afmm-wrap { --afmm-h: auto; --afmm-col-w: 200px; }
    .afmm-columns {
        width: 100%;
        flex: 0 0 auto;
        align-self: stretch;
    }
    .afmm-col {
        max-height: 320px;
    }
    .afmm-preview {
        width: 100%;
        flex: 0 0 auto;
        max-height: 360px;
        min-width: 0;
    }
    .afmm-products {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}
