* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #f4f4f4;
}

nav {
  background-color: #2e6da4;
  width: 100%;
  position: relative;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

ul {
  list-style: none;
  display: flex;
  justify-content: space-around; /* Elemente gleichmäßig verteilen */
  width: 100%;
}

ul li {
  flex: 1; /* Jedes Listenelement nimmt den gleichen Platz ein */
}

ul li a {
  display: block;
  padding: 15px 0;
  color: white;
  text-decoration: none;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  position: relative; /* Wichtig für die Positionierung der ::before-Pseudo-Klasse */
  transition: background 0.3s ease, color 0.3s ease;
}

ul li a:hover {
  background-color: #007bff;
}

/* ::before-Pseudo-Klasse nur für den Link selbst */
ul li a::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%; /* Startet in der Mitte */
  width: 0;
  height: 3px;
  background-color: #fff;
  transition: width 0.3s ease, left 0.3s ease;
}

ul li a:hover::before {
  width: 100%; /* Füllt die gesamte Breite des Links */
  left: 0; /* Verschiebt sich nach links */
}

ul li a.active {
  background-color: #007bff;
}

ul li a.active:hover::before {
  background-color: yellow;
}

.menu-toggle {
  display: none;
  background-color: #2e6da4;
  color: white;
  padding: 15px;
  cursor: pointer;
  text-align: center;
  font-size: 18px;
}

@media (max-width: 1200px) {
  ul {
    display: none;
    flex-direction: column;
  }

  ul li {
    flex: none;
  }

  ul li a {
    padding: 15px;
    text-align: center;
  }

  .menu-toggle {
    display: block;
  }

  nav.active ul {
    display: flex;
  }
}
