/* Search UI Styles */

/* Search Backdrop - separate from mega menu backdrop */
.search-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 900;
  /* High z-index to cover everything except search input */
  pointer-events: none;
}

.search-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  /* Enable clicking on backdrop to close */
}

/* Search Results Dropdown */
.search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  z-index: 950;
  /* Above backdrop (900) */
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-top: 0px;
  max-height: 500px;
}

.search-results-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header Form Container Adjustment for Dropdown */
.header-form {
  position: relative;
  /* z-index handled by active class */
}

.header-form.active-search {
  z-index: 1000;
  /* Above backdrop (900) and dropdown (950) */
}

/* Loading State */
.search-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.search-loading svg {
  width: 60px;
  height: 60px;
}

/* Search Results List */
.search-results-list {
  list-style: none;
  padding: 12px;
  margin: 0;
  max-height: 450px;
  overflow-y: auto;
}

/* Custom scrollbar */
.search-results-list::-webkit-scrollbar {
  width: 6px;
}

.search-results-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.search-results-list::-webkit-scrollbar-thumb {
  background: var(--main-color-one);
  border-radius: 10px;
}

.search-results-list::-webkit-scrollbar-thumb:hover {
  background: var(--main-color-one-hover);
}

.search-result-item {
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 15px;
  transition: all 0.2s ease;
  cursor: pointer;
  background: #fff;
  border: 1px solid transparent;
}

.search-result-item:last-child {
  margin-bottom: 0;
}

.search-result-item:hover {
  background: linear-gradient(135deg, #f8f4ff 0%, #fff5f5 100%);
  border-color: var(--main-color-one);
  transform: translateX(-4px);
  box-shadow: 0 4px 12px rgba(151, 78, 136, 0.1);
}

.search-result-image {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  object-fit: cover;
  margin-left: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.search-result-item:hover .search-result-image {
  transform: scale(1.05);
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-result-title {
  font-size: 15px;
  font-weight: bold;
  color: #1a1a1a;
  margin-bottom: 0;
  display: block;
  line-height: 1.4;
}

.search-result-category {
  font-size: 12px;
  color: #666;
  display: inline-block;
  padding: 3px 10px;
  background: #f0f0f0;
  border-radius: 20px;
  align-self: flex-start;
}

.search-result-price {
  font-size: 16px;
  color: var(--main-color-one);
  font-weight: bold;
  font-family: var(--title-font, inherit);
}

/* No Results */
.search-no-results {
  padding: 50px 20px;
  text-align: center;
  color: #999;
  font-size: 15px;
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.search-no-results::before {
  content: "🔍";
  display: block;
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* View All Results Link */
.search-view-all {
  display: block;
  padding: 15px 20px;
  text-align: center;
  color: var(--main-color-one);
  font-weight: bold;
  border-top: 2px solid #f0f0f0;
  transition: all 0.2s ease;
  background: #fff;
}

.search-view-all:hover {
  background: var(--main-color-one);
  color: #fff;
  text-decoration: none;
}

/* Mobile Specific Adjustments */
@media (max-width: 1199px) {
  /* Make search dropdown full width on mobile */
  .search-results-dropdown {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 70vh;
    margin-top: 0;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
  }

  .search-results-dropdown.active {
    transform: translateY(0);
  }

  .search-result-item {
    padding: 14px;
  }

  .search-result-image {
    width: 60px;
    height: 60px;
  }

  .search-result-title {
    font-size: 14px;
  }

  .search-result-price {
    font-size: 15px;
  }

  .header {
    z-index: 1500 !important;
  }
}

/* Search Close Button */
.search-close-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  background: var(--main-color-one, #974e88);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  box-shadow: 0 8px 25px rgba(151, 78, 136, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  white-space: nowrap;
}

.search-close-btn i {
  font-size: 12px;
  margin: 0 !important;
  padding: 0 !important;
}

.search-close-btn:hover {
  background: var(--main-color-one-hover, #7a3e6d);
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(151, 78, 136, 0.4);
}

/* Mobile close button adjustments */
@media (max-width: 1199px) {
  .search-close-btn {
    top: 15px;
    left: 15px;
    padding: 6px 12px;
    font-size: 10px;
  }
}
