/* ==================================================================
   categories-megamenu.css — Chefshop / motyw Razzi
   Paleta i typografia dopasowane do referencyjnego projektu
   "Mega Menu v2 — Sidebar Cascade".
   Desktop panel: TYLKO li.categories-megamenu.
   Mobile: CAŁE menu w #mobile-menu-modal jako jeden stos ekranów.
   ================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --cmm-accent: #b85c38;       /* terakota — hover, linki, "Pokaż wszystkie", aktywny stan */
  --cmm-trigger-bg: #e05f0b;   /* kolor samego przycisku "Kategorie produktowe", jak ustalone wcześniej */
  --cmm-ink: #1a1a1a;
  --cmm-sidebar-bg: #1a1a1a;
  --cmm-sidebar-bg-hover: #2a2520;
  --cmm-muted: #9a8f7e;
  --cmm-muted-2: #a09585;
  --cmm-border: #ece6dc;
  --cmm-border-soft: #f3efe8;
  --cmm-cream: #faf8f4;
  --cmm-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* --- zabezpieczenie: resetujemy podstawowe właściwości, które motywy
   (Razzi) często nadpisują globalnie na elementach nav/a/button --- */
.cmm-panel-wrap, .cmm-panel-wrap *,
.mm-global, .mm-global * {
  box-sizing: border-box;
  font-family: var(--cmm-font);
}
.mm-global ul, .mm-global li,
.cmm-panel-wrap ul, .cmm-panel-wrap li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
.mm-global a, .cmm-panel-wrap a,
.mm-global button, .cmm-panel-wrap button {
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.categories-megamenu { position: relative; }

/* --- przycisk wyzwalający na desktopie, błyszczenie --- */
.categories-megamenu > .cmm-trigger {
  position: relative !important;
  overflow: hidden !important;
  display: inline-block !important;
  padding: 10px 20px !important;
  margin: 0 !important;
  background: var(--cmm-trigger-bg) !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  font-family: var(--cmm-font) !important;
  border-radius: 4px !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
}
.categories-megamenu > .cmm-trigger:hover,
.categories-megamenu > .cmm-trigger:focus,
.categories-megamenu > .cmm-trigger.focus {
  color: #fff !important;
}
.categories-megamenu > .cmm-trigger:after {
  content: "" !important;
  top: 0 !important;
  bottom: auto !important;
  height: 100% !important;
  width: 50% !important;
  right: auto !important;
  opacity: 1 !important;
  background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%) !important;
  background-color: transparent !important;
}
.categories-megamenu > .cmm-trigger::after {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-20deg);
  animation: cmm-shine 3.2s ease-in-out infinite;
}
@keyframes cmm-shine {
  0%   { left: -75%; }
  30%  { left: 125%; }
  100% { left: 125%; }
}

/* ==================================================================
   DESKTOP PANEL — wyłącznie categories-megamenu, od 769px w górę
   ================================================================== */
.cmm-panel-wrap { display: none; }
#mobile-menu-modal .cmm-panel-wrap { display: none !important; } /* zabezpieczenie */

