/**
 * SmartSearch Component Styles
 * Gmail-style search bar with field filtering
 */

/* Main wrapper */
.smart-search-wrapper {
  position: relative;
  width: 100%;
}

/* Input container */
.smart-search-input-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.625rem 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.smart-search-input-container:focus-within {
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
}

/* Search icon */
.smart-search-input-container > i.fa-search {
  color: #9ca3af;
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Input field */
.smart-search-input {
  flex: 1;
  min-width: 120px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.875rem;
  color: #1f2937;
}

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

/* Clear button */
.smart-search-clear {
  padding: 0.25rem;
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.smart-search-clear:hover {
  color: #6b7280;
  background: #f3f4f6;
}

/* Chips container */
.smart-search-chips-container {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

/* Filter chips */
.smart-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid rgba(251, 191, 36, 0.3);
  animation: chipEnter 0.2s ease-out;
}

@keyframes chipEnter {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.smart-search-chip i:first-child {
  opacity: 0.7;
  font-size: 0.625rem;
}

.smart-search-chip-remove {
  margin-left: 0.125rem;
  color: #b45309;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.15s ease;
}

.smart-search-chip-remove:hover {
  color: #78350f;
}

/* Dropdown */
.smart-search-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.5rem;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.12),
    0 4px 12px rgba(0, 0, 0, 0.08);
  z-index: 50;
  overflow: hidden;
  animation: dropdownEnter 0.15s ease-out;
}

@keyframes dropdownEnter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.smart-search-dropdown.hidden {
  display: none;
}

.smart-search-dropdown-content {
  max-height: 320px;
  overflow-y: auto;
}

/* Dropdown items */
.smart-search-item {
  display: block;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.smart-search-item:hover,
.smart-search-item.bg-amber-50 {
  background-color: #fffbeb;
}

.smart-search-item:active {
  background-color: #fef3c7;
}

/* Item with icon badge */
.smart-search-item .w-8 {
  flex-shrink: 0;
}

.smart-search-item .w-7 {
  flex-shrink: 0;
}

/* Keyboard shortcut badge */
.smart-search-item kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Consolas, monospace;
  background: #f3f4f6;
  color: #6b7280;
  border-radius: 0.25rem;
  border: 1px solid #e5e7eb;
}

/* Section headers in dropdown */
.smart-search-dropdown-content > .py-2 > p.text-xs {
  padding: 0.5rem 1rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .smart-search-input-container {
    padding: 0.5rem 0.75rem;
  }

  .smart-search-chip {
    font-size: 0.6875rem;
    padding: 0.1875rem 0.5rem;
  }

  .smart-search-dropdown {
    border-radius: 0.625rem;
  }

  .smart-search-item kbd {
    display: none;
  }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
  /* Can add dark mode styles here */
}

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

.smart-search-chip-remove:focus-visible,
.smart-search-clear:focus-visible {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

/* Scrollbar styling for dropdown */
.smart-search-dropdown-content::-webkit-scrollbar {
  width: 6px;
}

.smart-search-dropdown-content::-webkit-scrollbar-track {
  background: #f9fafb;
}

.smart-search-dropdown-content::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.smart-search-dropdown-content::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
