/* ====================================
   Smart Search Overlay
   ==================================== */

/* Base Overlay */
.smart-search {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--pearl-white);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.smart-search.is-active {
  opacity: 1;
  visibility: visible;
}

/* Mobile Header */
.smart-search__mobile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #E8E8E8;
}

.smart-search__mobile-logo {
  height: 32px;
  width: auto;
}

/* Input Wrapper */
.smart-search__input-wrapper {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid #E8E8E8;
}

.smart-search__input {
  width: 100%;
  height: 56px;
  padding: 0 60px 0 20px;
  border: 1px solid #D1D1D1;
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  color: var(--velvet-black);
  background: var(--pearl-white);
  transition: border-color 0.2s ease;
}

.smart-search__input:focus {
  outline: none;
  border-color: var(--imperial-purple);
}

.smart-search__input::placeholder {
  color: #999;
}

/* Clear Button */
.smart-search__clear-btn {
  position: absolute;
  right: 55px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  color: var(--velvet-black);
  cursor: pointer;
  padding: 8px 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.smart-search__input:not(:placeholder-shown) ~ .smart-search__clear-btn {
  opacity: 1;
  visibility: visible;
}

.smart-search__clear-btn:hover {
  color: var(--imperial-purple);
}

/* Search Icon */
.smart-search__search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.smart-search__search-icon img {
  width: 20px;
  height: 20px;
}

/* Close Button */
.smart-search__close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--velvet-black);
  transition: color 0.2s ease;
}

.smart-search__close-btn:hover {
  color: var(--imperial-purple);
}

.smart-search__close-btn svg {
  width: 24px;
  height: 24px;
}

.smart-search__close-btn--desktop {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}

/* Suggestions View */
.smart-search__suggestions {
  padding: 0;
  margin: 0;
}

.smart-search__heading {
  font-family: var(--font-headline);
  font-size: 20px;
  font-weight: 700;
  color: var(--velvet-black);
  margin: 0 0 20px 0;
  padding: 30px 20px 0 40px;
}

.smart-search__suggestions-list {
  list-style: none;
  padding: 0 20px 0 40px;
  margin: 0;
}

.smart-search__suggestion-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  cursor: pointer;
  border-bottom: 1px solid #F0F0F0;
  transition: background-color 0.2s ease;
}

.smart-search__suggestion-item:hover {
  background-color: #FAFAFA;
}

.smart-search__suggestion-item:last-child {
  border-bottom: none;
}

.smart-search__chevron {
  width: 8px;
  height: 14px;
  margin-right: 16px;
  color: var(--velvet-black);
  flex-shrink: 0;
}

.smart-search__suggestion-item span {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 16px;
  color: var(--velvet-black);
}

/* Results View */
.smart-search__results {
  display: none;
  padding: 0;
}

.smart-search__results.is-active {
  display: block;
}

.smart-search__results-content {
  margin-bottom: 40px;
  padding: 30px 20px 0 40px;
}

/* Category Section */
.smart-search__category {
  margin-bottom: 40px;
}

.smart-search__category:last-child {
  margin-bottom: 0;
}

.smart-search__category-heading {
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
  color: var(--velvet-black);
  margin: 0 0 20px 0;
}

/* Products List */
.smart-search__products-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.smart-search__product-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.smart-search__product-item:hover {
  background-color: #FAFAFA;
}

.smart-search__product-image {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 16px;
  flex-shrink: 0;
}

.smart-search__product-name {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  line-height: 1.5;
  color: var(--velvet-black);
}

/* View All Results */
.smart-search__view-all {
  display: flex;
  align-items: center;
  padding: 20px 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--velvet-black);
  transition: color 0.2s ease;
}

.smart-search__view-all:hover {
  color: var(--imperial-purple);
}

.smart-search__view-all .smart-search__chevron {
  margin-right: 12px;
}

/* Filters */
.smart-search__filters {
  border-top: 1px solid #E8E8E8;
  padding: 30px 20px 0 20px;
}

.smart-search__filter-section {
  margin-bottom: 30px;
}

.smart-search__filter-section:last-child {
  margin-bottom: 0;
}

