/************/
/* MENU BAR */
/************/
.menu-bar {
  width: auto;
  height: calc(100vh - 12rem);
  position: sticky;
  top: 12rem;
  padding: 3.2rem 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 2.8rem;
  align-items: flex-start;
  box-shadow: -4px 9px 8px #555;
  background-color: rgba(
    30,
    30,
    40,
    0.6
  ); /* Increased opacity and darker for contrast */
  /* backdrop-filter: blur(5px); */
}

.hex {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1.6rem;
  padding: 0.8rem 1.4rem;
  background: rgba(255, 217, 0, 0.9);
  clip-path: polygon(
    30% 0%,
    70% 0%,
    100% 50%,
    100% 50%,
    70% 100%,
    30% 100%,
    0% 50%,
    0% 50%
  );
  /* Reduced transition time for snappiness */
  transition:
    width 0.2s ease,
    clip-path 0.2s ease,
    padding 0.2s ease;
  width: 5.2rem; /* tylko ikona widoczna */
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  text-decoration: none;
  color: inherit;
  /* Optimization */
  will-change: width, clip-path, padding;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.hex .menu-icon {
  height: 2.4rem;
  width: 2.4rem;
  flex-shrink: 0;
  color: inherit;
}

.menu-label {
  opacity: 0;
  transform: translateX(-1rem);
  /* Reduced transition time */
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

/* === HOVER EFFECT === */
.hex:hover {
  width: 17.4rem;
  padding-left: 1.4rem;
  padding-right: 1.4rem;
  clip-path: polygon(
    10% 0%,
    90% 0%,
    100% 50%,
    100% 50%,
    90% 100%,
    10% 100%,
    0% 50%,
    0% 50%
  );
}

.hex:hover .menu-label {
  opacity: 1;
  transform: translateX(0);
}

.hex:hover,
.hex.active {
  width: 17.4rem;
  padding-left: 1.4rem;
  padding-right: 1.4rem;
  clip-path: polygon(
    10% 0%,
    90% 0%,
    100% 50%,
    100% 50%,
    90% 100%,
    10% 100%,
    0% 50%,
    0% 50%
  );
  background: linear-gradient(
    to right,
    rgba(255, 217, 0, 0.9),
    rgba(255, 217, 0, 0.45)
  );
  /* background-color: rgba(255, 217, 0, 0.9); */
}

.hex:hover .menu-label,
.hex.active .menu-label {
  opacity: 1;
  transform: translateX(0);
}

/* Custom color for the previous 2 menu items (Socials, Lab) - Security and Settings moved to header user menu */
.mobile-hidden-menu .menu-item:nth-last-child(-n + 3):not(:last-child) .hex {
  background: rgba(255, 107, 107, 0.9);
}

.mobile-hidden-menu
  .menu-item:nth-last-child(-n + 3):not(:last-child)
  .hex:hover,
.mobile-hidden-menu
  .menu-item:nth-last-child(-n + 3):not(:last-child)
  .hex.active {
  background: linear-gradient(
    to right,
    rgba(255, 107, 107, 0.9),
    rgba(255, 107, 107, 0.45)
  );
}

/* Custom color for the last menu item (Strona główna) */
.mobile-hidden-menu .menu-item:last-child .hex {
  background: rgba(144, 238, 144, 0.9);
}

.mobile-hidden-menu .menu-item:last-child .hex:hover,
.mobile-hidden-menu .menu-item:last-child .hex.active {
  background: linear-gradient(
    to right,
    rgba(144, 238, 144, 0.9),
    rgba(144, 238, 144, 0.45)
  );
}

/* === RESPONSIVE HEIGHT ADJUSTMENTS === */
/* Adjust menu items purely based on the vertical screen height */

@media (max-height: 950px) {
  .menu-bar {
    gap: 2.6rem;
  }
}

@media (max-height: 850px) {
  .menu-bar {
    gap: 2rem;
    padding: 2.4rem 1.6rem;
  }

  .hex {
    padding: 0.6rem 1.2rem;
    width: 4.8rem;
  }

  .hex:hover,
  .hex.active {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }
}

@media (max-height: 750px) {
  .menu-bar {
    gap: 1.6rem;
    padding: 1.6rem 1.6rem;
    /* Added overflow auto as a strict fallback if screen is ridiculously small */
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
  }
  .menu-bar::-webkit-scrollbar {
    display: none; /* Chrome/Saf */
  }

  .hex {
    padding: 0.5rem 1rem;
    font-size: 1.3rem;
    width: 4.2rem;
  }

  .hex .menu-icon {
    height: 2.2rem;
    width: 2.2rem;
  }

  .hex:hover,
  .hex.active {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (max-height: 650px) {
  .menu-bar {
    gap: 1.4rem;
    padding: 1.2rem 1.6rem;
  }

  .hex {
    padding: 0.4rem 0.8rem;
    font-size: 1.2rem;
    width: 3.6rem;
  }

  .hex .menu-icon {
    height: 2rem;
    width: 2rem;
  }

  .hex:hover,
  .hex.active {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }
}

/* ========================================= */
/* MEDIA QUERIES FOR BOTTOM NAVIGATION */
/* ========================================= */

.mobile-hidden-menu {
  display: contents;
}
.mobile-hamburger {
  display: none;
}

/* TABLETS (max-width: 944px / 59em) */
@media (max-width: 59em) {
  .menu-bar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    width: 100%;
    height: 8rem;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    padding: 0 1rem;
    box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.5);
    background-color: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    gap: 0;
    overflow: visible;
  }

  main,
  .grid-3-dif-cols {
    grid-template-columns: 1fr !important;
  }

  .page-content {
    grid-column: 1 / -1 !important;
  }

  body {
    padding-bottom: 8rem;
  }

  .mobile-hamburger {
    display: block;
  }

  .hex {
    width: 4.8rem !important;
    padding: 0.8rem 1.2rem !important;
    justify-content: center;
    clip-path: polygon(
      30% 0%,
      70% 0%,
      100% 50%,
      100% 50%,
      70% 100%,
      30% 100%,
      0% 50%,
      0% 50%
    ) !important;
    background: rgba(255, 217, 0, 0.9) !important;
  }

  .mobile-hidden-menu .menu-item:nth-last-child(-n + 3):not(:last-child) .hex {
    background: rgba(255, 107, 107, 0.9) !important;
  }
  .mobile-hidden-menu .menu-item:last-child .hex {
    background: rgba(144, 238, 144, 0.9) !important;
  }

  .hex .menu-icon {
    margin: 0;
  }

  .menu-label {
    display: none !important;
  }

  /* Override for hidden menu to show full text */
  .mobile-hidden-menu .hex {
    width: 17.4rem !important;
    padding: 0.8rem 1.4rem !important;
    justify-content: flex-start !important;
    clip-path: polygon(
      10% 0%,
      90% 0%,
      100% 50%,
      100% 50%,
      90% 100%,
      10% 100%,
      0% 50%,
      0% 50%
    ) !important;
  }

  .mobile-hidden-menu .menu-label {
    display: block !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
  }

  /* Hidden menu overlay styling */
  .mobile-hidden-menu {
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 100%;
    right: 1.6rem;
    margin-bottom: 1.6rem;
    background-color: rgba(30, 30, 40, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.6rem;
    padding: 1.6rem;
    gap: 1.6rem;
    box-shadow: 0 -8px 25px rgba(0, 0, 0, 0.6);

    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 999;
  }

  .mobile-hidden-menu.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* SMALLER TABLETS (max-width: 704px / 44em) */
@media (max-width: 44em) {
  .menu-bar {
    height: 7rem;
    padding: 0 0.5rem;
  }
  .hex {
    width: 4.2rem !important;
    padding: 0.6rem 1rem !important;
  }
  .hex .menu-icon {
    height: 2.2rem;
    width: 2.2rem;
  }
  body {
    padding-bottom: 7rem;
  }
}

/* PHONE (max-width: 544px / 34em) */
@media (max-width: 34em) {
  .menu-bar {
    height: 6rem;
  }
  .hex {
    width: 3.6rem !important;
    padding: 0.4rem 0.8rem !important;
  }
  .hex .menu-icon {
    height: 2rem;
    width: 2rem;
  }
  body {
    padding-bottom: 6rem;
  }
}
