/* ==========================
   ZMIENNE KOLORY / RADIUSY
   ========================== */
:root{
  --herb-mm-bg: #ffffff;
  --herb-mm-border: #e6e6e6;
  --herb-mm-shadow: 0 18px 40px rgba(0,0,0,.12);
  --herb-mm-green: #EC9B18;
  --herb-mm-green-soft: #f1f5f2;
  --herb-mm-text: #000;
  --herb-mm-muted: #757575;
  --herb-mm-radius-lg: 12px;
  --herb-mm-radius-md: 10px;
  --herb-mm-radius-sm: 8px;
  --herb-mm-transition-fast: .18s ease-out;
  --herb-mm-transition-med: .22s ease;
}

/* ==========================
   ROOT DROPDOWNU (poza flow strony)
   ========================== */

#herb-mega-menu.herb-mega-menu{
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  top: auto !important;            /* pozycja liczona dynamicznie w JS (desktop) */
  z-index: 9999 !important;
  pointer-events: none !important;
  height: 0 !important;            /* nie zajmuje miejsca w layoucie */
}

/* gdy otwarte – można klikać w środku */
.herb-mega-menu.is-open{
  pointer-events: auto !important;
}

/* wyłączamy overlay – nie chcemy modala */
.herb-mega-menu__backdrop{
  display: none !important;
}

/* ==========================
   PRZYCISK "KATEGORIE"
   ========================== */

.herb-mega-menu-toggle{
  position: relative !important;
  display: inline-flex !important;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.6rem !important;
  border-radius: 12px 12px 0 0 !important;
  border: none !important;
  background: var(--herb-mm-green) !important;
  color: #fff !important;
  font-family: var(--font-base, system-ui) !important;
  font-size: .95rem !important;
  font-weight: 600 !important;
  cursor: pointer;
  line-height: 1;
  text-decoration: none !important;
  box-shadow: 0 10px 20px rgba(0,0,0,.16);
  transition: transform var(--herb-mm-transition-fast),
              box-shadow var(--herb-mm-transition-fast),
              background var(--herb-mm-transition-fast);
}

.herb-mega-menu-toggle:focus-visible{
  outline: 2px solid #fff !important;
  outline-offset: 3px !important;
}

.herb-mega-menu-toggle:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,.2);
  background: #EC9B18 !important;
}

.herb-mega-menu-toggle__icon{
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 2px;
  width: 18px;
  height: 18px;
}

.herb-mega-menu-toggle__icon span{
  display:block;
  width:100%;
  height:100%;
  border-radius:4px;
  border:2px solid #fff;
}

/* ==========================
   MEGA MENU – DROPDOWN POD HEADEREM
   ========================== */

.herb-mega-menu__inner{
  position: relative;
  pointer-events: auto;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;

  background: var(--herb-mm-bg);
  border-radius: 0 0 var(--herb-mm-radius-lg) var(--herb-mm-radius-lg);
  border-top: none;
  border-left: 1px solid var(--herb-mm-border);
  border-right: 1px solid var(--herb-mm-border);
  border-bottom: 1px solid var(--herb-mm-border);
  box-shadow: var(--herb-mm-shadow);
  overflow: hidden;

  opacity: 0;
  visibility: hidden;
  transform: none;
  transition:
    opacity var(--herb-mm-transition-med),
    visibility var(--herb-mm-transition-med);
}

.herb-mega-menu.is-open .herb-mega-menu__inner{
  opacity: 1;
  visibility: visible;
}

/* ==========================
   MOBILE: mega-menu zwinięte,
   dopiero po kliknięciu się rozwija
   ========================== */
@media (max-width: 1024px) {
  /* domyślnie: zero wysokości, brak białej dziury */
  #herb-mega-menu .herb-mega-menu__inner{
    max-height: 0;
    overflow: hidden;
  }

  /* po kliknięciu "Kategorie" (klasa .is-open) – rozwijamy blok */
  #herb-mega-menu.is-open .herb-mega-menu__inner{
    max-height: 1200px; /* wystarczająco duże, żeby zmieścić zawartość */
    overflow: visible;
  }
}

/* ==========================
   PRZYCISK ZAMYKANIA "X" (desktop)
   ========================== */

.herb-mega-menu__close{
  all: unset !important;
  position: absolute !important;
  top: 0.7rem !important;
  right: 1rem !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 999px !important;
  background-color: #ffffff !important;
  background-image: url("https://herbalovo.pl/wp-content/uploads/2025/11/x-1.svg") !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
  background-size: 14px 14px !important;
  border: 1px solid #e0d7c8 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 1000 !important;
  box-shadow: 0 6px 16px rgba(0,0,0,.12) !important;
}

