/**
 * Search AI plugin v1.1.0
 * Стилі результатів пошуку
 */

/* ============================================
   Search Sections (Products / News & Articles)
   ============================================ */
.search-section {
  margin-bottom: 30px;
}

.search-section-title {
  font-size: 20px;
  font-weight: 600;
  color: #333;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #ff7b31;
  display: inline-block;
}

.search-section-products .search-section-title {
  border-color: #28a745;
}

.search-section-articles .search-section-title {
  border-color: #007bff;
}

.search-section-topics .search-section-title {
  border-color: #9c27b0;
}

/* ============================================
   Results Grid
   ============================================ */
.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.products-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.articles-grid {
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

.topics-grid {
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
}

/* ============================================
   Result Card
   ============================================ */
.search-result-card {
  background: #f8f9fa;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.search-result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.search-result-card .result-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #ddd;
  display: block;
}

.search-result-card .result-content {
  padding: 15px;
}

/* ============================================
   Result Title
   ============================================ */
.search-result-card .result-title {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.search-result-card .result-title a {
  color: inherit;
  text-decoration: none;
}

.search-result-card .result-title a:hover {
  color: #ff7b31;
}

/* ============================================
   Result Meta (language, category)
   ============================================ */
.search-result-card .result-meta {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.search-result-card .result-lang {
  font-size: 11px;
  padding: 2px 8px;
  background: #e3f2fd;
  color: #1976d2;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.search-result-card .result-cat {
  font-size: 11px;
  color: #666;
  padding: 2px 8px;
  background: #f5f5f5;
  border-radius: 4px;
}

/* ============================================
   Topic Card (Forum)
   ============================================ */
.search-result-card.topic-card {
  border-left: 3px solid #9c27b0;
}

.search-result-card .result-topic-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #666;
}

.search-result-card .topic-author {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-result-card .topic-author::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #9c27b0;
  border-radius: 50%;
  opacity: 0.3;
}

.search-result-card .topic-replies {
  color: #9c27b0;
  font-weight: 500;
}

/* ============================================
   Result Description
   ============================================ */
.search-result-card .result-desc {
  font-size: 14px;
  color: #666;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Video Link
   ============================================ */
.search-result-card .result-video {
  margin-top: 10px;
}

.search-result-card .result-video a {
  color: #dc3545;
  font-size: 13px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.search-result-card .result-video a:hover {
  text-decoration: underline;
}

/* ============================================
   Results Info
   ============================================ */
.search-results-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 15px;
}

.search-results-count {
  color: #666;
  font-size: 14px;
}

/* ============================================
   Pagination
   ============================================ */
.search-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.search-pagination .pagination-info {
  color: #666;
  font-size: 14px;
}

.search-pagination .btn {
  padding: 10px 20px;
  background: #ff7b31;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.search-pagination .btn:hover {
  background: #e06b28;
}

.search-pagination .btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* ============================================
   Load More Button
   ============================================ */
.search-load-more {
  display: none;
  margin: 25px auto 0;
  padding: 12px 30px;
  background: #ff7b31;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.search-load-more:hover {
  background: #e06b28;
}

/* ============================================
   Suggestions
   ============================================ */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.search-suggestions.show {
  display: block;
}

.suggestion-item {
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #eee;
  transition: background 0.15s;
}

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

.suggestion-item:hover {
  background: #f8f9fa;
}

.suggestion-type {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 500;
}

.suggestion-type.history {
  background: #e3f2fd;
  color: #1976d2;
}

.suggestion-type.title {
  background: #e8f5e9;
  color: #388e3c;
}

/* ============================================
   Loading & States
   ============================================ */
.search-loading {
  text-align: center;
  padding: 40px;
}

.search-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff7b31;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* ============================================
   Initializing State
   ============================================ */
.search-initializing {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.search-initializing .search-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff7b31;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.search-initializing p {
  font-size: 16px;
  color: #666;
  margin: 0;
}

/* ============================================
   Empty State
   ============================================ */
.search-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.search-empty-state svg {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
  opacity: 0.5;
}

.search-empty-state h3 {
  margin-bottom: 10px;
  color: #333;
}

/* ============================================
   Error State
   ============================================ */
.search-error {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 6px;
  text-align: center;
}

.search-no-results {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 16px;
}

/* ============================================
   Legacy Support (old structure)
   ============================================ */
.new-search .search-preloader {
  display: flex;
  justify-content: center;
  align-items: center;
}

.new-search .search-preloader .preloader-item {
  display: none;
  margin-top: 30px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #ff7b31;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

.new-search .search-button-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;
}

.new-search .search-button-wrap .search-btn {
  width: 150px;
  background-color: #ff7b31;
  padding: 10px;
  border-radius: 20px;
  color: #fff;
  box-shadow: 4px 4px 6px -4px rgba(0, 0, 0, 0.2);
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.new-search .search-button-wrap .search-btn:hover {
  background-color: #fff;
  color: #ff7b31;
  border: 1px solid #ff7b31;
}

.hide-input {
  display: none !important;
  transition: ease-in-out 0.6s;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .search-results-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .search-result-card .result-image {
    height: 150px;
  }

  .search-results-info {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .search-pagination {
    flex-wrap: wrap;
  }
}