/* ============================================
   InstaParadise Search Component Styles
   SEARCH-001: Client-side search styling
   ============================================ */

/* Search Container */
.search-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  z-index: 100;
}

.search-wrapper {
  position: relative;
}

/* Search Input Container */
.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.search-input-container:focus-within {
  box-shadow: 0 8px 30px rgba(14, 165, 233, 0.2), 0 0 0 2px rgba(14, 165, 233, 0.3);
  transform: translateY(-1px);
}

/* Search Icon */
.search-icon {
  width: 20px;
  height: 20px;
  margin-left: 18px;
  color: #9ca3af;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.search-input-container:focus-within .search-icon {
  color: #0ea5e9;
}

/* Search Input */
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 16px;
  font-size: 1rem;
  color: #1a1a2e;
  outline: none;
  font-family: inherit;
}

.search-input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

/* Clear Button */
.search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 8px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
}

.search-clear:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #374151;
}

.search-clear svg {
  width: 16px;
  height: 16px;
}

/* Search Results Dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  max-height: 450px;
  overflow-y: auto;
  padding: 8px 0;
}

.search-results.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Results Title */
.search-results-title {
  padding: 12px 20px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9ca3af;
}

/* Result Item */
.search-result-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 0 8px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  cursor: pointer;
}

.search-result-item:hover,
.search-result-item.selected {
  background: #f3f4f6;
}

.search-result-item.selected {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08) 0%, rgba(14, 165, 233, 0.04) 100%);
  box-shadow: inset 3px 0 0 #0ea5e9;
}

/* Result Content */
.search-result-content {
  flex: 1;
  min-width: 0;
}

.search-result-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.search-result-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1a1a2e;
}

.search-result-name mark {
  background: rgba(255, 107, 107, 0.2);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.search-result-rank {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8585 100%);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 20px;
}

/* Result Location */
.search-result-location {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 6px;
}

.search-result-location svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.search-result-location mark {
  background: rgba(14, 165, 233, 0.15);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

/* Result Tags */
.search-result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 20px;
}

/* Result Arrow */
.search-result-arrow {
  width: 20px;
  height: 20px;
  margin-left: 12px;
  color: #d1d5db;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.search-result-item:hover .search-result-arrow,
.search-result-item.selected .search-result-arrow {
  color: #0ea5e9;
  transform: translateX(3px);
}

/* No Results */
.search-no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px;
  text-align: center;
}

.no-results-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.search-no-results p {
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.no-results-hint {
  font-size: 0.85rem;
  color: #9ca3af;
}

/* Scrollbar Styling */
.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Hero Search Variant */
.hero-search .search-input-container {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.hero-search .search-input {
  font-size: 1.1rem;
  padding: 18px 20px;
}

.hero-search .search-icon {
  width: 24px;
  height: 24px;
  margin-left: 20px;
}

.hero-search .search-results {
  border-radius: 20px;
  top: calc(100% + 12px);
}

/* Compact Search (for navbar) */
.navbar-search {
  max-width: 320px;
}

.navbar-search .search-input-container {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.navbar-search .search-input-container:focus-within {
  background: white;
  border-color: transparent;
}

.navbar-search .search-input {
  color: white;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.navbar-search .search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.navbar-search .search-input-container:focus-within .search-input {
  color: #1a1a2e;
}

.navbar-search .search-input-container:focus-within .search-input::placeholder {
  color: #9ca3af;
}

.navbar-search .search-icon {
  color: rgba(255, 255, 255, 0.6);
}

.navbar-search .search-input-container:focus-within .search-icon {
  color: #0ea5e9;
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
  .search-input-container {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .search-input-container:focus-within {
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.3), 0 0 0 2px rgba(14, 165, 233, 0.4);
  }

  .search-input {
    color: #f1f5f9;
  }

  .search-input::placeholder {
    color: #64748b;
  }

  .search-results {
    background: #1e293b;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  }

  .search-results-title {
    color: #64748b;
  }

  .search-result-name {
    color: #f1f5f9;
  }

  .search-result-location {
    color: #94a3b8;
  }

  .search-result-item:hover,
  .search-result-item.selected {
    background: #334155;
  }

  .search-result-item.selected {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0.05) 100%);
  }

  .search-no-results p {
    color: #cbd5e1;
  }

  .search-clear {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
  }

  .search-clear:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .search-container {
    max-width: 100%;
    padding: 0 16px;
  }

  .hero-search .search-input {
    font-size: 1rem;
    padding: 16px;
  }

  .search-results {
    position: fixed;
    top: auto;
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-height: 60vh;
    border-radius: 20px;
    box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.2);
  }

  .search-result-item {
    padding: 14px;
  }

  .navbar-search {
    max-width: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
  }

  .navbar-search .search-input-container {
    background: rgba(255, 255, 255, 0.95);
  }

  .navbar-search .search-input {
    color: #1a1a2e;
  }
}

/* Focus visible for accessibility */
.search-input:focus-visible {
  outline: none;
}

.search-clear:focus-visible,
.search-result-item:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .search-input-container,
  .search-results,
  .search-result-item,
  .search-result-arrow {
    transition: none;
  }
}