.herb-mega-menu__close span{
  display: none !important;
}

.herb-mega-menu__close:hover{
  background-color: #f7f3ed !important;
  border-color: var(--herb-mm-green) !important;
}

/* ==========================
   LAYOUT – KOLUMNY
   ========================== */

.herb-mega-menu__columns{
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 420px;
}

.herb-mega-menu__left{
  border-right: 1px solid var(--herb-mm-border);
  background: #faf9f7;
  max-height: 520px;
  overflow-y: auto;
  padding-top: .25rem;
  padding-bottom: 1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.herb-mega-menu__cat-list{
  list-style:none;
  margin:0;
  padding:0;
}

.herb-mega-menu__cat-item{
  margin:0;
}

.herb-mega-menu__cat-link{
  position: relative;
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .8rem 1.8rem;
  font-family: var(--font-base, system-ui);
  font-size: .97rem;
  font-weight: 600;
  color: var(--herb-mm-text);
  cursor: pointer;
  text-align: left;
  text-decoration:none;
  box-shadow:none;
  border-radius:0;
  transition: background var(--herb-mm-transition-fast),
              color var(--herb-mm-transition-fast);
}

.herb-mega-menu__cat-item + .herb-mega-menu__cat-item .herb-mega-menu__cat-link{
  border-top: 1px solid #f0f0f0;
}

.herb-mega-menu__cat-label{
  flex:1 1 auto;
  white-space: nowrap;
  padding: .5rem 0;
}

/* aktywna kategoria */
.herb-mega-menu__cat-item.is-active .herb-mega-menu__cat-link{
  background: #ffffff;
  color: var(--herb-mm-green);
  box-shadow: inset 3px 0 0 var(--herb-mm-green);
}

/* hover */
.herb-mega-menu__cat-item:not(.is-active) .herb-mega-menu__cat-link:hover{
  background: var(--herb-mm-green-soft);
}

/* Ikonka strzałki */
.herb-mega-menu__cat-toggle{
  flex:0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #c4c4c4;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  position: relative;
}

.herb-mega-menu__cat-toggle::before{
  content:''; 
  width: 6px;
  height: 6px;
  border-right: 2px solid #c4c4c4;
  border-bottom: 2px solid #c4c4c4;
  transform: rotate(-45deg) translateX(-1px);
  transition:
    border-color var(--herb-mm-transition-fast),
    transform var(--herb-mm-transition-fast);
}

.herb-mega-menu__cat-item.is-active .herb-mega-menu__cat-toggle{
  border-color: var(--herb-mm-green);
}

.herb-mega-menu__cat-item.is-active .herb-mega-menu__cat-toggle::before{
  border-color: var(--herb-mm-green);
  transform: rotate(45deg) translateX(-1px);
}

/* PRAWA STRONA (panele) */

.herb-mega-menu__right{
  position: relative;
  max-height: 520px;
  overflow-y: auto;
}

.herb-mega-menu__panel{
  display:none;
  padding: 1.5rem 1.75rem 1.75rem 1.75rem;
}

.herb-mega-menu__panel.is-active{
  display:block;
}

.herb-mega-menu__grid{
  display:grid;
  grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1.1fr);
  gap: 2.25rem;
  align-items:flex-start;
}

/* SUBKATEGORIE */

.herb-mega-menu__subcats{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.75rem;
}

.herb-mega-menu__subcat-col{
  list-style:none;
  margin:0;
  padding:0;
}

.herb-mega-menu__subcat-item{
  margin:0 0 .35rem 0;
}

.herb-mega-menu__subcat-link{
  display:inline-block;
  font-size:.95rem;
  color:var(--herb-mm-text);
  text-decoration:none;
  line-height:1.5;
  position:relative;
  padding-bottom: 1px;
}

.herb-mega-menu__subcat-link::after{
  content:'';
  position:absolute;
  left:0;
  bottom:-1px;
  width:0;
  height:1px;
  background:var(--herb-mm-green);
  transition: width var(--herb-mm-transition-fast);
}

.herb-mega-menu__subcat-link:hover{
  color:var(--herb-mm-green);
}

.herb-mega-menu__subcat-link:hover::after{
  width:100%;
}

.herb-mega-menu__subcat-empty{
  font-size:.9rem;
  color:var(--herb-mm-muted);
}

/* POLECAMY – produkt */

.herb-mega-menu__promo{
  border-left: 1px solid var(--herb-mm-border);
  padding-left: 2rem;
}

