/* Search modal overlay */
#search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  justify-content: center;
  align-items: flex-start;
  padding-top: 10vh;
}

#search-modal.active {
  display: flex;
}

#search-modal .search-container {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

#search-modal .search-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--borderLight);
  gap: 12px;
}

#search-modal .search-header svg {
  flex-shrink: 0;
  opacity: 0.5;
}

#search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.1rem;
  font-family: var(--fontBody);
  color: var(--textDark);
  background: transparent;
}

#search-input::placeholder {
  color: var(--textMedium);
}

#search-close {
  background: none;
  border: 1px solid var(--borderMedium);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.75rem;
  color: var(--textMedium);
  cursor: pointer;
  font-family: var(--fontBody);
}

#search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  max-height: 55vh;
}

#search-results li a {
  display: block;
  padding: 14px 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--borderLight);
  transition: background 0.15s;
}

#search-results li a:hover {
  background: var(--light);
}

#search-results li a strong {
  display: block;
  color: var(--textDark);
  font-size: 1rem;
  margin-bottom: 4px;
}

#search-results li a span {
  display: block;
  color: var(--textMedium);
  font-size: 0.85rem;
  line-height: 1.4;
}

#search-results .no-results {
  padding: 20px;
  text-align: center;
  color: var(--textMedium);
}

/*----------------------------------------------*/
/* Search toggle button in header nav            */
/*----------------------------------------------*/

header nav > ul > li.search-item .search-toggle {
  all: unset;
  cursor: pointer;
  box-sizing: border-box;
  font-weight: bold;
  color: var(--textDark);
  padding: 0.80rem 0 0.65rem 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: opacity 0.15s ease-in-out;
}

header nav > ul > li.search-item .search-toggle:hover {
  opacity: 0.7;
}

header nav > ul > li.search-item .search-toggle svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
  top: 0.25rem;
}

header nav > ul > li.search-item::after {
  content: none;
}

.search-label {
  display: none;
}

/*----------------------------------------------*/
/* Mobile menu overrides                         */
/*----------------------------------------------*/

body.mobilemenu header nav > ul > li.search-item .search-toggle {
  padding: 0.5rem 2.5rem 0.5rem 3rem;
  font-size: 1.15rem;
  width: 100%;
}

body.mobilemenu .search-label {
  display: inline;
}

body.mobilemenu.menushown header nav > ul > li.search-item .search-toggle {
  color: white;
}

body.mobilemenu header nav > ul > li.search-item .search-toggle svg {
  width: 18px;
  height: 18px;
  top: 0;
}

/*----------------------------------------------*/
/* Transparent header support                    */
/*----------------------------------------------*/

body.transparent_header header:not(.sticky) nav > ul > li.search-item .search-toggle {
  color: white;
}

/*----------------------------------------------*/
/* Search modal: mobile responsive               */
/*----------------------------------------------*/

@media (max-width: 767px) {
  #search-modal {
    padding-top: 5px;
    align-items: flex-start;
  }

  #search-modal .search-container {
    width: 100%;
    max-height: 85vh;
    border-radius: 0;
  }

  #search-results {
    max-height: 60vh;
  }
}