.smart-search__filter-heading {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  color: var(--velvet-black);
  margin: 0 0 16px 0;
}

/* Filter Options */
.smart-search__filter-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.smart-search__filter-option {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.smart-search__brand-logo {
  max-width: 60px;
  max-height: 24px;
  width: auto;
  height: auto;
  margin-right: 12px;
  object-fit: contain;
}

.smart-search__filter-checkbox,
.smart-search__filter-radio {
  display: none;
}

.smart-search__filter-label {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 15px;
  color: var(--velvet-black);
}

/* Filter Tags */
.smart-search__filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.smart-search__filter-tag {
  display: inline-block;
  padding: 8px 16px;
  background: var(--soft-gray);
  border-radius: 20px;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  color: var(--velvet-black);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.smart-search__filter-tag:hover {
  background: #E8E8E8;
}

/* Show/Hide states */
.smart-search__suggestions {
  display: block;
}

.smart-search__results.is-active ~ .smart-search__suggestions {
  display: none;
}

/* ====================================
   Desktop Styles (min-width: 1024px)
   ==================================== */

@media (min-width: 1024px) {
  /* Overlay positioning - below header */
  .smart-search {
    top: 84px; /* Desktop header height */
    height: calc(100% - 84px);
    padding-bottom: 0;
  }

  /* Hide mobile header on desktop */
  .smart-search__mobile-header {
    display: none;
  }

  /* Input wrapper - larger padding */
  .smart-search__input-wrapper {
    max-width: 1440px;
    margin: 0 auto;
    padding: 30px 60px;
  }

  .smart-search__input {
    height: 64px;
    font-size: 17px;
    padding: 0 140px 0 24px;
  }

  /* Clear button desktop position */
  .smart-search__clear-btn {
    right: 110px;
  }

  /* Search icon desktop position */
  .smart-search__search-icon {
    right: 80px;
  }

  /* Show desktop close button */
  .smart-search__close-btn--desktop {
    display: flex;
    right: 24px;
  }

  /* Suggestions - centered layout */
  .smart-search__suggestions {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0;
  }

  .smart-search__heading {
    font-size: 24px;
    margin-bottom: 24px;
    padding: 40px 60px 0 84px;
  }

  .smart-search__suggestions-list {
    padding: 0 60px 0 84px;
  }

  .smart-search__suggestion-item {
    padding: 18px 0;
  }

  .smart-search__suggestion-item span {
    font-size: 17px;
  }

  /* Results - two column layout */
  .smart-search__results {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 60px 0 84px;
    grid-template-columns: 1fr 320px;
    gap: 60px;
  }

  .smart-search__results.is-active {
    display: grid;
  }

  .smart-search__results-content {
    margin-bottom: 0;
    padding: 40px 0 0 0;
  }

  .smart-search__category-heading {
    font-size: 20px;
    margin-bottom: 24px;
  }

  .smart-search__product-item {
    padding: 14px 0;
  }

  .smart-search__product-name {
    font-size: 16px;
  }

  /* Filters sidebar */
  .smart-search__filters {
    border-top: none;
    border-left: 1px solid #E8E8E8;
    padding: 40px 0 0 40px;
  }

  .smart-search__filter-section {
    margin-bottom: 36px;
  }

  .smart-search__filter-heading {
    font-size: 17px;
    margin-bottom: 18px;
  }

  .smart-search__brand-logo {
    max-width: 80px;
    max-height: 28px;
  }

  .smart-search__filter-label {
    font-size: 16px;
  }

  .smart-search__filter-tag {
    font-size: 15px;
  }
}

/* ====================================
   Large Desktop (min-width: 1440px)
   ==================================== */

@media (min-width: 1440px) {
  .smart-search__input-wrapper {
    padding: 30px 80px;
  }

  .smart-search__heading {
    padding: 50px 80px 0 104px;
  }

  .smart-search__suggestions-list {
    padding: 0 80px 0 104px;
  }

  .smart-search__results {
    padding: 0 80px 0 104px;
    grid-template-columns: 1fr 360px;
    gap: 80px;
  }

  .smart-search__results-content {
    padding: 50px 0 0 0;
  }

  .smart-search__filters {
    padding: 50px 0 0 50px;
  }
}
