/* YetiSearch Simple Modal CSS
   Lightweight typeahead with grouped results
   Uses shared theme variables from yetisearch-pro-theme.css
*/

/* Modal container */
.ys-simple-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
}

.ys-simple-modal[aria-hidden="true"] {
  display: none;
}

/* Backdrop */
.ys-simple-backdrop {
  position: absolute;
  inset: 0;
  background: var(--ys-overlay-bg);
  backdrop-filter: var(--ys-overlay-blur);
  -webkit-backdrop-filter: var(--ys-overlay-blur);
}

/* Dialog */
.ys-simple-dialog {
  position: relative;
  width: 100%;
  max-width: 640px;
  margin: 0 16px;
  background: var(--ys-panel-bg);
  border: 1px solid var(--ys-border);
  border-radius: 12px;
  box-shadow: var(--ys-dialog-shadow);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  overflow: hidden;
}

/* Input wrapper */
.ys-simple-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ys-border);
  flex-shrink: 0;
}

.ys-simple-search-icon {
  width: 20px;
  height: 20px;
  color: var(--ys-text-muted);
  flex-shrink: 0;
}

.ys-simple-input-wrapper input {
  flex: 1;
  background: var(--ys-input-bg);
  border: 1px solid var(--ys-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--ys-input-text);
  outline: none;
}
.ys-simple-input-wrapper input:focus {
  border-color: var(--ys-accent, var(--ys-border));
}

.ys-simple-input-wrapper input::placeholder {
  color: var(--ys-input-placeholder);
}

.ys-simple-shortcut {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.ys-simple-shortcut kbd,
.ys-simple-command kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--ys-kbd-bg);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.75rem;
  color: var(--ys-kbd-text);
}

/* Results area */
.ys-simple-results {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--ys-scrollbar-thumb) var(--ys-scrollbar-track);
}

.ys-simple-results::-webkit-scrollbar {
  width: 8px;
}

.ys-simple-results::-webkit-scrollbar-track {
  background: var(--ys-scrollbar-track);
}

.ys-simple-results::-webkit-scrollbar-thumb {
  background: var(--ys-scrollbar-thumb);
  border-radius: 4px;
}

.ys-simple-results::-webkit-scrollbar-thumb:hover {
  background: var(--ys-scrollbar-thumb-hover);
}

/* Results header */
.ys-simple-results-header {
  padding: 8px 16px;
  font-size: 0.875rem;
  color: var(--ys-text-secondary);
  border-bottom: 1px solid var(--ys-border);
  background: var(--ys-panel-bg);
  position: sticky;
  top: 0;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.1s ease;
}

/* Loading state */
.ys-simple-loading {
  padding: 48px 16px;
  text-align: center;
  color: var(--ys-text-secondary);
}

.ys-simple-spinner {
  width: 24px;
  height: 24px;
  margin: 0 auto 12px;
  animation: ys-simple-spin 1s linear infinite;
  color: var(--ys-accent);
}

.ys-simple-spinner-track {
  opacity: 0.25;
}

.ys-simple-spinner-head {
  opacity: 0.75;
}

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

/* Empty state */
.ys-simple-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--ys-text-secondary);
  opacity: 1;
  transition: opacity 0.1s ease;
}

.ys-simple-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--ys-text-muted);
}

.ys-simple-empty-hint {
  font-size: 0.875rem;
  margin-top: 4px;
}

.ys-suggestion-link {
  color: var(--ys-accent);
  text-decoration: underline;
  cursor: pointer;
}

.ys-suggestion-link:hover {
  color: var(--ys-accent-hover);
}

/* Type more */
.ys-simple-type-more {
  padding: 48px 16px;
  text-align: center;
  color: var(--ys-text-secondary);
  opacity: 1;
  transition: opacity 0.1s ease;
}

/* Results list */
.ys-simple-results-list {
  padding: 8px 0;
  opacity: 1;
  transition: opacity 0.1s ease;
}

/* Group */
.ys-simple-group {
  margin-bottom: 8px;
}

.ys-simple-group:last-child {
  margin-bottom: 0;
}

.ys-simple-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ys-text-secondary);
  background: var(--ys-panel-bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.ys-simple-group-icon {
  width: 16px;
  height: 16px;
}

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

.ys-simple-result:hover {
  background: var(--ys-result-hover);
}

.ys-simple-result.selected {
  background: var(--ys-result-selected-bg);
  box-shadow: inset 0 0 0 1px var(--ys-result-selected-ring);
}

.ys-simple-result-icon {
  width: 20px;
  height: 20px;
  color: var(--ys-text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.ys-simple-result-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ys-simple-result-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ys-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ys-simple-result-title mark {
  background: var(--ys-highlight-bg);
  color: var(--ys-highlight-text);
  border-radius: 2px;
  padding: 0 2px;
}

.ys-simple-result-breadcrumb {
  font-size: 0.75rem;
  color: var(--ys-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ys-simple-result-snippet {
  font-size: 0.75rem;
  color: var(--ys-text-muted);
  margin-top: 2px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ys-simple-result-snippet mark {
  background: var(--ys-highlight-bg);
  color: var(--ys-highlight-text);
  border-radius: 2px;
  padding: 0 2px;
}

.ys-simple-result-arrow {
  width: 16px;
  height: 16px;
  color: var(--ys-text-muted);
  flex-shrink: 0;
  align-self: center;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ys-simple-result:hover .ys-simple-result-arrow,
.ys-simple-result.selected .ys-simple-result-arrow {
  opacity: 1;
}

/* Footer */
.ys-simple-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--ys-border);
  font-size: 0.75rem;
  color: var(--ys-text-secondary);
  flex-shrink: 0;
}

.ys-simple-commands {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ys-simple-command {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ys-simple-command kbd + kbd {
  margin-left: 2px;
}

.ys-simple-powered-by a {
  color: var(--ys-accent);
  text-decoration: none;
}

.ys-simple-powered-by a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 640px) {
  .ys-simple-modal {
    padding-top: 5vh;
  }

  .ys-simple-dialog {
    margin: 0 8px;
    max-height: 90vh;
  }

  .ys-simple-footer {
    flex-direction: column;
    gap: 8px;
  }

  .ys-simple-commands {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
}
