/*
* Zahya Store - Enhanced Search Styles
* Version: 1.0
*/

/*--------------------------------------------------------------
# Enhanced Search Container
--------------------------------------------------------------*/
.enhanced-search-container {
  position: relative;
}

/* Input Group Styling */
.enhanced-search-container .input-group {
  box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.enhanced-search-container .input-group:focus-within {
  box-shadow: 0 5px 20px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  flex: 1;
}

/* Search Input */
.search-autocomplete {
  height: 50px;
  padding-left: 20px;
  padding-right: 70px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-right: none;
  font-size: 1rem;
  border-radius: 12px 0 0 12px !important;
  transition: all 0.3s ease;
}

.search-autocomplete:focus {
  box-shadow: none !important;
  border-color: var(--primary-color);
}

/* Search Spinner */
.search-spinner {
  position: absolute;
  right: 45px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  display: none;
}

.searching .search-spinner {
  display: block;
}

/* Search Clear Button */
.search-clear-btn {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: none;
}

.has-value .search-clear-btn {
  display: block;
}

.search-clear-btn:hover {
  color: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

/* Search Button */
.search-btn {
  min-width: 100px;
  height: 50px;
  border-radius: 0 12px 12px 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background-color: var(--primary-hover);
}

.search-btn i {
  transition: transform 0.2s ease;
}

.search-btn:hover i {
  transform: scale(1.1);
}

.search-btn-text {
  font-weight: 500;
}

/* Autocomplete Results Container */
.search-autocomplete-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--card-bg);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 10;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.3s ease;
}

.search-autocomplete-results.show {
  max-height: 300px;
  opacity: 1;
  margin-top: 2px;
}

/* Autocomplete Result Item */
.search-result-item {
  padding: 12px 15px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.search-result-item:hover {
  background-color: rgba(99, 102, 241, 0.05);
}

.search-result-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background-color: rgba(99, 102, 241, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: var(--primary-color);
  font-size: 18px;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 500;
  margin-bottom: 3px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-category {
  font-size: 12px;
  color: var(--text-muted);
}

.search-result-price {
  font-weight: 600;
  color: var(--primary-color);
  margin-left: 12px;
}

/* Search Tags */
.search-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.search-tag {
  font-size: 13px;
  color: var(--text-muted);
}

.search-tag i {
  color: var(--primary-color);
  margin-right: 4px;
}

.search-tag-link {
  display: inline-block;
  padding: 2px 10px;
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--primary-color);
  border-radius: 30px;
  font-size: 12px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.search-tag-link:hover {
  background-color: var(--primary-color);
  color: #fff;
  transform: translateY(-1px);
}

/*--------------------------------------------------------------
# Dark Theme Adjustments
--------------------------------------------------------------*/
.theme-dark .search-autocomplete {
  background-color: #1f1f2c;
  border-color: #2e2e3e;
  color: #e0e0e0;
}

.theme-dark .search-autocomplete:focus {
  border-color: var(--primary-color);
}

.theme-dark .search-autocomplete-results {
  background-color: #1f1f2c;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.theme-dark .search-result-item {
  border-bottom-color: #2e2e3e;
}

.theme-dark .search-result-item:hover {
  background-color: rgba(99, 102, 241, 0.15);
}

.theme-dark .search-result-title {
  color: #e0e0e0;
}

.theme-dark .search-result-category {
  color: #9e9e9e;
}

.theme-dark .search-tag-link {
  background-color: rgba(99, 102, 241, 0.15);
}

/*--------------------------------------------------------------
# Search Results Highlight 
--------------------------------------------------------------*/
.search-highlight {
  background-color: rgba(99, 102, 241, 0.2);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 600;
}

.theme-dark .search-highlight {
  background-color: rgba(99, 102, 241, 0.3);
}

/*--------------------------------------------------------------
# Search Not Found / Loading States
--------------------------------------------------------------*/
.search-message {
  padding: 15px;
  text-align: center;
  color: var(--text-muted);
}

.search-loading {
  padding: 20px;
  text-align: center;
}

.search-loading .spinner-border {
  color: var(--primary-color);
}

/* Suggestions */
.search-suggestion {
  font-weight: 500;
  color: var(--primary-color);
  margin-left: 5px;
  cursor: pointer;
}

.search-suggestion:hover {
  text-decoration: underline;
}

/* Did you mean section */
.did-you-mean {
  padding: 10px 15px;
  background-color: rgba(99, 102, 241, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.did-you-mean-text {
  font-size: 14px;
  color: var(--text-muted);
}

.theme-dark .did-you-mean {
  background-color: rgba(99, 102, 241, 0.1);
  border-bottom-color: #2e2e3e;
}
