/* =================================================================== */
/* SEARCH POPUP STYLES                                                */
/* =================================================================== */

.searchOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1100;
  animation: fadeIn 0.3s ease;
  display: none; /* Hidden by default */
}

.searchPopup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ffffff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 1101;
  width: 90%;
  max-width: 600px;
  animation: slideUp 0.3s ease;
  display: none; /* Hidden by default */
}

.searchPopupContent {
  position: relative;
}

.searchCloseBtn {
  position: absolute;
  top: -12px;
  left: -12px;
  background: #ffffff;
  /* border: 1px solid #e5e5e5; */
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1;
  padding: 0px;
}

.searchCloseBtn:hover {
  background: #f8f8f8;
  border-color: #e74c3c;
  color: #e74c3c;
}

.searchForm {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.searchInput {
  flex: 1;
  padding: 15px 20px;
  font-size: 18px;
  border: 2px solid #e5e5e5;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.3s ease;
  font-family: 'Heebo', sans-serif;
  direction: rtl;
}

.searchInput:focus {
  border-color: #e74c3c;
}

.searchInput::placeholder {
  color: #999;
  font-size: 16px;
}

.searchSubmitBtn {
  background: #e74c3c;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 15px 20px;
  cursor: pointer;
  transition: background 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.searchSubmitBtn:hover {
  background: #c0392b;
}

.searchSubmitBtn svg {
  width: 24px;
  height: 24px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Mobile adjustments for search popup */
@media (max-width: 768px) {
  .searchPopup {
    width: 95%;
    padding: 25px;
  }
  
  .searchCloseBtn {
    min-width: 0px;
    top: -13px;
    left: -14px;
    width: 10px;
    height: 10px;
    min-height: 0px;
    font-size: 19px;
  }
  
  .searchInput {
    font-size: 16px;
    padding: 12px 15px;
  }
  
  .searchSubmitBtn {
    padding: 12px 15px;
  }
  
  .searchForm {
    gap: 10px;
  }
}

/* =================================================================== */
/* SEARCH RESULTS IN POPUP                                           */
/* =================================================================== */

.searchResults {
  margin-top: 20px;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #ffffff;
}

.searchResults:empty {
  display: none;
}

.searchLoading,
.noResults,
.searchError {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 16px;
}

.searchSection {
  border-bottom: 1px solid #f0f0f0;
}

.searchSection:last-child {
  border-bottom: none;
}

.searchSectionTitle {
  padding: 15px 20px 10px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  background: #f8f8f8;
  margin: 0;
  border-bottom: 1px solid #e5e5e5;
}

.searchItems {
  padding: 0;
}

.searchItem {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  color: #333;
  transition: all 0.3s ease;
}

.searchItem:last-child {
  border-bottom: none;
}

.searchItem:hover {
  background: #f8f8f8;
  color: #e74c3c;
}

.searchItemImage {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 6px;
  overflow: hidden;
}

.searchItemImage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.searchItemContent {
  flex: 1;
  text-align: right;
}

.searchItemTitle {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 5px 0;
  line-height: 1.3;
}

.searchItemTitle mark {
  background: #fff3cd;
  padding: 2px 4px;
  border-radius: 3px;
}

.searchItemPrice {
  font-size: 14px;
  font-weight: 600;
  color: #e74c3c;
}

.searchItemCount {
  font-size: 14px;
  color: #666;
  margin-right: 8px;
}

.searchItemExcerpt {
  font-size: 14px;
  color: #666;
  line-height: 1.4;
  margin-top: 5px;
}

.productItem {
  border-left: 3px solid #e3f2fd;
}

.categoryItem {
  border-left: 3px solid #f3e5f5;
}

.pageItem {
  border-left: 3px solid #e8f5e8;
}

.postItem {
  border-left: 3px solid #fff3e0;
}

.searchFooter {
  padding: 15px 20px;
  background: #f8f8f8;
  text-align: center;
  border-top: 1px solid #e5e5e5;
}

.viewAllResults {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #333;
  color: #ffffff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s ease;
}

.viewAllResults:hover {
  background: #555;
  color: #ffffff;
}

/* Mobile adjustments for search results */
@media (max-width: 768px) {
  .searchResults {
    max-height: 300px;
  }
  
  .searchItem {
    padding: 10px 15px;
    gap: 12px;
  }
  
  .searchItemImage {
    width: 40px;
    height: 40px;
  }
  
  .searchItemTitle {
    font-size: 14px;
  }
  
  .searchItemPrice,
  .searchItemCount,
  .searchItemExcerpt {
    font-size: 12px;
  }
  
  .searchSectionTitle {
    padding: 12px 15px 8px;
    font-size: 12px;
  }
}

/* Body class when search is open */
body.search-open {
  overflow: hidden;
}