.kozminski-mega-menu {
  background-color: #030928;
  width: 100%;
  font-family: 'Open Sans', sans-serif;
  position: relative;
}

.kozminski-mega-menu .level-1 {
  display: flex;
  list-style: none;
  margin: 0 0 0 -20px;
  padding: 0;
  justify-content: flex-start; /* Or center based on design */
}

.kozminski-mega-menu .l1-item.push-right {
  margin-left: auto;
}

.kozminski-mega-menu .l1-item {
  position: relative;
}

.kozminski-mega-menu .l1-link {
  display: block;
  padding: 10px 20px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 16px;
}

.kozminski-mega-menu .l1-item:last-child .l1-link {
  background-color: #B4865E;
}

.kozminski-mega-menu .l1-link:hover,
.kozminski-mega-menu .l1-item:hover .l1-link {
  background-color: #162447; /* Slightly lighter blue on hover */
}

/* Nolink items - rendered as span instead of a */
.kozminski-mega-menu .nolink {
  cursor: default;
}

/* Mega Dropdown */
.kozminski-mega-menu .mega-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 1000px; /* Adjust width as needed */
  background-color: #162447;
  color: #fff;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  height: calc(100vh - 175px);;

  /* Animation init state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Show on hover */
.kozminski-mega-menu .l1-item:hover .mega-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Right-aligned dropdown for last 2 L1 items */
.kozminski-mega-menu .l1-item.align-dropdown-right {
  margin-right: 3px;
  position: static;
}

.kozminski-mega-menu .l1-item.align-dropdown-right .mega-dropdown {
  left: auto;
  right: 0;
}

.kozminski-mega-menu .mega-dropdown-inner {
  display: flex;
  border-top: 1px solid #162447;
}

/* L2 Container (Left) */
.kozminski-mega-menu .l2-container {
  width: 30%;
  background-color: #162447;
  border-right: 1px solid transparent; /* Border domyślnie przezroczysty */
  overflow-y: auto;
  transition: border-color 0.3s ease;
}

/* Border pojawia się gdy L3 jest aktywne */
.kozminski-mega-menu .l2-container.has-active-l3 {
  border-right-color: #030928;
}

/* L3 Container (Middle) */
.kozminski-mega-menu .l3-container {
  width: 30%;
  background-color: #162447;
  border-right: 1px solid transparent; /* Border domyślnie przezroczysty */
  overflow-y: auto;
  transition: border-color 0.3s ease;
}

/* Border pojawia się gdy L4 jest aktywne */
.kozminski-mega-menu .l3-container.has-active-l4 {
  border-right-color: #030928;
}

/* L4 Container (Right) */
.kozminski-mega-menu .l4-container {
  width: 40%;
  padding: 20px;
  background-color: #162447;
  overflow-y: auto;
}

.kozminski-mega-menu .level-2,
.kozminski-mega-menu .level-3 {
  list-style: none;
  margin: 0;
  padding: 10px 0;
}

.kozminski-mega-menu .l2-item,
.kozminski-mega-menu .l3-item {
  display: block;
}

.kozminski-mega-menu .l2-link,
.kozminski-mega-menu .l3-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 16px;
}

.kozminski-mega-menu .l2-item:hover .l2-link,
.kozminski-mega-menu .l2-item.active .l2-link,
.kozminski-mega-menu .l3-item:hover .l3-link,
.kozminski-mega-menu .l3-item.active .l3-link {
  color: #B4865E;
  background-color: #162447;
}

.kozminski-mega-menu .l2-link .arrow,
.kozminski-mega-menu .l3-link .arrow {
  display: inline-block;
  width: 17px;
  height: 11px;
  background-image: url('/themes/custom/leon_copy/images/arrow-up.svg');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  -ms-transform: rotate(90deg);
  transform: rotate(90deg);
  font-size: 0;
  margin-left: 10px;
}

/* Hidden by default, JS handles show */
.kozminski-mega-menu .level-3,
.kozminski-mega-menu .level-4 {
  display: none;
}

.kozminski-mega-menu .l3-heading {
  display: none; /* No longer used in this layout, L3 behaves like L2 */
}

/* Level 4 specific styles */
.kozminski-mega-menu .level-4 {
  list-style: none;
  margin: 0;
  padding: 0;
}

.kozminski-mega-menu .l4-item {
  margin-bottom: 8px;
}

.kozminski-mega-menu .l4-link {
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
}

.kozminski-mega-menu .l4-link:hover {
  text-decoration: underline;
  color: #B4865E;
}

.desktop-only {
  display: block;
}
.mobile-only {
  display: none;
}

