/* =====================================================================
   Динамично меню – десктоп (мега меню) + мобилен (странично чекмедже)
   Цветовете се сменят от променливите по-долу.
   ===================================================================== */
:root {
    --mm-bar-bg: #0d0e12;          /* лентата с менюто */
    --mm-bar-text: #ffffff;
    --mm-bar-hover: #2a2e38;
    --mm-header-bg: #1c1f27;       /* бързите връзки в мобилното меню */
    --mm-accent: #e11d2a;          /* акцент (текуща страница, hover) */
    --mm-promo: #ff4d57;           /* „Промо“ точки */
    --mm-panel-bg: #ffffff;
    --mm-panel-text: #1c1f27;
    --mm-muted: #6b7280;
    --mm-line: #e6e7ea;
    --mm-soft: #f3f4f6;
    --mm-left-col: 280px;          /* ширина на лявата колона в мега менюто */
    --mm-drawer-w: min(360px, 88vw);
    --mm-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Общи ---------- */
.mm { font-family: var(--mm-font); color: var(--mm-bar-text); }
.mm ul { list-style: none; margin: 0; padding: 0; }
.mm a { color: inherit; text-decoration: none; }
.mm button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mm-ico { display: block; flex: none; }
.mm-sr {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.mm a:focus-visible, .mm button:focus-visible, .mm-burger:focus-visible {
    outline: 2px solid var(--mm-accent); outline-offset: -2px;
}
.mm-bar { background: var(--mm-bar-bg); }

/* ---------- Бутон „хамбургер“ ---------- */
.mm-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; border: 0; background: none;
    color: inherit; cursor: pointer;
}
.mm-burger__bars span {
    display: block; width: 22px; height: 2px; margin: 5px 0;
    background: currentColor; border-radius: 2px;
}

/* =====================================================================
   МОБИЛЕН ИЗГЛЕД (< 1024px)
   ===================================================================== */
.mm__drawer {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 1001;
    width: var(--mm-drawer-w);
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--mm-panel-bg); color: var(--mm-panel-text);
    transform: translateX(-100%); visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
}
.mm.is-open .mm__drawer { transform: none; visibility: visible; transition: transform .3s ease; }

.mm__overlay {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, .5); animation: mm-fade .3s ease;
}
.mm.is-open .mm__overlay { display: block; }
@keyframes mm-fade { from { opacity: 0; } to { opacity: 1; } }

html.mm-lock, html.mm-lock body { overflow: hidden; }

.mm__drawer-head {
    flex: none; display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 4px 0 16px; border-bottom: 1px solid var(--mm-line);
}
.mm__brand { font-weight: 800; font-size: 20px; letter-spacing: .02em; }
.mm__close { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }

