/* Base styles */


:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #bfdbfe;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #f9fafb;
  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-700: #374151;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --rounded: 0.375rem;
  --rounded-lg: 0.5rem;
  --rounded-xl: 0.75rem;
  --transition: all 0.2s ease-in-out;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
}

/* Container */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--rounded);
  font-weight: 500;
  text-align: center;
  transition: var(--transition);
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* Forms */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--rounded);
  font-size: 1rem;
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Search Container */
.search-container {
  margin: 2rem auto;
  max-width: 48rem;
  width: 100%;
  padding: 0 1rem;
}

.search-wrapper {
  position: relative;
  width: 100%;
}

.search-form {
  position: relative;
  width: 100%;
}

.search-form-inner {
  display: flex;
  width: 100%;
  gap: 0.25rem;
}

.search-input-container {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  padding: 0.875rem 3rem 0.875rem 3rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 1rem;
  color: #1f2937;
  background-color: white;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-focused {
  border-color: #3b82f6;
}

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

.search-icon-svg {
  width: 100%;
  height: 100%;
}

.search-loading-icon {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: #3b82f6;
  animation: spin 1s linear infinite;
}

.clear-search-btn {
  position: absolute;
  right: 3.5rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.375rem;
  border-radius: 50%;
  color: #9ca3af;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clear-search-btn:hover {
  color: #4b5563;
  background-color: #f3f4f6;
}

.clear-search-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.clear-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  height: 3.5rem;
  border: none;
  border-radius: 0 0.75rem 0.75rem 0;
  background-color: #3b82f6;
  color: white;
  font-weight: 500;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.search-btn:hover:not(:disabled) {
  background-color: #2563eb;
  transform: scale(1.02);
}

.search-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

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

.search-btn-loading-icon {
  width: 1.25rem;
  height: 1.25rem;
  animation: spin 1s linear infinite;
}

/* Suggestions Dropdown */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  max-height: 24rem;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.suggestions-dropdown[x-show] {
  opacity: 1;
  transform: translateY(0);
}

/* Dropdown Transitions */
.dropdown-enter {
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}

.dropdown-enter-start {
  opacity: 0;
  transform: translateY(-5px);
}

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

.dropdown-leave {
  transition: opacity 75ms ease-in, transform 75ms ease-in;
}

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

.dropdown-leave-end {
  opacity: 0;
  transform: translateY(-5px);
}

/* Suggestion Items */
.suggestion-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
  border-bottom: 1px solid #f3f4f6;
}

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

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

.suggestion-item[aria-selected="true"] {
  background-color: #f3f4f6;
}

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

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

.suggestion-title {
  font-weight: 500;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-description {
  color: #6b7280;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.suggestions-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.suggestions-loading-spinner {
  position: relative;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3b82f6;
}

.loading-spinner {
  width: 2rem;
  height: 2rem;
  animation: spin 1s linear infinite;
}

.suggestions-loading-text {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
}

.suggestions-loading-query {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.suggestions-loading-query span {
  font-weight: 500;
  color: #1f2937;
}

/* Error State */
.suggestions-error {
  padding: 1.5rem;
}

.suggestions-error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.suggestions-error-icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background-color: #fef2f2;
  margin-bottom: 1rem;
}

.error-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: #dc2626;
}

.suggestions-error-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

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

.suggestions-error-message p {
  margin-bottom: 0.5rem;
}

.suggestions-error-actions {
  margin-top: 1rem;
}

.error-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  background-color: #dc2626;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

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

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

/* Empty State */
.suggestions-empty {
  padding: 2rem 1.5rem;
  text-align: center;
}

.empty-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: #9ca3af;
}

.empty-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.empty-message {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.empty-message span {
  font-weight: 500;
  color: #1f2937;
}

.empty-actions {
  margin-top: 1rem;
}

.empty-clear-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  background-color: #3b82f6;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease-in-out;
}

.empty-clear-btn:hover {
  background-color: #2563eb;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
  .search-form-inner {
    flex-direction: column;
  }
  
  .search-btn {
    width: 100%;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
  }
  
  .search-input {
    border-radius: 0.5rem;
  }
}

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

/* 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;
}

/* Hide element but keep it accessible */
[x-cloak] {
  display: none !important;
}

/* Loading spinner */
.animate-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive utilities */
@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 2rem;
  }
}