/* Mobile Styles */
@media (max-width: 991.98px) {
  .desktop-only {
     display: none !important;
  }
  .mobile-only {
     display: block;
  }

  /* Global Container - Full Screen Modal */
  .kozminski-mega-menu {
    display: none;
    position: fixed;
    top: 110px; /* Adjust below header */
    left: 0;
    width: 100vw;
    height: calc(100vh - 110px);
    background-color: #030928;
    z-index: 9999;
    overflow-y: auto;
    padding-bottom: 50px;
  }

  .kozminski-mega-menu.is-open {
    display: block;
  }

  /* L1 Items (Main List) */
  .kozminski-mega-menu .level-1 {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .kozminski-mega-menu .l1-item {
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: block;
    width: 100%;
    position: relative;
    /* Reset flex/positioning */
    height: auto;
  }

  .kozminski-mega-menu .l1-link {
    /* Style L1 trigger area */
    display: block;
    padding: 20px 20px 20px 55px; /* Added left padding for arrow */
    font-size: 15px;
    position: relative;
  }
  
  /* Arrows/Icons for expansion */
  .kozminski-mega-menu .l1-item.has-children > .l1-link::before {
      content: '';
      position: absolute;
      left: 20px;
      top: 50%;
      transform: translateY(-50%) rotate(90deg);
      width: 17px;
      height: 11px;
      background-image: url('/themes/custom/leon_copy/images/arrow-up.svg');
      background-repeat: no-repeat;
      background-size: contain;
      transition: transform 0.3s;
  }

  .kozminski-mega-menu .l1-item.has-children.mobile-expanded > .l1-link::before {
      transform: translateY(-50%) rotate(180deg);
  }

  /* Kolor tła dla rozwiniętego L1 linku */
  .kozminski-mega-menu .l1-item.mobile-expanded > .l1-link {
      background-color: #162447;
  }

  /* Mobile Dropdown (Submenus Container) */
  .mobile-dropdown {
      display: none;
      background-color: #162447;
  }

  /* Mobile Lists Common */
  .mobile-level-2,
  .mobile-level-3,
  .mobile-level-4 {
      list-style: none;
      margin: 0;
      padding: 0;
  }

  /* Mobile List Items */
  .mobile-l2-item, .mobile-l3-item, .mobile-l4-item {
      border-top: 1px solid rgba(255,255,255,0.05);
      padding-left: 35px;
  }

  .mobile-link-wrapper {
      display: flex;
      justify-content: space-between;
      align-items: stretch;
  }

  .mobile-link {
     display: block;
     padding: 15px 20px;
     color: #fff;
     text-decoration: none;
     font-size: 15px;
     font-weight: 700;
     flex-grow: 1;
     text-transform: uppercase;
  }

  /* Expand Button (Arrow area) */
  .mobile-expand-btn {
      width: 50px;
      background: rgba(255,255,255,0.05);
      border: none;
      border-left: 1px solid rgba(255,255,255,0.05);
      color: white;
      position: relative;
      cursor: pointer;
  }
  
  .mobile-expand-btn::after {
      content: '';
      position: absolute;
      left: 38%;
      top: 33%;
      width: 12px;
      height: 20px;
      background-image: url('/themes/custom/leon_copy/images/arrow-white.svg');
      background-repeat: no-repeat;
      background-size: contain;
      transition: transform 0.3s;
      transform: rotate(0deg);
  }
  
  .mobile-expanded > .mobile-link-wrapper .mobile-expand-btn::after {
      transform: rotate(90deg);
  }

  /* Submenus indentation/colors */
  .mobile-level-3 {
      display: none;
      background-color: #162447;
  }

  .mobile-level-4 {
      display: none;
      background-color: #162447;
  }

  .mobile-l3-item .mobile-link {
      font-size: 15px;
  }
  .mobile-l4-item .mobile-link {
      padding-left: 60px;
      font-size: 15px;
      color: #ccc;
  }

  /* Back/Collapse Button */
  .mobile-back-wrapper {
      background-color: transparent; /* Changed from colored bar to transparent */
      text-align: center;
  }
  
  .mobile-back {
      background: transparent;
      border: none;
      color: #B4865E; /* User requested color */
      font-weight: 700;
      text-transform: uppercase;
      font-size: 15px;
      cursor: pointer;
      width: 100%;
      padding: 10px;
      display: flex;
      justify-content: flex-start; /* Align left maybe? User said "first arrow then label" for L1, here imply left */
      padding-left: 55px;
      align-items: center;
  }
  
  .mobile-back::before {
      content: '';
      margin-right: 10px;
      transform: rotate(-90deg); /* Left rotation */
      width: 17px;
      height: 11px;
      background-image: url('/themes/custom/leon_copy/images/arrow-up.svg');
      background-repeat: no-repeat;
      background-size: contain;
      position: absolute;
      left: 20px;
      /* Removed filter since we want natural color, assuming arrow-up.svg is the brand colored one. */
  }
  
  .mobile-back-li {
      /* Show this item */
      display: block;
  }
  
  /* Ukryj przycisk POWRÓT na poziomach 3 i 4 - widoczny tylko na poziomie 2 */
  .mobile-level-3 .mobile-back-li,
  .mobile-level-4 .mobile-back-li {
      display: none;
  }

}
