.topnav {
  background-color: rgba(0, 0, 0, 0.95); /* Semi-transparent for better layering */
  backdrop-filter: blur(10px); /* Modern blur effect */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 70px; /* Reduced height for modern look */
  display: flex;
  align-items: center;
  padding: 0 20px; /* Increased padding */
  z-index: 1000;
  box-sizing: border-box;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle border */
  transition: background-color 0.3s ease; /* Smooth background transition */
}

/* Enhanced title on the left */
.topnav > a {
  font-size: 20px; /* Slightly larger for hierarchy */
  font-weight: 700; /* Bolder font */
  color: white;
  padding: 0;
  text-decoration: none;
  height: 70px;
  display: flex;
  align-items: center;
  border-bottom: none;
  transition: color 0.2s ease;
  letter-spacing: 0.5px; /* Better spacing */
}

.topnav > a:hover {
  color: #66b0ff; /* Accent color on hover */
}

/* Links container on the right */
#myLinks {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px; /* Increased gap */
}

/* Enhanced nav links on the right */
#myLinks a {
  font-size: 16px;
  font-weight: 500; /* Medium weight */
  color: white;
  padding: 12px 40px; /* Better padding */
  text-decoration: none;
  height: auto; /* Let content determine height */
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent; /* Always show border space */
  border-radius: 6px; /* Rounded corners */
  position: relative;
  transition: all 0.2s ease;
}

/* Enhanced hover effect */
#myLinks a:hover {
  border-bottom-color: #66b0ff;
  transform: translateY(-1px); /* Subtle lift effect */
}

/* Enhanced active state */
#myLinks a.active {
  border-bottom-color: #66b0ff;
}

/* Enhanced hamburger icon */
.topnav a.icon {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  margin-left: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  transition: all 0.2s ease;
}

.topnav a.icon:hover {
  border-color: #66b0ff;
  background-color: rgba(102, 176, 255, 0.1);
}

/* Enhanced responsive design */
@media screen and (max-width: 768px) { /* Increased breakpoint */
  .topnav {
    height: 60px; /* Smaller on mobile */
    padding: 0 16px;
  }
  
  .topnav > a {
    height: 60px;
    font-size: 18px;
  }
  
  #myLinks {
    flex-direction: column;
    position: absolute;
    top: 60px; /* Match nav height */
    left: 0; /* Position from left edge */
    width: 100vw; /* Full viewport width */
    background: rgba(34, 34, 34, 0.98); /* Semi-transparent */
    border-bottom: 2px solid transparent; /* Always show border space */
    backdrop-filter: blur(15px);
    z-index: 10;
    gap: 0;
    display: none;
    padding: 0px 20px 0px 20px; /* Increased padding for full-width */
  }
  
  #myLinks.show {
    display: flex;
  }
  
  #myLinks a {
    width: 100%;
    justify-content: flex-start;
    font-size: 18px; /* Larger font for full-width */
    padding: 16px 20px; /* Increased padding */
    margin-bottom: 4px; /* Slightly more margin */
    transition: all 0.2s ease;
  }
  
  #myLinks a:last-child {
    border-bottom: none; /* Remove border from last item */
  }
  
  #myLinks a:hover {
    background-color: rgba(102, 176, 255, 0.15);
  }

  #myLinks a.active {
    border-bottom-color: #66b0ff;
    color: #66b0ff;
  }
  
  .topnav a.icon {
    display: flex;
    height: 40px;
    width: 40px;
  }
}

/* Smooth slide-down animation for mobile menu */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Improved focus states for accessibility */
#myLinks a:focus {
  outline: 2px solid #66b0ff;
  outline-offset: 2px;
}

.topnav a.icon:focus {
  outline: 2px solid #66b0ff;
  outline-offset: 2px;
}