/* ==========================================================================
   Universal Search Command Palette Stylesheet v3.0 (Raycast / Spotlight UX)
   ========================================================================== */

/* Command Palette Backdrop */
.command-palette-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.command-palette-backdrop.open {
  opacity: 1;
  visibility: visible;
}

/* Command Palette Modal Box */
.command-palette-modal {
  width: 100%;
  max-width: 760px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.command-palette-backdrop.open .command-palette-modal {
  transform: translateY(0) scale(1);
}

/* Modal Search Input Header */
.palette-header {
  position: relative;
  display: flex;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.palette-search-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--primary-500);
  margin-right: 1rem;
}

.palette-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
}

.palette-esc-badge {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 600;
  background: var(--gray-100);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-subtle);
  cursor: pointer;
}

/* Results Content Area */
.palette-results-body {
  overflow-y: auto;
  padding: 0.75rem 0;
  flex-grow: 1;
}

/* Group Headers */
.result-group-header {
  padding: 0.6rem 1.5rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  background: var(--bg-secondary);
}

/* Grouped Result Cards */
.result-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s ease;
  cursor: pointer;
}

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

.result-card-item:hover,
.result-card-item.selected {
  background-color: var(--primary-50);
  outline: none;
}

.result-card-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.result-card-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.result-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

.result-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.result-card-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-tag {
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--text-subtle);
}

.badge-tag.verified {
  background: #dcfce7;
  color: #166534;
}

/* Zero Result Recommendation State */
.zero-results-box {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.zero-results-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.zero-results-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Footer Instructions */
.palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.775rem;
  color: var(--text-subtle);
}

.palette-shortcuts-guide {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.shortcut-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Mobile Layout Adaptations */
@media (max-width: 768px) {
  .command-palette-backdrop {
    padding: 0;
  }
  .command-palette-modal {
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
}
