/* ========================================
   SMART SEARCH STYLING (.sx-search)
   ======================================== */

/* 1. Wrapper & Centering */
/* 1. Wrapper & Centering - FIXED */
/* We target the Joomla component directly so we don't shrink the header */
.sx-search .com-finder,
.sx-search .finder {
  max-width: var(--container-narrow); /* 800px */
  margin: 0 auto;
  padding: 40px 0;
}

/* Ensure the .sx-search class itself doesn't restrict the page width */
.sx-search {
  max-width: 100% !important;
}

/* Completely hide the "Search Terms:" label */
.sx-search form label,
.sx-search form legend {
  display: none !important; 
}

/* Centers the "Search Terms:" label relative to the box */
.sx-search form label,
.sx-search form legend {
  width: 100%;
  max-width: 600px;
  text-align: left;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--color-brand-gray);
  border: none; 
  padding: 0;
}

/* 3. The Input and Button Container */
.sx-search fieldset.word,
.sx-search .input-group,
.sx-search .js-finder-search-query {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  gap: 10px;
  width: 50%;
  max-width: 600px;
  border: none;
  padding: 0;
  margin: 0 auto !important; /* Forces true horizontal centering */
}

/* 3.5 FIX FOR AWESOMPLETE OVERLAP */
.sx-search .awesomplete {
  flex-grow: 1;
  width: 100%;
  position: relative !important;
  display: block !important; /* Removing flex here stops the overlap! */
}

/* Pushes the dropdown menu safely below the input box */
.sx-search .awesomplete > ul {
  z-index: 9999 !important;
  top: 100% !important; /* Forces it to the absolute bottom of the input */
  margin-top: 4px !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--border-radius-sm) !important;
}

/* 4. Fix the Input Box Size */
.sx-search input[type="text"],
.sx-search input.search-query {
  width: 100% !important; 
  margin: 0 !important; 
  padding: 0 16px;
  height: 46px !important; 
  border: 1px solid #d1d1d1;
  border-radius: var(--border-radius);
  font-family: var(--font-primary);
  font-size: var(--font-size-body);
  box-sizing: border-box !important; 
  transition: all 0.3s ease;
}

.sx-search input[type="text"]:focus,
.sx-search input.search-query:focus {
  outline: none;
  border-color: var(--color-brand-blue);
  box-shadow: 0 0 0 3px var(--color-bg-blue-tint);
}

/* 5. Fix the Button Alignment & Size */
.sx-search button[type="submit"],
.sx-search .btn.btn-primary {
  margin: 0 !important; 
  padding: 0 24px;
  height: 46px !important; 
  display: flex !important;
  align-items: center !important; 
  justify-content: center !important;
  background: var(--color-brand-blue);
  color: var(--color-white);
  border: 1px solid var(--color-brand-blue);
  border-radius: var(--border-radius);
  font-weight: 600;
  font-family: var(--font-primary);
  font-size: var(--font-size-body);
  cursor: pointer;
  transition: 0.3s ease;
}

/* 5.5 Fix the "QSearch" Icon Spacing */
.sx-search button[type="submit"] span[class^="icon-"],
.sx-search .btn.btn-primary span[class^="icon-"] {
  margin-right: 8px !important; /* Adds space between the magnifying glass and the text */
}

.sx-search button[type="submit"]:hover,
.sx-search .btn.btn-primary:hover {
  background: var(--color-brand-blue-dark);
  color: var(--color-white);
}

/* 4. Results Info Text ("31 results found") */
.sx-search .search-results-info,
.sx-search #search-result-empty {
  text-align: center;
  font-family: var(--font-primary);
  color: var(--color-brand-gray);
  margin-bottom: 30px;
  font-size: var(--font-size-body);
}

/* 5. The Results List Container */
.sx-search ul.search-results {
  list-style: none !important;
  padding: 0 !important;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 20px; /* Space between each result card */
}

/* 6. Individual Result Cards (Inheriting your .sx-card logic) */
.sx-search ul.search-results li {
  background: var(--color-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 25px;
  transition: all 0.3s ease;
  border: none;
  margin-bottom: 0;
}

.sx-search ul.search-results li:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

/* 7. Typography inside the Card */
.sx-search ul.search-results li h4,
.sx-search ul.search-results li .result-title {
  font-family: var(--font-headings);
  font-size: var(--font-size-h4);
  margin: 0 0 10px 0;
  line-height: 1.3;
}

.sx-search ul.search-results li h4 a,
.sx-search ul.search-results li .result-title a {
  color: var(--color-brand-blue);
  text-decoration: none;
  transition: 0.2s ease;
}

.sx-search ul.search-results li h4 a:hover,
.sx-search ul.search-results li .result-title a:hover {
  color: var(--color-brand-blue-dark);
}

.sx-search .result-text {
  font-family: var(--font-primary);
  font-size: var(--font-size-small);
  color: var(--color-brand-gray);
  line-height: 1.6;
  margin: 0;
}

/* 8. Fix the ugly yellow highlight - FIXED SPACING */
.sx-search mark,
.sx-search span.highlight {
  background-color: var(--color-bg-blue-tint);
  color: var(--color-brand-blue-dark);
  font-weight: 600;
  padding: 0; /* Removed the 4px horizontal padding */
  border-radius: 2px;
}