/* ═══════════════════════════════════════════════════════════════════
   COSMEERA ADVANCED SEARCH SYSTEM - STYLES
   Inspired by Amazon, Flipkart, Myntra, Blinkit, and Zepto
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --search-brand: #E8602C;
  --search-brand-dark: #b5451b;
  --search-brand-light: #fff2ed;
  --search-border: rgba(232, 96, 44, 0.18);
  --search-bg-card: #ffffff;
  --search-bg-sidebar: #fcfaf8;
  --search-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --search-radius: 14px;
}

/* ══ SEARCH HIGHLIGHT ══ */
mark.search-highlight {
  background: rgba(232, 96, 44, 0.22);
  color: var(--search-brand-dark);
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 4px;
}

/* ══ STICKY SEARCH HEADER CONTAINER ══ */
header#header .header-search-row,
.home-page header#header.header-collapsed .header-search-row {
  transform: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.search-header-wrap {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.search-bar-redesign {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid var(--search-border);
  border-radius: 50px;
  padding: 4px 6px 4px 16px;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1001;
}

.search-bar-redesign:focus-within,
.search-bar-redesign.active {
  border-color: var(--search-brand);
  box-shadow: 0 6px 24px rgba(232, 96, 44, 0.16);
  background: #ffffff;
}

.search-bar-redesign .search-input-field {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  color: #1a1a1a;
  padding: 8px 0;
  min-width: 0;
}

.search-bar-redesign .search-input-field::placeholder {
  color: #8e8e93;
}

.search-btn-icon {
  background: transparent;
  border: none;
  color: #8e8e93;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-btn-icon:hover {
  color: var(--search-brand);
  background: rgba(232, 96, 44, 0.08);
}

.search-btn-voice {
  color: var(--search-brand);
}

.search-btn-voice.listening {
  color: #ffffff;
  background: var(--search-brand);
  animation: voicePulse 1.2s infinite;
}

@keyframes voicePulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 96, 44, 0.6); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(232, 96, 44, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(232, 96, 44, 0); }
}

.search-btn-submit {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--search-brand), var(--search-brand-dark));
  color: #ffffff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
  flex-shrink: 0;

}

.search-btn-submit:hover {
  transform: scale(1.04);
  opacity: 0.95;
}

/* ══ AUTOCOMPLETE POPUP DROPDOWN ══ */
.search-autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 16px;
  z-index: 1000;
  display: none;
  max-height: 480px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.search-autocomplete-dropdown.open {
  display: block;
  animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ac-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #8e8e93;
  margin-bottom: 8px;
  padding: 4px 6px;
}

.ac-clear-history-btn {
  background: none;
  border: none;
  color: var(--search-brand);
  font-size: 0.74rem;
  cursor: pointer;
  font-weight: 600;
}

.ac-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.ac-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f4f4f6;
  color: #2c2c2e;
  padding: 6px 12px;
  border-radius: 30px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ac-chip:hover {
  background: var(--search-brand-light);
  color: var(--search-brand-dark);
}

.ac-chip-remove {
  color: #a1a1a6;
  font-size: 0.72rem;
  margin-left: 2px;
}

.ac-chip-remove:hover {
  color: #ef4444;
}

.ac-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.ac-item-row:hover {
  background: #f8f8fa;
}

.ac-item-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #eaeaea;
}

.ac-item-info {
  flex: 1;
  min-width: 0;
}

.ac-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item-sub {
  font-size: 0.76rem;
  color: #8e8e93;
}

.ac-item-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--search-brand);
}

/* ══ SEARCH PAGE CONTAINER ══ */
.search-page-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px 16px 60px 16px;
}

/* ══ SEARCH PAGE HEADER STRIP ══ */
.search-page-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.search-title-box h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0 0 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-results-count {
  font-size: 0.88rem;
  color: #6e6e73;
  font-weight: 500;
}

