/* --- Search Wrapper & Container --- */
/* Acts as the primary layout wrapper to position the search components */
.search-wrapper {
  display: flex;
  flex-direction: column;
  width: fit-content;
  height: fit-content;
  position: relative;
  align-items: center;
}

/* Serves as the main container for the input and button, providing layout and border styling */
.search-container {
  display: flex;
  width: fit-content;
  height: fit-content;
  align-items: center;
  position: relative;
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--border-action-primary-dark);
  background-color: var(--action-primary-bg-dark);
}

/* When the search-container is focused (or contains a focused input) */
.search-container:focus-within {
  /* Change the border color of the input */
  border-color: var(--border-blue-active);
}

/* --- Search Input --- */
/* The input field where users type their search queries */
#search-input {
  display: flex;
  width: 220px;
  height: 46px;
  padding: 15px 10px 15px 16px;
  border: 2px solid var(--border-action-primary-dark);
  border-radius: var(--border-radius-lg);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  appearance: auto;
  font-size: 1.125rem;


  align-items: center;


}

/* Directly target the input to change its border when container is active */
.search-container:focus-within #search-input {
  border-color: var(--border-blue-active);}
  
.search-container:focus-within #search-input {
  border-color: var(--border-blue-active);
  outline: 6px solid var(--border-component-quaternary-light);
      box-shadow: 0 0 0 .2rem rgba(64, 77, 102, .25);
}


/* Defines the visual state when the input field is active/focused by the user */
#search-input:focus {
  width: 260.06px;

  background-color: var(--action-primary-bg-gray);
  outline: none;
}

/* Styles the placeholder text within the search input */
input::placeholder {
  font-size: 1.125rem;
}

/* --- Search Button --- */
/* The clickable button to submit the search form */
.search-button {
  display: flex;
  position: absolute;
  top: 0;
  right: -0.6px;
  width: 46px;
  height: 46px;
  padding: 11.5px;
  background-color: var(--action-primary-bg-dark);
  color: var(--icon-light);
  border: 1.6px solid transparent;
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}


.search-button {
  display: flex;
  position: absolute;
  top: 0;
  right: -0.6px;
  width: 46px;
  height: 46px;
  padding: 11.5px;
  background-color: var(--action-primary-bg-dark);
  color: var(--icon-light);
  border: 3px solid transparent;
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.search-container:focus-within .search-button {
  background-color:var(--bg-component-blue-active);
  color: #FFFFFF;
}

/* Change the background of the button when the container is active */
.search-container:focus-within .search-button {
  background-color: var(--bg-component-blue-active);
  /* Ensure the icon color remains visible against the new background */
  color: var(--icon-x-light)
}

/* Provides visual feedback when hovering over the search button */
.search-button:hover {
  background-color: var(--action-primary-bg-slate);
}

/* Manages the size of the search icon inside the button */
.search-button i {
  font-size: 1.5rem;
}

/* --- Search Button link--- */
/* The clickable button to submit the search form */
.search-button-link {
  display: none;
width: 48px;
        height: 48px;
  /* background-color: var(--action-primary-bg-dark); */
  color: var(--icon-light);
  /* border: 3px solid transparent; */
  border-radius: var(--border-radius-lg);
  cursor: pointer;
  /* box-shadow: 0 1px 4px 0px rgba(5, 8, 34, 0.2); */
  align-items: center;
  justify-content: right;

}



/* Change the background of the button when the container is active */
.search-container:focus-within .search-button-link {
  background-color: var(--bg-component-blue-active);
  /* Ensure the icon color remains visible against the new background */
  color: var(--icon-x-light)
}

/* Provides visual feedback when hovering over the search button */
.search-button-link:hover{
  background-color: hsla(237, 40%, 50%, 0.2);
  color: var(--text-anchor-blue); 
}

/* Manages the size of the search icon inside the button */
.search-button-link i {
  font-size: 1.853rem;
   color: var(--text-anchor-light);
}
.search-button-link i:hover {

   
  color: var(--text-anchor-blue); 
}

/* --- Dropdown --- */
/* The container for displaying recent or suggested search results */
.recent-searches-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 9999;
  width: 297.06px;
  margin-top: 8px;
  padding-left: 0;
  list-style: none;
  background-color: var(--action-item-primary-light);
  border-radius: 0 0 var(--border-radius-xs) var(--border-radius-xs);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Styles individual result items within the dropdown list */
.recent-searches-dropdown li {
  padding: 10px 20px;
  cursor: pointer;
  color: var(--text-main-gray);
}

/* Handles interaction states (hover/selected) for dropdown list items */
.recent-searches-dropdown li:hover,
.recent-searches-dropdown li.selected {
  background-color: var(--action-item-hover);
}

/* --- Responsive Adjustments --- */
@media only screen and (max-width: 1280px) {
  .search-wrapper {
    width: 100%;
  }

  .search-container {
    margin-left: auto;
  }
}

@media only screen and (max-width: 1048px) {
  #search-input {

    width: 287px;
  }

  #search-input:focus {
    width: 300px;
  }
}

@media only screen and (max-width: 768px) {
  .search-wrapper {
    display: none;
  }


  /* --- Search Button link--- */
  /* The clickable button to submit the search form */
  .search-button-link {
    display: flex;
  }

  .recent-searches-dropdown {
    left: 18.08px;
    width: 371.11px;
    padding-inline: 18.08px;
  }
}