/* ============================================
   PROFESSIONAL GLOBAL SEARCH SYSTEM
   Modern, Fast, Accessible Search Experience
   ============================================ */

/* Search Container - Overlay Mode */
.global-search-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.global-search-container.active {
  opacity: 1;
  pointer-events: all;
}

/* Search Input Wrapper */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 50px;
  padding: 1rem 1.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 700px;
  transform: translateY(-20px);
}

.global-search-container.active .search-input-wrapper {
  transform: translateY(0);
}

.search-input-wrapper:focus-within {
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

/* Search Icon */
.search-icon {
  color: #667eea;
  font-size: 1.3rem;
  margin-right: 1rem;
  transition: color 0.3s ease;
}

.search-input-wrapper:focus-within .search-icon {
  color: #764ba2;
}

/* Search Input */
.global-search-input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: #212529 !important;
  font-size: 1.1rem;
  padding: 0.25rem 0;
  outline: none !important;
  box-shadow: none !important;
}

.global-search-input::placeholder {
  color: #adb5bd;
  font-weight: 400;
}

.global-search-input:focus::placeholder {
  color: #dee2e6;
}

/* Clear Button */
.search-clear-btn {
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  display: none;
}

.search-clear-btn.visible {
  display: block;
}

.search-clear-btn:hover {
  color: #495057;
  transform: scale(1.1);
}

/* Close Button */
.search-close-btn {
  background: transparent;
  border: none;
  color: #adb5bd;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.4rem;
  margin-left: 0.5rem;
  transition: all 0.2s ease;
}

.search-close-btn:hover {
  color: #dc3545;
  transform: scale(1.1);
}

/* Loading Spinner */
.search-loading {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #e9ecef;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 0.5rem;
}

.search-loading.visible {
  display: block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Search Filters */
.search-filters {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 16px 16px 0 0;
  flex-wrap: wrap;
}

.search-filter-btn {
  padding: 0.4rem 1rem;
  border: 1px solid #dee2e6;
  background: #fff;
  color: #6c757d;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-filter-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.search-filter-btn.active {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: #667eea;
}

/* Search Results Dropdown */
.search-results-dropdown {
  position: absolute;
  top: calc(100% + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 90%;
  max-width: 700px;
}

.search-results-dropdown.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: all;
}

/* Custom Scrollbar */
.search-results-dropdown::-webkit-scrollbar {
  width: 8px;
}

.search-results-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0 16px 16px 0;
}

.search-results-dropdown::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.search-results-dropdown::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Search Header */
.search-results-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 16px 16px 0 0;
}

.search-results-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

.search-results-count {
  font-size: 0.8rem;
  color: #adb5bd;
}

/* Search Result Item */
.search-result-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f3f5;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
}

.search-result-item:last-child {
  border-bottom: none;
  border-radius: 0 0 16px 16px;
}

.search-result-item:hover {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  transform: translateX(4px);
}

/* Result Icon */
.result-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.search-result-item:hover .result-icon {
  transform: scale(1.1);
}

.result-icon.post {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}

.result-icon.business {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  color: #fff;
}

.result-icon.store {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  color: #fff;
}

/* Result Content */
.result-content {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #212529;
  margin: 0 0 0.25rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-description {
  font-size: 0.85rem;
  color: #6c757d;
  margin: 0 0 0.5rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

.result-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.75rem;
  color: #adb5bd;
}

.result-meta i {
  margin-right: 0.25rem;
}

/* Empty State */
.search-empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}

.search-empty-icon {
  font-size: 3rem;
  color: #dee2e6;
  margin-bottom: 1rem;
}

.search-empty-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.5rem;
}

.search-empty-text {
  font-size: 0.9rem;
  color: #6c757d;
}

/* View All Results Button */
.search-view-all {
  padding: 1rem 1.25rem;
  text-align: center;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 0 0 16px 16px;
}

.search-view-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
}

.search-view-all-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
  color: #fff;
  text-decoration: none;
}

/* Keyboard Navigation Highlight */
.search-result-item.keyboard-focus {
  background: linear-gradient(135deg, #e9ecef, #dee2e6);
  outline: 2px solid #667eea;
  outline-offset: -2px;
}

/* Mobile Responsive */
@media (max-width: 991px) {
  .global-search-container {
    padding-top: 15vh;
  }

  .search-input-wrapper {
    width: 95%;
    padding: 0.75rem 1rem;
  }

  .search-results-dropdown {
    max-height: 50vh;
    width: 95%;
  }
}

@media (max-width: 767px) {
  .global-search-container {
    padding-top: 10vh;
  }

  .search-input-wrapper {
    padding: 0.6rem 1rem;
  }

  .global-search-input {
    font-size: 1rem;
  }

  .search-icon {
    font-size: 1.1rem;
    margin-right: 0.75rem;
  }

  .result-icon {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .result-title {
    font-size: 0.9rem;
  }

  .result-description {
    font-size: 0.8rem;
  }
}