.search-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-mobile-filter-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--search-brand-light);
  color: var(--search-brand-dark);
  border: 1px solid var(--search-border);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.search-sort-select {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 30px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #2c2c2e;
  outline: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.search-sort-select:focus {
  border-color: var(--search-brand);
}

/* ══ SEARCH LAYOUT GRID ══ */
.search-layout-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

/* ══ FILTER SIDEBAR ══ */
.search-filter-sidebar {
  background: var(--search-bg-sidebar);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 20px;
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.filter-sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.filter-sidebar-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #1c1c1e;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-clear-all {
  background: none;
  border: none;
  color: var(--search-brand);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.filter-clear-all:hover {
  text-decoration: underline;
}

.filter-section {
  margin-bottom: 20px;
}

.filter-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #3a3a3c;
  margin-bottom: 10px;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-checkbox-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #48484a;
  cursor: pointer;
  user-select: none;
}

.filter-checkbox-label input[type="checkbox"] {
  accent-color: var(--search-brand);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.filter-count-badge {
  font-size: 0.75rem;
  color: #8e8e93;
  background: #f0f0f2;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 500;
}

.filter-search-box {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-bottom: 8px;
  outline: none;
}

.filter-price-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-price-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
}

/* ══ RESPONSIVE PRODUCT GRID ══ */
.search-products-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

/* Equal Height Cards */
.search-product-card {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.search-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--search-shadow);
  border-color: rgba(232, 96, 44, 0.3);
}

.sp-card-img-wrap {
  position: relative;
  width: 100%;
  padding-top: 100%;
  background: #f9f9fb;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 10px;
  cursor: pointer;
}

.sp-card-img {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.sp-card-img-wrap:hover .sp-card-img {
  transform: scale(1.05);
}

.sp-badge-discount {
  position: absolute;
  top: 8px; left: 8px;
  background: #22c55e;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 6px;
  text-transform: uppercase;
}

.sp-btn-wishlist {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  display: flex; align-items: center; justify-content: center;
  color: #8e8e93;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.sp-btn-wishlist.active,
.sp-btn-wishlist:hover {
  color: #ef4444;
  background: #ffffff;
}

.sp-card-meta {
  font-size: 0.72rem;
  color: #8e8e93;
  margin-bottom: 4px;
}

.sp-card-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1c1c1e;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.3em;
  cursor: pointer;
}

.sp-card-title:hover {
  color: var(--search-brand);
}

.sp-rating-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #f59e0b;
  margin-bottom: 8px;
}

.sp-rating-row .review-count {
  color: #8e8e93;
  font-size: 0.72rem;
}

.sp-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}

.sp-price-selling {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--search-brand);
}

.sp-price-original {
  font-size: 0.78rem;
  color: #8e8e93;
  text-decoration: line-through;
}

.sp-btn-add-cart {
  width: 100%;
  padding: 8px 12px;
  border-radius: 25px;
  background: #ffffff;
  border: 1.5px solid var(--search-brand);
  color: var(--search-brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.sp-btn-add-cart:hover {
  background: var(--search-brand);
  color: #ffffff;
}

/* ══ PAGINATION CONTROLS ══ */
.search-pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
}

.pgn-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background: #ffffff;
  color: #2c2c2e;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pgn-btn.active {
  background: var(--search-brand);
  color: #ffffff;
  border-color: var(--search-brand);
}

.pgn-btn:hover:not(.active) {
  border-color: var(--search-brand);
  color: var(--search-brand);
}

/* ══ NO RESULTS STATE ══ */
.search-no-results {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.no-results-icon {
  font-size: 3.5rem;
  color: var(--search-brand);
  margin-bottom: 16px;
  opacity: 0.8;
}

.no-results-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #1c1c1e;
  margin-bottom: 8px;
}

.no-results-sub {
  font-size: 0.9rem;
  color: #8e8e93;
  margin-bottom: 24px;
}

/* ══ RESPONSIVE BREAKPOINTS ══ */
@media (max-width: 1200px) {
  .search-products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 992px) {
  .search-layout-grid {
    grid-template-columns: 1fr;
  }

  .search-filter-sidebar {
    display: none; /* Hide sticky sidebar, use slide-out drawer on mobile */
  }

  .search-mobile-filter-btn {
    display: flex;
  }

  .search-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .search-products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .search-product-card {
    padding: 8px;
    border-radius: 12px;
  }

  .sp-card-title {
    font-size: 0.82rem;
  }

  .sp-price-selling {
    font-size: 0.95rem;
  }
}