.herb-mega-menu__promo-inner{
  background:#f9f7f3;
  border-radius: var(--herb-mm-radius-md);
  padding: 1.25rem 1.25rem 1.35rem 1.25rem;
}

.herb-mega-menu__promo-heading{
  font-size:.85rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:#73955d;
  margin-bottom:.6rem;
}

.herb-mega-menu__promo-link{
  display:flex;
  flex-direction:column;
  gap:.65rem;
  text-decoration:none;
  color:var(--herb-mm-text);
}

.herb-mega-menu__promo-thumb img{
  width:100%;
  height:auto;
  border-radius: var(--herb-mm-radius-sm);
  display:block;
}

.herb-mega-menu__promo-title{
  font-size:.95rem;
  font-weight:600;
}

/* ==========================
   BREAKPOINTY DESKTOP/MOBILE
   ========================== */

@media (max-width:1366px){
  .herb-mega-menu__inner{
    max-width:1200px;
  }
}

/* Tablet / mobile */

@media (max-width:1024px){
  .herb-mega-menu__inner{
    max-width:none;
    width:100%;
    border-radius:0;
    box-shadow: 0 12px 30px rgba(0,0,0,.15);
  }

  .herb-mega-menu__columns{
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    min-height:0;
  }

  .herb-mega-menu__left{
    max-height:none;
    border-right:none;
    border-bottom:1px solid var(--herb-mm-border);
  }

  .herb-mega-menu__right{
    display:none;
  }

  .herb-mega-menu__panel{
    padding: 1.25rem 1.25rem 2rem 1.25rem;
  }

  .herb-mega-menu__grid{
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .herb-mega-menu__promo{
    border-left:none;
    padding-left:0;
  }

  .herb-mega-menu__promo-inner{
    background:#fff;
    border-radius: var(--herb-mm-radius-md);
    border:1px solid var(--herb-mm-border);
  }

  .herb-mega-menu__panel-mobile{
    padding: 0.75rem 1rem 1rem 1rem;
    background:#ffffff;
    border-top:1px solid var(--herb-mm-border);
  }
}

@media (max-width:767px){
  .herb-mega-menu__cat-link{
    padding: .55rem 1rem;
    font-size:.95rem;
  }

  .herb-mega-menu__panel{
    padding: 1rem 1rem 2rem 1rem;
  }

  .herb-mega-menu__subcats{
    gap: 1.25rem;
  }

  .herb-mega-menu__promo-inner{
    padding: 1rem 1rem 1.1rem 1rem;
  }

  .herb-mega-menu__promo-thumb img{
    max-width: 180px;
    width: 100%;
    margin: 0 auto 0.75rem;
    display: block;
  }
}

/* ==========================
   CTA KONTO (MOBILE/TABLET)
   ========================== */

.herb-mm-account-cta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  margin: 0 0 1rem 0;

  background: #edf3ea;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;

  font-family: var(--font-base, system-ui);
  color: var(--herb-mm-text, #242424);

  box-shadow: 0 10px 25px rgba(0,0,0,.08);
  transition:
    background-color .2s ease,
    box-shadow .2s ease,
    transform .15s ease;
}

.herb-mm-account-cta__title{
  font-size: .95rem;
  font-weight: 600;
}

.herb-mm-account-cta__subtitle{
  font-size: .8rem;
  color: var(--herb-mm-muted, #757575);
  margin-top: .1rem;
}

.herb-mm-account-cta__icon{
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #d8ead4;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.herb-mm-account-cta__icon img{
  width: 18px;
  height: 18px;
  display: block;
}

.herb-mm-account-cta:hover,
.herb-mm-account-cta:focus-visible{
  background-color: #d8ead4;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
  transform: translateY(-1px);
  outline: none;
}

.herb-mm-account-cta:focus-visible{
  box-shadow:
    0 0 0 2px rgba(11,61,1,0.3),
    0 12px 28px rgba(0,0,0,.12);
}

@media (min-width: 1025px){
  .herb-mm-account-cta{
    display: none;
  }
}

/* ==========================
   IKONY MOBILE (hamburger + X)
   ========================== */

.menu-mobile{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: transparent;
  transition:
    background-color 0.2s ease,
    transform 0.15s ease;
}

.menu-mobile:hover,
.menu-mobile:focus-visible{
  background-color: #d8ead4;
  transform: translateY(-1px);
  outline: none;
}

.menu-mobile:focus-visible{
  box-shadow: 0 0 0 2px rgba(11, 61, 1, 0.3);
}

.menu-mobile__icon{
  width: 24px;
  height: 24px;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 20px 20px;
}

/* hamburger */
.herb-mobile-menu-toggle .menu-mobile__icon{
  background-image: url("https://herbalovo.pl/wp-content/uploads/2025/07/menu.svg");
}

/* X */
.herb-mobile-offcanvas__close .menu-mobile__icon{
  background-image: url("https://herbalovo.pl/wp-content/uploads/2025/11/x-1.svg");
}

/* ==========================
   OFFCANVAS MOBILE/TABLET
   ========================== */

.herb-mobile-menu{
  display:none;
}

@media (max-width:1024px){
  .herb-mobile-menu{
    display:block;
  }
}

.herb-mobile-offcanvas{
  position:fixed;
  inset:0;
  z-index:999998;
  pointer-events:none;
  opacity:0;
  transition:opacity .22s ease-out;
}

.herb-mobile-offcanvas.is-open{
  pointer-events:auto;
  opacity:1;
}

.herb-mobile-offcanvas__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.45);
}

