.search-wrapper {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
}

.search-form {
  position: absolute;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50px;
  background-color: #1a1a1a;
  overflow: hidden;
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  z-index: 1000;
}

.search-form.expanded {
  width: 500px; /* size of the search bar */
  border-radius: 30px;
  padding-left: 1rem;
}

/* Input field (hidden by default) */
.search-form input {
  width: 0;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  color: white;
  padding: 0;
  margin: 0;
  transition: width 0.3s ease, opacity 0.3s ease;
  font-size: 1rem;
  flex-grow: 1;
  box-shadow: none;
}

/* Reveal input field when expanded */
.search-form.expanded input {
  width: 100%;
  opacity: 1;
  padding: 0 0.5rem;
}

/* Magnifying glass icon */
.search-form button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0 0.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease;
}

/* Shake animation for invalid input */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

.search-form.shake {
  animation: shake 0.4s ease;
}

@media (max-width: 860px) {
  .search-form.expanded {
    width: 460px; /* size of the search bar */
    border-radius: 30px;
    padding-left: 1rem;
  }
}

@media (max-width: 810px) {
  .search-form.expanded {
    width: 410px; /* size of the search bar */
    border-radius: 30px;
    padding-left: 1rem;
  }
}

@media (max-width: 770px) {
  .search-form.expanded {
    width: 370px; /* size of the search bar */
    border-radius: 30px;
    padding-left: 1rem;
  }
}