/* app/Menubar.css */

.menubar {
  position: sticky;
  top: 20px;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-self: center;
  width: calc(100% - 40px);
  min-width: 720px;
  max-width: 1000px;
  margin: 20px auto 0;
  border-radius: 30px;
  background-color: rgba(29, 29, 29, 0.9);
  backdrop-filter: blur(10px);
  padding: 10px 20px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(60, 60, 60, 0.3);
  isolation: isolate;
  transition: padding 0.35s ease;
}

.menubar::before {
  content: '';
  position: absolute;
  inset: -5px;
  background: linear-gradient(45deg, #ff00ff, #00ffff);
  filter: blur(25px);
  border-radius: 20px;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
}

.menubar-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 960px;
  transition: flex-direction 0.35s ease;
}

.desktop-menu {
  display: flex;
  gap: 30px;
}

.menu-item {
  color: #e0e0e0;
  text-decoration: none;
  font-size: 1.1em;
  padding: 5px 10px;
  transition: color 0.3s ease, transform 0.3s ease;
}

.menu-item:hover {
  color: #ffffff;
  transform: translateY(-2px);
}

.mobile-menu {
  display: none;
  width: 100%;
  position: relative;
}

.mobile-menu-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.burger-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #e0e0e0;
  font-size: 2em;
  line-height: 1;
  padding: 5px 10px;
  position: relative;
  z-index: 3;
  touch-action: manipulation;
  width: 1.4em;
  height: 1.4em;
  cursor: pointer;
}

.burger-icon-menu,
.burger-icon-close {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.burger-icon-menu {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.burger-icon-close {
  opacity: 0;
  transform: scale(0.8) rotate(-90deg);
}

.mobile-menu-checkbox:checked + .burger-icon .burger-icon-menu {
  opacity: 0;
  transform: scale(0.8) rotate(90deg);
}

.mobile-menu-checkbox:checked + .burger-icon .burger-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.mobile-dropdown {
  display: grid;
  grid-template-rows: 0fr;
  width: 100%;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
  border-top: 1px solid transparent;
  pointer-events: none;
  transition:
    grid-template-rows 0.35s ease,
    opacity 0.35s ease,
    margin-top 0.35s ease,
    padding-top 0.35s ease,
    border-color 0.35s ease;
}

.mobile-menu-checkbox:checked ~ .mobile-dropdown {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: 8px;
  padding-top: 12px;
  border-top-color: rgba(60, 60, 60, 0.3);
  pointer-events: auto;
}

.mobile-dropdown-inner {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  min-height: 0;
}

.mobile-dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 10px;
  border-radius: 16px;
  text-align: left;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    background-color 0.3s ease;
}

.mobile-menu-checkbox:checked ~ .mobile-dropdown .mobile-dropdown-item {
  opacity: 1;
  transform: translateY(0);
}

.mobile-dropdown-item:hover {
  background-color: rgba(60, 60, 60, 0.4);
  transform: translateY(0);
}

/* Responsive design */
@media (max-width: 750px) {
  .menubar {
    min-width: 0;
    width: calc(100% - 24px);
    margin-top: 16px;
    justify-content: flex-start;
  }

  .desktop-menu {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  .menubar-content {
    justify-content: flex-start;
    align-items: stretch;
  }

  .menubar:has(.mobile-menu-checkbox:checked) .menubar-content {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-menu-checkbox:checked ~ .mobile-dropdown .mobile-dropdown-item:nth-child(1) {
    transition-delay: 0.05s;
  }

  .mobile-menu-checkbox:checked ~ .mobile-dropdown .mobile-dropdown-item:nth-child(2) {
    transition-delay: 0.1s;
  }

  .mobile-menu-checkbox:checked ~ .mobile-dropdown .mobile-dropdown-item:nth-child(3) {
    transition-delay: 0.15s;
  }

  .mobile-menu-checkbox:checked ~ .mobile-dropdown .mobile-dropdown-item:nth-child(4) {
    transition-delay: 0.2s;
  }
}

@media (prefers-reduced-motion: reduce) {
  .menubar,
  .menubar-content,
  .burger-icon-menu,
  .burger-icon-close,
  .mobile-dropdown,
  .mobile-dropdown-item {
    transition: none;
  }

  .mobile-menu-checkbox:checked + .burger-icon .burger-icon-menu,
  .burger-icon-close {
    transform: none;
  }

  .mobile-dropdown-item {
    opacity: 1;
    transform: none;
  }
}
