/* Menu Styles for Both Desktop and Mobile */

/* Desktop styles */
@media (min-width: 992px) {
  /* Ensure language switcher is properly aligned to the right with padding */
  .navbar .dropdown.ms-auto {
    margin-left: auto !important;
  }
  
  /* Add right padding to language switcher */
  .navbar .dropdown.pe-3 {
    padding-right: 1rem !important;
  }
  
  /* Ensure navbar items are properly spaced */
  .navbar-nav {
    margin-right: 0;
  }
  
  /* Add padding to the right of each nav item */
  .navbar-nav .nav-item {
    padding-right: 0.5rem;
  }
  
  /* Ensure the navbar-brand image is properly sized */
  .navbar-brand img {
    height: 50px;
  }
  
  /* Add padding to the right side of the navbar */
  .navbar-collapse {
    padding-right: 10px;
  }
}

/* Custom hover styles for all nav links */
.nav-link {
  position: relative;
  transition: all 0.3s ease;
  color: var(--text-color-light) !important;
}

/* Create underline effect on hover for all nav links */
.nav-link:hover {
  color: var(--text-color-light) !important; /* Keep text white on hover */
}

/* Add the underline effect using a pseudo-element - desktop version */
@media (min-width: 992px) {
  .nav-link::before {
    content: '';
    position: absolute;
    width: 70%; /* Fixed width of 70% on desktop */
    height: 2px;
    bottom: 0;
    left: 50%; /* Center point */
    background-color: var(--button-gradient-left); /* Orange underline */
    transform-origin: center;
    transform: translateX(-50%) scaleX(0); /* Start with 0 scale, centered */
    transition: transform 0.3s ease;
  }

  .nav-link:hover::before {
    transform: translateX(-50%) scaleX(1); /* Scale to full width on hover */
  }

  /* Style for active/current page link */
  .nav-link.active::before {
    transform: translateX(-50%) scaleX(1); /* Show underline for active page */
  }
}

/* Mobile version - underline only as wide as the text */
@media (max-width: 991.98px) {
  /* Remove the pseudo-element approach for mobile */
  .nav-link::before {
    display: none;
  }
  
  /* Use text-decoration instead for mobile */
  .navbar-collapse .nav-link {
    text-decoration: none;
    transition: text-decoration 0.3s ease;
  }
  
  .navbar-collapse .nav-link:hover,
  .navbar-collapse .nav-link.active {
    text-decoration-line: underline;
    text-decoration-color: var(--button-gradient-left);
    text-decoration-thickness: 2px;
    text-underline-offset: 5px;
    text-decoration-skip-ink: none;
  }
}

/* Fix language switcher dropdown toggle */
.dropdown-toggle.nav-link {
  display: inline-flex;
  align-items: center;
}

/* Keep the dropdown arrow its original color and position */
.dropdown-toggle.nav-link:hover {
  color: var(--text-color-light) !important;
}

/* Ensure the dropdown caret appears correctly */
.dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.255em;
  vertical-align: middle;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-bottom: 0;
  border-left: 0.3em solid transparent;
}


/* Mobile styles */
@media (max-width: 991.98px) {
  /* Reduce top margin on mobile */
  .mt-mobile-80 {
    margin-top: 30px !important; /* Reduced from 80px to 30px */
  }


  /* Fix navbar collapse behavior */
  .navbar-collapse {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 1000;
    padding: 0.5rem 1rem;
    background-color: var(--tercery-color);
    border-radius: 0 0 0.25rem 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  }

  /* Improve menu item spacing and alignment */
  .navbar-nav {
    padding: 0.5rem 0;
    width: 100%;
  }

  .navbar-nav .nav-item {
    padding: 0.25rem 0;
    text-align: center;
  }

  .navbar-nav .nav-link {
    padding: 0.5rem 1rem;
    display: block;
    width: 100%;
    text-align: center;
  }

  /* Style for language switcher outside the collapsible menu */
  .navbar .dropdown {
    display: flex;
    align-items: center;
  }

  /* Ensure the navbar toggler is properly positioned */
  .navbar-toggler {
    position: relative;
    right: 0;
    margin-left: 0.5rem;
    z-index: 1050;
  }

  /* Fix for navbar brand on mobile */
  .navbar-brand {
    margin-right: auto;
  }

  /* Ensure the navbar-brand image is properly sized */
  .navbar-brand img {
    height: 40px;
    max-width: 100%;
  }
  
  /* Ensure proper spacing between elements */
  .navbar .container-fluid {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  /* Make sure dropdown menu appears correctly */
  .dropdown-menu {
    position: absolute;
    z-index: 1060;
  }
  
  button#langSwitcherMobile {
    padding-right: 0px;
  }
}