/* Search Component Styles */
.search-container {
  position: relative;
  max-width: 48rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.search-form {
  position: relative;
  display: flex;
  width: 100%;
  gap: 0.5rem;
}

.search-input-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.75rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #1a202c;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.search-input:focus {
  border-color: #4299e1;
  outline: 0;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.25);
}

.search-input::placeholder {
  color: #a0aec0;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #a0aec0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  z-index: 10;
}

.clear-search-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease-in-out;
  width: 1.5rem;
  height: 1.5rem;
  z-index: 10;
}

.clear-search-btn:hover {
  color: #718096;
  background-color: #f1f5f9;
}

.clear-search-btn:focus {
  outline: none;
  color: #2d3748;
  background-color: #e2e8f0;
}

.search-btn {
  margin-left: 0.5rem;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: white;
  background-color: #4299e1;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.search-btn:hover {
  background-color: #3182ce;
}

.search-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

.search-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: #a0aec0;
}

.search-btn-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
}

/* Suggestions Dropdown */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 20rem;
  margin-top: 0.5rem;
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow-y: auto;
  z-index: 50;
  opacity: 0;
  transform: translateY(-0.5rem);
  transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out;
  pointer-events: none;
}

.suggestions-dropdown[aria-expanded="true"] {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Loading State */
.suggestions-loading {
  padding: 1.5rem;
  text-align: center;
}

.loading-spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 0.25rem solid rgba(66, 153, 225, 0.3);
  border-radius: 50%;
  border-top-color: #4299e1;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

.search-loading-text {
  font-size: 0.875rem;
  color: #4a5568;
  margin-bottom: 0.25rem;
}

.search-loading-query {
  font-size: 0.75rem;
  color: #a0aec0;
}

/* Error State */
.search-error {
  padding: 1.5rem;
  text-align: center;
}

.error-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: #e53e3e;
  margin: 0 auto 1rem;
}

.suggestions-error-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.5rem;
}

.suggestions-error-message {
  font-size: 0.875rem;
  color: #718096;
  margin-bottom: 1rem;
}

.error-retry-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #2b6cb0;
  background-color: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out;
}

.error-retry-btn:hover {
  background-color: #bee3f8;
}

.error-retry-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.5);
}

.retry-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.375rem;
}

/* No Results State */
.search-no-results {
  padding: 1.5rem;
  text-align: center;
}

.no-results-icon {
  width: 3rem;
  height: 3rem;
  color: #a0aec0;
  margin: 0 auto 1rem;
}

.no-results-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
  margin-bottom: 0.25rem;
}

.no-results-text {
  font-size: 0.875rem;
  color: #718096;
}

/* Suggestions List */
.suggestions-list {
  padding: 0.5rem 0;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: background-color 0.15s ease-in-out;
}

.suggestion-item:hover,
.suggestion-item-selected {
  background-color: #f7fafc;
}

.suggestion-icon {
  margin-right: 0.75rem;
  color: #a0aec0;
  flex-shrink: 0;
}

.suggestion-icon-svg {
  width: 1.25rem;
  height: 1.25rem;
}

.suggestion-text {
  flex: 1;
  min-width: 0;
}

.suggestion-title {
  display: block;
  font-size: 0.9375rem;
  color: #2d3748;
  margin-bottom: 0.125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-meta {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: #718096;
}

.suggestion-meta-icon {
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.25rem;
  color: #a0aec0;
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.dropdown-enter {
  opacity: 0;
  transform: translateY(-0.5rem);
}

.dropdown-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.dropdown-leave {
  opacity: 1;
  transform: translateY(0);
}

.dropdown-leave-active {
  opacity: 0;
  transform: translateY(-0.5rem);
  transition: opacity 0.15s ease-in, transform 0.15s ease-in;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .search-form {
    flex-direction: column;
  }
  
  .search-btn {
    margin-left: 0;
    width: 100%;
    padding: 0.75rem;
  }
  
  .suggestions-dropdown {
    position: fixed;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 60vh;
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1), 0 -2px 4px -1px rgba(0, 0, 0, 0.06);
    transform: translateY(100%);
  }
  
  .suggestions-dropdown[aria-expanded="true"] {
    transform: translateY(0);
  }
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

[x-cloak] {
  display: none !important;
}
