/* Desktop Always-Active Search Bar */
@media (min-width: 769px) {
  .header-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: transparent !important;
    border: none !important;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 0 !important;
    padding: 2px 0;
    transition: border-color 0.3s ease;
  }

  header.scrolled .header-search-container,
  #productPage header:not(.scrolled) .header-search-container,
  #cartPage header:not(.scrolled) .header-search-container,
  #error404Page header:not(.scrolled) .header-search-container,
  .page-track header:not(.scrolled) .header-search-container,
  .single-product header:not(.scrolled) .header-search-container,
  .woocommerce-cart header:not(.scrolled) .header-search-container,
  .woocommerce-checkout header:not(.scrolled) .header-search-container,
  .woocommerce-account header:not(.scrolled) .header-search-container {
    background: transparent !important;
    border: none !important;
    border-bottom: 1.5px solid rgba(59, 36, 28, 0.25) !important;
    border-radius: 0 !important;
  }

  /* Desktop always keeps underline border on header-search-container */

  .header-search-input {
    width: 170px;
    opacity: 1;
    pointer-events: auto;
    padding: 4px 0px;
    border: none;
    outline: none;
    background: transparent;
    color: #ffffff;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    transition: color 0.3s ease;
  }

  header.scrolled .header-search-input,
  #productPage header:not(.scrolled) .header-search-input,
  #cartPage header:not(.scrolled) .header-search-input,
  #error404Page header:not(.scrolled) .header-search-input,
  .page-track header:not(.scrolled) .header-search-input,
  .single-product header:not(.scrolled) .header-search-input,
  .woocommerce-cart header:not(.scrolled) .header-search-input,
  .woocommerce-checkout header:not(.scrolled) .header-search-input,
  .woocommerce-account header:not(.scrolled) .header-search-input {
    color: var(--ruut-text);
  }

  .header-search-input::placeholder {
    color: rgba(255, 255, 255, 0.75);
  }

  header.scrolled .header-search-input::placeholder,
  #productPage header:not(.scrolled) .header-search-input::placeholder,
  #cartPage header:not(.scrolled) .header-search-input::placeholder,
  #error404Page header:not(.scrolled) .header-search-input::placeholder,
  .page-track header:not(.scrolled) .header-search-input::placeholder,
  .single-product header:not(.scrolled) .header-search-input::placeholder,
  .woocommerce-cart header:not(.scrolled) .header-search-input::placeholder,
  .woocommerce-checkout header:not(.scrolled) .header-search-input::placeholder,
  .woocommerce-account header:not(.scrolled) .header-search-input::placeholder {
    color: rgba(59, 36, 28, 0.6);
  }
}

/* Mobile Expand & Collapse Search Bar */
@media (max-width: 768px) {
  .header-search-container {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 0 !important;
    transition: border-color 0.3s ease;
    background: transparent !important;
    border: none !important;
    border-bottom: 1.5px solid transparent !important;
    padding: 0;
  }

  .header-search-container.active {
    background: transparent !important;
    border: none !important;
    border-bottom: 1.5px solid rgba(59, 36, 28, 0.25) !important;
    padding: 2px 0px;
  }

  .header-search-input {
    width: 0;
    opacity: 0;
    pointer-events: none;
    padding: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--ruut-text);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease, padding 0.3s ease;
  }

  .header-search-input::placeholder {
    color: rgba(59, 36, 28, 0.6);
  }

  .header-search-container.active .header-search-input {
    width: 125px;
    opacity: 1;
    pointer-events: auto;
    padding: 3px 0px;
  }
}

@media (max-width: 360px) {
  .header-search-container.active .header-search-input {
    width: 95px;
  }
}

.search-toggle-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: color 0.3s ease;
}

.search-toggle-btn svg {
  stroke: #ffffff;
  transition: stroke 0.3s ease;
}

.search-toggle-btn:hover,
.search-toggle-btn:hover svg {
  color: var(--ruut-accent);
  stroke: var(--ruut-accent);
}

.header-search-suggestions {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 320px;
  background-color: var(--ruut-white);
  border: 1px solid var(--ruut-border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.header-search-suggestions.active {
  display: block;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-decoration: none;
  color: var(--ruut-text);
  transition: background-color 0.2s ease;
}

.search-suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestion-item:hover {
  background-color: rgba(230, 222, 209, 0.4);
}

.search-suggestion-thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 4px;
}

.search-suggestion-info {
  display: flex;
  flex-direction: column;
}

.search-suggestion-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ruut-text);
}

.search-suggestion-price {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ruut-accent);
}
