/* Search functionality styles */

/* Search wrapper */
.search-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

/* Expanded search in mobile view */
.search-expanded {
  flex: 1;
  transition: all 0.3s ease;
}

/* Suggestions dropdown */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 85vh;
  overflow-y: auto;
  background: white;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  margin-top: 2px;
}

/* Скрываем контейнер подсказок из product-header.js */
.search-suggestions {
  display: none !important;
}

/* Отключаем стандартный список автозаполнения браузера */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  transition: background-color 5000s ease-in-out 0s;
}

/* Скрываем датасет браузера */
input::-webkit-calendar-picker-indicator,
input::-webkit-list-button,
input::-webkit-datalist-indicator,
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  display: none !important;
  -webkit-appearance: none;
  margin: 0;
}

/* Loading state */
.suggestions-dropdown .loading,
.suggestions-dropdown .error,
.suggestions-dropdown .no-results {
  padding: 15px;
  text-align: center;
  color: #666;
}

.suggestions-dropdown .error {
  color: #e74c3c;
}

/* Suggestion sections */
.suggestion-section {
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.suggestion-section:last-child {
  border-bottom: none;
}

.suggestion-section-title {
  font-size: 12px;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
  padding: 10px 15px 5px;
}

/* Suggestion items */
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 8px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
  text-decoration: none;
  color: inherit;
}

.suggestion-item:hover {
  background-color: #f5f5f5;
}

.suggestion-image {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 3px;
  overflow: hidden;
  margin-right: 10px;
  background-color: #f0f0f0;
  border: 1px solid #eee;
}

.suggestion-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.suggestion-text {
  flex: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  /* Общие стили для мобильного поиска */
  body.search-active {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  .mobile-search-overlay {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }
  
  .mobile-search-overlay.active {
    display: block;
  }
  
  .mobile-search-container {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 10px;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-direction: column;
  }
  
  .mobile-search-container.active {
    display: flex;
  }
  
  .mobile-search-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
  }
  
  .mobile-search-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 5px;
  }
  
  input.mobile-search-input {
    flex: 1;
    border: none;
    padding: 10px 5px;
    font-size: 16px;
    width: 100%;
    outline: none;
    background: transparent;
  }
  
  .mobile-search-back {
    background: none;
    border: none;
    padding: 5px 10px;
    margin-right: 5px;
    color: #0275d8;
    font-weight: bold;
    cursor: pointer;
  }
  
  .mobile-search-content {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: #fff;
    z-index: 1001;
    display: none !important; /* Скрыто по умолчанию с !important */
  }
  
  /* Класс для явного показа контента через JS */
  .mobile-search-content.visible {
    display: block !important;
  }
  
  /* Переопределения для мобильного режима */
  .mobile-suggestion-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
  }
  
  .mobile-suggestion-image {
    width: 50px;
    height: 50px;
    min-width: 50px;
    border-radius: 4px;
    overflow: hidden;
    margin-right: 15px;
    background-color: #f0f0f0;
    border: 1px solid #eee;
  }
  
  .mobile-suggestion-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  
  .mobile-suggestion-text {
    flex: 1;
    font-size: 16px;
  }
  
  .mobile-suggestion-section {
    padding: 10px 0;
  }
  
  .mobile-suggestion-section-title {
    font-size: 14px;
    font-weight: bold;
    color: #777;
    text-transform: uppercase;
    padding: 5px 15px;
    background: #f9f9f9;
  }
  
  /* Рендерим стандартные дропдауны по-другому на мобильных */
  .suggestions-dropdown {
    display: none !important;
  }
}

/* Search controls and pagination */

/* Стили для поиска в категории */
.category-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #eaeaea;
}

.category-search-form {
    display: flex;
    max-width: 600px;
    width: 100%;
    position: relative;
}

.category-search-input {
    flex-grow: 1;
    padding: 12px 18px;
    border: 1px solid #ddd;
    border-right: none;
    border-radius: 30px 0 0 30px;
    font-size: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05) inset;
    transition: all 0.2s ease;
    height: 46px;
}

.category-search-input:focus {
    outline: none;
    border-color: #2a9bd1;
    box-shadow: 0 0 0 3px rgba(42, 155, 209, 0.15);
}

.category-search-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    background: #2a7a9e;
    color: white;
    border: none;
    border-radius: 0 30px 30px 0;
    cursor: pointer;
    transition: background-color 0.3s;
    height: 46px;
    flex-shrink: 0;
}

.category-search-button:hover {
    background: #1d5b76;
}

.category-search-button svg {
    width: 20px;
    height: 20px;
}

.category-stats {
    font-size: 15px;
    color: #666;
    font-weight: 500;
    padding: 6px 12px;
    background: #f5f5f5;
    border-radius: 4px;
}

/* Search results styles */
.search-results-header {
    margin: 20px 0;
    padding: 15px;
    background: #f0f7fb;
    border-radius: 8px;
}

.search-results-header h2 {
    margin-top: 0;
    color: #2a7a9e;
}

.no-results {
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
}

.clear-search-button {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #2a7a9e;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.clear-search-button:hover {
    background-color: #1d5b76;
}

/* Стили для пагинации */
.pagination {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
    gap: 5px;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
}

.pagination-link:hover {
    background-color: #f5f5f5;
    border-color: #ccc;
}

.pagination-current {
    background-color: #2a7a9e;
    border-color: #2a7a9e;
    color: white;
    font-weight: bold;
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    color: #777;
}

/* Responsive styles */
@media (max-width: 768px) {
    .category-controls {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        margin-bottom: 15px;
    }
}
