@import '../../css/breakpoints.css';

.docsNavDropdownContainer {
  border-radius: 10px;
  position: relative;
  display: inline-block;
  color: var(--ch-nav-v2-link-color);
  width: fit-content;
  padding: 8px; /* Keep original padding for non-dropdown items */
}

/* Only remove padding for dropdown containers */
.docsNavDropdownContainer.hasDropdown {
  padding: 0;
}

.docsNavDropdownContainer:hover,
.docsNavDropdownContainer.hover {
  background-color: var(--ch-nav-v2-link-hover-bg);
  text-decoration: none;
}

/* Apply hover styles to dropdown containers */
.docsNavDropdownContainer.hasDropdown:hover {
  background-color: var(--ch-nav-v2-link-hover-bg);
  text-decoration: none;
}

.docsNavDropdownToolbarLink {
  /* Add padding here instead, so hover covers the entire clickable area */
  padding: 8px;
  display: inline-block;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.875rem;
  cursor: default;
  color: #414040;
  color: black;
  /* Ensure the span covers the full width including caret */
  width: 100%;
}

.docsNavDropdownToolbarLink:hover {
  background-color: var(--ch-nav-v2-link-hover-bg);
  text-decoration: none;
}

.docsNavDropdownContainer .docsNavDropdownToolbarTopLevelLink {
  margin: -8px;
  padding: 8px;
  display: inline-block;
}

[data-theme="dark"] .docsNavDropdownToolbarLink:hover,
[data-theme="dark"] .docsNavDropdownContainer:hover .docsNavDropdownToolbarTopLevelLink {
  color: #FAFF69 !important;
}

.docsNavDropdownContainer::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -20px; /* Increased to bridge the gap better */
  width: 100%;
  height: 20px; /* Increased to cover more area */
  pointer-events: auto;
}

.docsNavDropdownToolbarTopLevelLink {
  font-weight: bold;
  font-size: 0.875rem;
  cursor: default;
  color: #414040;
  color: black;
}

.docsNavDropdownToolbarLink:hover {
  text-decoration: none;
}

.docsNavDropdownToolbarTopLevelLink:hover {
  text-decoration: none;
  cursor: pointer;
}

.docsNavDropdownToolbarLink:hover, .docsNavDropdownToolbarTopLevelLink:hover {
  color: black;
}

[data-theme="dark"] .docsNavDropdownToolbarLink, [data-theme="dark"] .docsNavDropdownToolbarTopLevelLink {
  color: #C0C0C0;
}

[data-theme="dark"] .docsNavDropdownToolbarLink:hover, [data-theme="dark"] .docsNavDropdownToolbarTopLevelLink:hover {
  color: #FAFF69;
}

.docsNavSelected {
  color: black;
  text-decoration: underline;
  text-underline-offset: 4px;
}

[data-theme="dark"] .docsNavSelected {
  color: #FAFF69;
  text-decoration: none;
}

[data-theme="light"] .docsNavSelected {
  color: black;
  text-decoration: none;
}

.docsNavDropdownMenu {
  position: absolute;
  top: calc(100% + 4px); /* Reduced from + 8px to + 4px */
  left: 0;
  z-index: 9999 !important;
  min-width: 300px;
  max-width: 600px;
  background-color: white;
  border: 1px solid var(--click-color-stroke);
  filter: drop-shadow(0px 2px 2px rgba(50, 50, 50, 0.1));
  padding: 10px 10px 10px 10px;
  border-radius: 10px;

  opacity: 0;
  transform: translateY(30px);
}

.docsNavDropdownMenu.visible {
  opacity: 1;
}

.docsNavDropdownMenu.hiding {
  opacity: 0;
}

@media (max-width: var(--mobile-breakpoint)) {
  .docsNavDropdownMenu {
    position: absolute;
    min-width: 95%;
    max-width: 95%;
    left: 0;
    right: 0;
    margin-right: 10px;
    top: auto;
    bottom: 0;
    padding: 10px 5px 15px 5px;
    display: block;
    overflow-y: auto;
    border-radius: 0;
    background-color: white;
  }

  .docsNavMenuItems {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

[data-theme="dark"] .docsNavDropdownMenu {
  color: white;
  background-color: #1F1F1C;
  border: 1px solid #4B4B4B;
  filter: drop-shadow(0px 10px 6px rgba(0, 0, 0, 0.5));
}

[data-theme="light"] .docsNavDropdownMenu {
  color: black;
}

.docsNavMenuHeader {
  font-size: 0.875rem;
  font-weight: bold;
}

[data-theme="light"] .docsNavMenuHeader {
  color: black;
}

.docsNavMenuDescription {
  font-size: 0.75rem;
  color: var(--ifm-toc-link-color);
}

.docsNavMenuDivider {
  border-top: 1px solid var(--click-color-stroke);
  width: 100%;
  margin: 0;
  margin-bottom: 5px;
}

[data-theme="dark"] .docsNavMenuDivider {
  border-top: 1px solid #4B4B4B;
}

.docsNavMenuItems {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
}

.docsNavMenuItem {
  margin: 3px;
  padding: 5px;
  max-width: 100%;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  overflow-wrap: break-word;
  border-radius: 10px;
}

.docsNavMenuItem:hover .docsNavItemTitle {
  color: black !important;
}

[data-theme="dark"] .docsNavMenuItem:hover .docsNavItemTitle {
  color: yellow !important;
}

[data-theme="dark"] .docsNavMenuItem:hover {
  background-color: #272725;
}

[data-theme="light"] .docsNavMenuItem:hover {
  background-color: #f5f5f5;
}

.docsNavHovered {
  cursor: pointer;
}

[data-theme="dark"] .docsNavHovered {
  background-color: #1F1F1C;
  color: yellow;
}

[data-theme="light"] .docsNavHovered {
  background-color: #f5f5f5;
  color: black;
}

.docsNavItemTitle {
  font-size: 0.875rem;
  color: black;
  font-weight: bold;
}

[data-theme="dark"] .docsNavItemTitle {
  font-size: 0.875rem;
  color: white;
}

[data-theme="dark"] .docsNavItemTitle:hover {
  font-size: 0.875rem;
  color: yellow;
}

.docsNavItemDescription {
  color: var(--ifm-toc-link-color);
  font-size: 0.75rem;
}

.docsNavDropdownMenu a {
  text-decoration: none !important;
}

.docsNavDropdownMenu a:hover {
  text-decoration: none !important;
}

@media screen and (max-width: var(--laptop-breakpoint)) {
  .docsNavDropdownContainer {
    padding: 0px;
  }

  [data-theme="light"] .docsNavDropdownContainer {
    background-color: white;
  }
}