.herb-mobile-offcanvas__panel{
  position:absolute;
  top:0;
  left:0;
  min-height:100vh;
  background:#ffffff;
  box-shadow:0 24px 40px rgba(0,0,0,.22);
  border-radius:0 18px 18px 0;
  padding:20px 20px 24px;
  display:flex;
  flex-direction:column;
  transform:translateX(-100%);
  transition:transform .24s ease-out;

  width:320px;
  max-width:calc(100% - 40px);

  overflow-y:auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width:601px) and (max-width:1024px){
  .herb-mobile-offcanvas__panel{
    width:600px;
    max-width:calc(100% - 40px);
  }
}

.herb-mobile-offcanvas.is-open .herb-mobile-offcanvas__panel{
  transform:translateX(0);
}

.herb-mobile-offcanvas__close{
  position:absolute;
  top:12px;
  right:12px;
}

/* NAV MENU W PANELU */

.herb-mobile-offcanvas__nav{
  margin-top:1.4rem;
}

.herb-mobile-offcanvas__nav-list{
  list-style:none;
  margin:0;
  padding:0;
}

.herb-mobile-offcanvas__nav-list > li > a{
  display:block;
  padding:.65rem 0;
  font-size:.95rem;
  text-decoration:none;
  color:#222;
  border-bottom:1px solid #f0f0f0;
}

.herb-mobile-offcanvas__nav-list > li:last-child > a{
  border-bottom:none;
}

.herb-mobile-offcanvas__nav-list > li > a:hover{
  color:#0f3c1e;
}

/* BLOKADA SCROLLA STRONY, gdy panel otwarty */

html.herb-mobile-offcanvas-open,
html.herb-mobile-offcanvas-open body{
  overflow:hidden;
}

/* ==========================
   MEGA-MENU W PANELU OFFCANVAS
   ========================== */

/* gdy menu jest przeniesione do panelu – traktujemy jako blok */
.herb-mobile-offcanvas__panel #herb-mega-menu.herb-mega-menu{
  position: static !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  width: 100% !important;
  height: auto !important;
  pointer-events: auto !important;
  z-index: auto !important;
  margin-top: 0.9rem;
}

.herb-mobile-offcanvas__panel #herb-mega-menu .herb-mega-menu__inner{
  max-width:100%;
  border-radius:12px;
  box-shadow:none;
}

/* ==========================
   FIXY MOBILE <1024px
   – przyciski + wysokość panelu
   ========================== */

@media (max-width:1024px){

  /* 1) PRAWIDŁOWY WYGLĄD IKONEK (hamburger + X)
        – przebijamy globalne style button/input z motywu/Elementora */

  .herb-mobile-menu .menu-mobile,
  .herb-mobile-offcanvas__close .menu-mobile{
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 4px !important;
    min-width: 0 !important;
    border-radius: 8px !important;
    line-height: 1 !important;
  }

  .herb-mobile-menu .menu-mobile:hover,
  .herb-mobile-menu .menu-mobile:focus-visible,
  .herb-mobile-offcanvas__close .menu-mobile:hover,
  .herb-mobile-offcanvas__close .menu-mobile:focus-visible{
    background-color: #d8ead4 !important;
    transform: translateY(-1px) !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(11, 61, 1, 0.3) !important;
  }

  .herb-mobile-menu .menu-mobile__icon,
  .herb-mobile-offcanvas__close .menu-mobile__icon{
    width: 24px !important;
    height: 24px !important;
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 20px 20px !important;
  }

  /* 2) WYSOKOŚĆ PANELU OFFCANVAS
        – panel rośnie wg treści, bez wielkiej pustej dziury na dole */

  .herb-mobile-offcanvas__panel{
    height: auto !important;
    max-height: 100vh !important;
    padding-bottom: 16px !important;
  }
}
