/* search.css */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.search-modal-container {
  width: 100%;
  max-width: 650px;
  background: var(--bg-card, #ffffff);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color, #e5e7eb);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
}

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

.search-modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-input-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted, #6b7280);
}

.search-modal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.1rem;
  color: var(--text-base, #111827);
  padding: 0.25rem 0;
}

.search-modal-kbd {
  padding: 0.25rem 0.5rem;
  background: var(--bg-body, #f3f4f6);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 4px;
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-modal-results::-webkit-scrollbar {
  width: 6px;
}

.search-modal-results::-webkit-scrollbar-thumb {
  background: var(--border-color, #e5e7eb);
  border-radius: 10px;
}

.search-category-title {
  padding: 0.75rem 0.75rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  letter-spacing: 0.05em;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
  gap: 1rem;
}

.search-result-item:hover,
.search-result-item.selected {
  background: var(--bg-hover, #f9fafb);
}

.search-result-item.selected {
  background: var(--primary-color-light, rgba(59, 130, 246, 0.1));
}

.search-result-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body, #f3f4f6);
  border-radius: 6px;
  color: var(--primary-color, #3b82f6);
  flex-shrink: 0;
}

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

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

.search-result-title {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-base, #111827);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted, #6b7280);
}

.search-modal-footer {
  padding: 0.75rem 1rem;
  background: var(--bg-body, #f9fafb);
  border-top: 1px solid var(--border-color, #e5e7eb);
}

.search-modal-help {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-muted, #6b7280);
}

.help-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.help-item kbd {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e5e7eb);
  padding: 0 0.3rem;
  border-radius: 3px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

/* Dark Mode Support */
[data-theme="dark"] .search-modal-container {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .search-modal-header,
[data-theme="dark"] .search-modal-footer {
  border-color: #334155;
}

[data-theme="dark"] .search-modal-footer {
  background: #0f172a;
}

[data-theme="dark"] .search-modal-input {
  color: #f1f5f9;
}

[data-theme="dark"] .search-result-item:hover,
[data-theme="dark"] .search-result-item.selected {
  background: #334155;
}

[data-theme="dark"] .search-result-title {
  color: #f1f5f9;
}

[data-theme="dark"] .search-result-icon {
  background: #334155;
  color: #60a5fa;
}

[data-theme="dark"] .search-modal-kbd,
[data-theme="dark"] .help-item kbd {
  background: #0f172a;
  border-color: #334155;
  color: #94a3b8;
}

.search-history-remove {
  padding: 0.25rem;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted, #6b7280);
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-result-item:hover .search-history-remove {
  opacity: 1;
}

.search-history-remove:hover {
  background: var(--bg-body, #f3f4f6);
  color: var(--danger-color, #ef4444);
}

.search-history-remove svg {
  width: 1rem;
  height: 1rem;
}

[data-theme="dark"] .search-history-remove:hover {
  background: #475569;
}