.mm__quick { flex: none; display: flex; background: var(--mm-header-bg); color: #fff; }
.mm__quick li { flex: 1; }
.mm__quick li + li { border-left: 1px solid rgba(255, 255, 255, .15); }
.mm__quick a {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 48px; font-size: 13px; font-weight: 700; text-transform: uppercase;
}

.mm__list--l1 { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.mm__item { display: flex; align-items: stretch; border-bottom: 1px solid var(--mm-line); }
.mm__link {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
    min-height: 52px; padding: 0 16px;
    font-size: 14px; font-weight: 600; text-transform: uppercase;
}
.mm__toggle { flex: none; width: 52px; display: flex; align-items: center; justify-content: center; color: var(--mm-muted); }
.mm__list--l3 .mm__link, .mm__list--l4 .mm__link { text-transform: none; font-weight: 500; }

.mm__item.is-promo > .mm__link { color: var(--mm-accent); }
.mm__item.is-highlight > .mm__link { background: var(--mm-accent); color: #fff; }
.mm__item.is-current > .mm__link { color: var(--mm-accent); }
/* 7.0 поправка 5: „Акцент“ остава бял текст и на текущата страница; „Промо“/„Акцент“ и в бързите връзки */
.mm .mm__item.is-highlight > .mm__link { color: #fff; }
.mm__quick li.is-promo > a { color: var(--mm-promo); }
.mm__quick li.is-highlight > a { background: var(--mm-accent); color: #fff; }

/* Подменюта: плъзгат се отдясно върху чекмеджето */
.mm__sub {
    position: absolute; inset: 0; z-index: 1;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--mm-panel-bg);
    transform: translateX(100%); visibility: hidden;
    transition: transform .28s ease, visibility 0s linear .28s;
}
.mm__item.is-open > .mm__sub { transform: none; visibility: visible; transition: transform .28s ease; }
.mm__sub > .mm__list { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

.mm__sub-head {
    flex: none; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
    border-bottom: 1px solid var(--mm-line);
}
.mm__back { height: 56px; display: flex; align-items: center; justify-content: center; }
.mm__sub-title {
    text-align: center; font-size: 14px; font-weight: 700; text-transform: uppercase;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mm__viewall {
    grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 12px 16px; background: var(--mm-soft); color: var(--mm-muted);
    font-size: 12px; font-weight: 600; text-transform: uppercase;
}
.mm__viewall .mm-ico { width: 16px; height: 16px; }
.mm__viewall-long { display: none; }

/* =====================================================================
   ДЕСКТОП (>= 1024px)
   ===================================================================== */
@media (min-width: 1024px) {
    .mm-burger { display: none; }
    .mm { position: relative; }

    .mm__drawer {
        position: static; width: auto; transform: none; visibility: visible; transition: none;
        flex-direction: row; align-items: stretch; overflow: visible;
        background: none; color: inherit;
    }
    .mm__drawer-head, .mm__overlay, .mm.is-open .mm__overlay { display: none; }

    /* Бързи връзки – вдясно в лентата */
    .mm .mm__quick { order: 2; margin-left: auto; background: none; }
    .mm__quick li + li { border: 0; }
    .mm__quick a { height: 48px; padding: 0 12px; }
    .mm__quick a:hover { background: var(--mm-bar-hover); }

    /* 1-во ниво */
    .mm__list--l1 { flex: 0 1 auto; display: flex; overflow: visible; }
    .mm__item--l1 { display: block; border: 0; }
    .mm__item--l1 > .mm__link {
        position: relative; min-height: 48px; padding: 0 14px;
        font-size: 13px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
    }
    .mm__item--l1 + .mm__item--l1 > .mm__link::before {
        content: ""; position: absolute; left: 0; top: 16px; bottom: 16px;
        width: 1px; background: rgba(255, 255, 255, .18);
    }
    .mm__item--l1 > .mm__toggle { display: none; }
    .mm__item--l1:hover > .mm__link,
    .mm__item--l1.is-open > .mm__link { background: var(--mm-bar-hover); }
    .mm__item--l1.is-promo > .mm__link { color: var(--mm-promo); }
    .mm__item--l1.is-current > .mm__link,
    .mm__item--l1.is-current-parent > .mm__link { box-shadow: inset 0 -3px 0 var(--mm-accent); color: inherit; }

    /* Мега панел (2-ро ниво) */
    .mm__sub--l2 {
        position: absolute; top: 100%; left: 0; right: 0; bottom: auto; z-index: 1000;
        display: flex; flex-direction: column; align-items: flex-start;
        min-height: 320px; padding: 16px 0 20px; overflow: visible;
        background: var(--mm-panel-bg); color: var(--mm-panel-text);
        transform: none; visibility: hidden; opacity: 0;
        transition: opacity .15s ease, visibility 0s linear .15s;
        /* затъмнява страницата под менюто */
        box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45);
        clip-path: inset(0 -100vmax -100vmax -100vmax);
    }
    .mm__item--l1.is-open > .mm__sub--l2,
    .mm:not(.mm--js) .mm__item--l1:hover > .mm__sub--l2,
    .mm:not(.mm--js) .mm__item--l1:focus-within > .mm__sub--l2 {
        visibility: visible; opacity: 1; transition: opacity .15s ease;
    }
    .mm__sub--l2::before {
        content: ""; position: absolute; top: 0; bottom: 0; left: var(--mm-left-col);
        border-left: 1px solid var(--mm-line);
    }
    .mm__sub--l2 > .mm__list--l2 {
        flex: none; width: var(--mm-left-col); padding: 0 16px;
        /* много подкатегории: превърта се, вместо да излиза под екрана (височината идва от menu.js) */
        max-height: var(--mm-list-max, none); overflow-x: hidden; overflow-y: auto;
        overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9ccd2 transparent;
    }
    .mm__sub--l2 > .mm__list--l2::-webkit-scrollbar { width: 6px; }
    .mm__sub--l2 > .mm__list--l2::-webkit-scrollbar-thumb { background: #c9ccd2; border-radius: 3px; }

    /* „Всички ...“ под лявата колона */
    .mm__sub-head { display: block; border: 0; }
    .mm__back, .mm__sub-head .mm__close { display: none; }
    .mm__sub--l2 > .mm__sub-head {
        order: 2; width: calc(var(--mm-left-col) - 32px); margin: 12px 16px 0; padding-top: 8px;
        border-top: 1px solid var(--mm-line);
    }
    .mm__sub--l2 > .mm__sub-head .mm__sub-title { display: none; }
    .mm__sub--l2 > .mm__sub-head .mm__viewall {
        justify-content: space-between; padding: 8px 10px; background: none;
        color: var(--mm-panel-text); font-size: 12.5px;
    }
    .mm__sub--l2 > .mm__sub-head .mm__viewall-short { display: none; }
    .mm__sub--l2 > .mm__sub-head .mm__viewall-long { display: inline; }
    .mm__viewall:hover { color: var(--mm-accent); }

    /* 2-ро ниво – редове */
    .mm__item--l2 { display: flex; border: 0; border-radius: 4px; }
    .mm__item--l2 > .mm__link { min-height: 36px; padding: 0 10px; font-size: 12.5px; font-weight: 600; }
    .mm__item--l2 > .mm__toggle { width: 32px; color: var(--mm-panel-text); }
    .mm__item--l2 > .mm__toggle .mm-ico { width: 16px; height: 16px; }
    .mm__item--l2:hover, .mm__item--l2.is-active { background: var(--mm-soft); }
    .mm__item--l2.is-current > .mm__link { color: var(--mm-accent); }

    /* 3-то ниво – десният панел */
    .mm__sub--l3 {
        position: absolute; top: 0; left: var(--mm-left-col); right: 0; bottom: auto; z-index: 1;
        display: block; padding: 16px 32px 24px; overflow: visible; background: transparent;
        transform: none; visibility: hidden; opacity: 0; transition: none;
    }
    .mm__item--l2.is-active > .mm__sub--l3,
    .mm:not(.mm--js) .mm__item--l2:hover > .mm__sub--l3 { visibility: inherit; opacity: 1; }
    .mm__sub--l3 > .mm__sub-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
    .mm__sub--l3 > .mm__sub-head .mm__sub-title { font-size: 16px; font-weight: 800; text-align: left; }
    .mm__sub--l3 > .mm__sub-head .mm__viewall {
        padding: 0 0 0 16px; border-left: 1px solid var(--mm-line); background: none;
        color: var(--mm-muted); font-size: 13px; font-weight: 400; text-transform: none;
    }
    .mm__list--l3 { columns: 3 200px; column-gap: 32px; overflow: visible; }
    .mm__item--l3 { display: block; border: 0; break-inside: avoid; }
    .mm__item--l3 > .mm__link { min-height: 0; padding: 6px 0; font-size: 13.5px; font-weight: 400; color: #3b3f4a; }
    .mm__item--l3 > .mm__link:hover, .mm__item--l3.is-current > .mm__link { color: var(--mm-accent); }
    .mm__item--l3 > .mm__toggle { display: none; }

    /* 4-то+ ниво – вложен списък под родителя */
    .mm__sub--l4, .mm__sub--l5 {
        position: static; display: block; padding: 0 0 4px 12px; visibility: inherit; opacity: 1; transform: none;
    }
    .mm__sub--l4 > .mm__sub-head, .mm__sub--l5 > .mm__sub-head { display: none; }
    .mm__item--l4 { border: 0; display: block; }
    .mm__item--l4 > .mm__link, .mm__item--l5 > .mm__link { min-height: 0; padding: 3px 0; font-size: 12.5px; color: var(--mm-muted); }

    /* Изглед „simple“ – без 3-то ниво: компактно падащо меню под точката */
    .mm__item--l1.layout-simple { position: relative; }
    .layout-simple > .mm__sub--l2 { right: auto; min-width: 260px; width: max-content; min-height: 0; padding: 8px 0 12px; }
    .layout-simple > .mm__sub--l2::before { display: none; }
    .layout-simple > .mm__sub--l2 > .mm__list--l2 { width: 100%; padding: 0 8px; }
    .layout-simple > .mm__sub--l2 > .mm__sub-head { width: auto; align-self: stretch; margin: 8px 8px 0; }
    .layout-simple .mm__item--l2 > .mm__link { text-transform: none; font-size: 14px; font-weight: 500; }

    /* Изглед „columns“ – решетка (напр. марки) */
    .layout-columns > .mm__sub--l2::before { display: none; }
    .layout-columns > .mm__sub--l2 > .mm__list--l2 { display: block; width: 100%; padding: 0 24px; columns: 7 140px; column-gap: 24px; }
    .layout-columns > .mm__sub--l2 > .mm__sub-head { width: auto; align-self: stretch; margin: 12px 24px 0; }
    .layout-columns .mm__item--l2 { display: block; break-inside: avoid; background: none; }
    .layout-columns .mm__item--l2 > .mm__link { min-height: 0; padding: 5px 0; text-transform: none; font-size: 13.5px; font-weight: 600; }
    .layout-columns .mm__item--l2 > .mm__link:hover { color: var(--mm-accent); }
    .layout-columns .mm__item--l2 > .mm__toggle { display: none; }
    .layout-columns .mm__sub--l3 { position: static; padding: 0 0 6px 10px; visibility: inherit; opacity: 1; }
    .layout-columns .mm__sub--l3 > .mm__sub-head { display: none; }
    .layout-columns .mm__list--l3 { columns: auto; }
    .layout-columns .mm__item--l3 > .mm__link { padding: 2px 0; font-size: 12.5px; color: var(--mm-muted); }

    /* 7.0 поправка 5: „Промо“ (червен текст) и „Акцент“ (червен фон) на всяко ниво – и на текущата страница, и в „Колони“ */
    .mm .mm__item.is-promo > .mm__link { color: var(--mm-accent); }
    .mm .mm__item--l1.is-promo > .mm__link { color: var(--mm-promo); }
    .mm .mm__item.is-highlight > .mm__link { background: var(--mm-accent); color: #fff; }
    .mm .mm__item.is-highlight > .mm__link:hover { background: #c81824; color: #fff; }
    .mm .mm__item--l1.is-highlight:hover > .mm__link, .mm .mm__item--l1.is-highlight.is-open > .mm__link { background: #c81824; }
    .mm .mm__item--l2.is-highlight > .mm__link { border-radius: 4px; }
    .mm .mm__item--l3.is-highlight > .mm__link, .mm .mm__item--l4.is-highlight > .mm__link,
    .mm .mm__item--l5.is-highlight > .mm__link { padding-left: 8px; padding-right: 8px; border-radius: 4px; }
    .mm .mm__quick li.is-highlight > a:hover { background: #c81824; }
}

/* По-тесни десктопи: по-компактна лента, бързите връзки само с иконки */
@media (min-width: 1024px) and (max-width: 1279px) {
    .mm__item--l1 > .mm__link { padding: 0 10px; font-size: 12px; }
    .mm__quick span { display: none; }
    :root { --mm-left-col: 240px; }
}

@media (prefers-reduced-motion: reduce) {
    .mm__drawer, .mm__sub, .mm__overlay { transition: none !important; animation: none !important; }
}

/* 7.0 поправка 3: подменютата се зареждат при първото отваряне – докато дойдат */
.mm__lazy { display: flex; align-items: center; justify-content: center; min-height: 120px; padding: 24px; }
.mm__lazy-spin { width: 22px; height: 22px; border: 2px solid rgba(0,0,0,.12); border-top-color: var(--mm-accent, #e11d2a); border-radius: 50%; animation: mm-spin .8s linear infinite; }
@keyframes mm-spin { to { transform: rotate(360deg); } }