@media (min-width: 769px) {
  .cmm-panel-wrap {
    display: flex !important;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 1160px !important;
    height: 560px !important;
    margin: 0 !important;
    float: none !important;
    min-width: 0 !important;
    background: #fff;
    border: 1px solid var(--cmm-border);
    box-shadow: 0 20px 60px -20px rgba(26,26,26,.18) !important;
    z-index: 30 !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: none !important;
    transition: opacity .18s ease;
  }
  .categories-megamenu:hover .cmm-panel-wrap,
  .categories-megamenu:focus-within .cmm-panel-wrap {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  .cmm-sidebar {
    width: 240px !important;
    flex-shrink: 0 !important;
    background: var(--cmm-sidebar-bg) !important;
    position: relative !important;
    height: 100% !important;
    padding: 10px 0 !important;
    margin: 0 !important;
    top: auto !important;
    left: auto !important;
    float: none !important;
    min-width: 0 !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    z-index: auto !important;
  }

  .cmm-sidebar li {
    position: static !important;
    float: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    border-left: 3px solid transparent;
    transition: background-color .12s ease, border-color .12s ease;
  }
  .cmm-sidebar li > span {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 18px;
    color: #d4cfc5;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: padding-left .12s ease;
  }
  .cmm-sidebar li > span > .cmm-label-text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.3;
  }
  .cmm-sidebar li > span::after {
    content: "›";
    flex: 0 0 auto;
    color: var(--cmm-muted);
    font-size: 16px;
    line-height: 1.3;
    opacity: .5;
    transition: transform .12s ease, opacity .12s ease;
  }

  .cmm-sidebar li:hover,
  .cmm-sidebar:not(:hover) li.is-active {
    background: var(--cmm-sidebar-bg-hover);
    border-left-color: var(--cmm-accent);
  }
  .cmm-sidebar li:hover > span,
  .cmm-sidebar:not(:hover) li.is-active > span {
    color: #fff;
  }
  .cmm-sidebar:not(:hover) li.is-active > span { font-weight: 600; }
  .cmm-sidebar li:hover > span::after,
  .cmm-sidebar:not(:hover) li.is-active > span::after {
    opacity: .85;
  }

  .cmm-content {
    position: absolute !important;
    top: 0 !important;
    left: 240px !important;
    width: 920px !important;
    height: 100% !important;
    padding: 24px 32px 32px;
    overflow-y: auto;
    background: #fff;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
  }
  /* Domyślna treść ukryta dla elementów w sidebarze */
  .cmm-sidebar li .cmm-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
    z-index: 1;
  }

  /* Pokazanie treści pierwszego elementu (.is-active) od razu po otwarciu całego menu */
  .categories-megamenu:hover .cmm-sidebar li.is-active .cmm-content,
  .categories-megamenu:focus-within .cmm-sidebar li.is-active .cmm-content {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
  }

  /* Zwykły hover myszką po pozostałych elementach sidebara */
  .cmm-sidebar li:hover .cmm-content {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 2;
  }

  .cmm-content-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--cmm-border);
    padding-bottom: 14px;
    margin-bottom: 18px;
  }
  .cmm-content-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--cmm-ink);
  }
  .cmm-content-header a,
  .cmm-content-header a:hover,
  .cmm-content-header a:focus,
  .cmm-content-header a:visited {
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    border: none !important;
    color: var(--cmm-accent) !important;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    transition: none !important;
  }
  .cmm-content-header a:hover { text-decoration: underline !important; }

  .cmm-columns {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) !important;
    width: 100% !important;
    gap: 8px 28px;
  }
  .cmm-col {
    margin-bottom: 16px !important;
    float: none !important;
    padding: 0 !important;
  }
  .cmm-col ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    position: static !important;
    opacity: 1 !important;
    transform: none !important;
    pointer-events: auto !important;
    box-shadow: none !important;
    background: none !important;
    min-width: 0 !important;
  }
  .cmm-col li {
    float: none !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
    width: 100% !important;
    height: auto !important;
  }
  
  .cmm-col h4{
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cmm-ink);
  }

  /* Poziom 3/4 — subtelny hover: TYLKO pogrubienie, bez zmiany koloru */
  .cmm-col a,
  .cmm-col a:link,
  .cmm-col a:visited,
  .cmm-col a:hover,
  .cmm-col a:focus,
  .cmm-col a:active {
    background: none !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    border: none !important;
    padding: 3px 0 !important;
    margin: 0 !important;
    display: block !important;
    color: #4a4540 !important;
    font-size: 12.5px !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    text-transform: none !important;
    white-space: normal !important;
    transition: none !important;
  }
  .cmm-col a:hover,
  .cmm-col a:focus {
    font-weight: 700 !important;
  }
  .cmm-columns .cmm-col h4 a{
    margin: 0 0 8px;
    font-size: 13px;
    color: #000 !important;
    font-weight: bold !important;
  }
}

/* ==================================================================
   MOBILE — jeden globalny stos ekranów dla CAŁEGO menu w modalu
   ================================================================== */
.mm-global { display: none; }

@media (max-width: 768px) {
  .categories-megamenu > .cmm-trigger { display: none; }

  .mm-global {
    display: block;
    background: #fff;
  }

  .mm-screen-header {
    padding: 6px 16px 10px;
    border-bottom: 1px solid var(--cmm-border);
    background: #fff;
  }
  .mm-screen-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .mm-back {
    display: flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--cmm-ink);
    padding: 0;
  }
  .mm-back::before { content: "←"; }
  .mm-breadcrumb {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 11.5px;
    color: var(--cmm-muted-2);
  }
  .mm-breadcrumb .mm-crumb {
    cursor: pointer;
  }
  .mm-breadcrumb .mm-crumb.current {
    color: var(--cmm-ink);
    font-weight: 600;
    cursor: default;
  }
  .mm-breadcrumb .mm-sep { color: #d8d1c4; }

  .mm-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    transition: height .28s ease;
  }

  .mm-screen { width: 100%; background: #fff; }

  .mm-list li { border-bottom: 1px solid var(--cmm-border-soft); }

  .mm-see-all {
    display: block;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--cmm-accent) !important;
    border-bottom: 1px solid var(--cmm-border-soft);
  }

  .mm-next {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    text-align: left;
    padding: 13px 16px;
    line-height: 1.4;
    cursor: pointer;
  }
  .mm-next:active { background: var(--cmm-cream); }
  .mm-label { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--cmm-ink); }
  .mm-meta { display: flex; align-items: center; gap: 8px; }
  .mm-count {
    display: inline-block !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
    color: var(--cmm-muted-2) !important;
    background: var(--cmm-border-soft) !important;
    border: none !important;
    border-radius: 999px !important;
    padding: 2px 8px !important;
    min-width: 20px !important;
    text-align: center !important;
    box-shadow: none !important;
  }
  .mm-arrow { color: var(--cmm-muted); font-size: 14px; }

  .mm-leaf {
    display: block;
    padding: 13px 16px;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--cmm-ink) !important;
  }
}
