/* ═══ COMMAND PALETTE ═════════════════════════════════════════════════════
   Ctrl+K / Cmd+K spotlight-style command palette with AI integration
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Backdrop ──────────────────────────────────────────────────────────── */
.cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 16, .85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.cmd-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

/* ── Panel ─────────────────────────────────────────────────────────────── */
.cmd-panel {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%) scale(.96) translateY(8px);
  width: 92vw;
  max-width: 640px;
  background: rgba(17, 18, 24, .95);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .04) inset;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.22, .68, 0, 1.1), opacity .2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cmd-panel.open {
  transform: translateX(-50%) scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Search Row ────────────────────────────────────────────────────────── */
.cmd-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.cmd-search-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--text3);
  opacity: .6;
}
.cmd-search-icon svg {
  width: 100%;
  height: 100%;
}
.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--ff);
  font-size: 15px;
  color: var(--text);
  caret-color: var(--accent);
}
.cmd-input::placeholder {
  color: var(--text3);
  opacity: .6;
}
.cmd-esc-hint {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text4);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 5px;
  padding: 3px 7px;
  letter-spacing: .04em;
  user-select: none;
}

/* ── Results Area ──────────────────────────────────────────────────────── */
.cmd-results {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cmd-results::-webkit-scrollbar { width: 4px; }
.cmd-results::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Group Label ───────────────────────────────────────────────────────── */
.cmd-group-label {
  padding: 10px 18px 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text4);
  letter-spacing: .08em;
  text-transform: uppercase;
  user-select: none;
}

/* ── Result Item ───────────────────────────────────────────────────────── */
.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background .12s ease;
  border-left: 2px solid transparent;
}
.cmd-item:hover {
  background: rgba(124, 147, 195, .06);
}
.cmd-item.selected {
  background: rgba(124, 147, 195, .1);
  border-left-color: var(--accent);
}
.cmd-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.cmd-item-text {
  flex: 1;
  min-width: 0;
}
.cmd-item-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}
.cmd-item-desc {
  font-size: 11.5px;
  color: var(--text3);
  line-height: 1.4;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmd-item-shortcut {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text4);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: .04em;
}

/* ── Empty State ───────────────────────────────────────────────────────── */
.cmd-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  line-height: 1.5;
}
.cmd-empty-hint {
  font-size: 11px;
  color: var(--text4);
  margin-top: 6px;
}

/* ── AI Response Area ──────────────────────────────────────────────────── */
.cmd-ai-section {
  border-top: 1px solid rgba(255, 255, 255, .06);
  padding: 14px 18px;
}
.cmd-ai-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 10px;
  user-select: none;
}
.cmd-ai-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: cmd-pulse 2s ease-in-out infinite;
}
@keyframes cmd-pulse {
  0%, 100% { opacity: .4; }
  50% { opacity: 1; }
}
.cmd-ai-response {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text2);
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cmd-ai-response::-webkit-scrollbar { width: 4px; }
.cmd-ai-response::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Typing indicator ──────────────────────────────────────────────────── */
.cmd-ai-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}
.cmd-ai-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text3);
  animation: cmd-dot-bounce .9s ease-in-out infinite;
}
.cmd-ai-typing span:nth-child(2) { animation-delay: .15s; }
.cmd-ai-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cmd-dot-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: .4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.cmd-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  user-select: none;
}
.cmd-footer-hints {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cmd-footer-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text4);
}
.cmd-footer-hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text3);
}
.cmd-footer-brand {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text4);
  letter-spacing: .04em;
  opacity: .5;
}

/* ── Mobile ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .cmd-panel {
    top: 10%;
    width: 96vw;
    max-width: none;
    border-radius: 12px;
  }
  .cmd-results {
    max-height: 50vh;
  }
  .cmd-footer-hints {
    display: none;
  }
  .cmd-esc-hint {
    display: none;
  }
  .nav-kbd-hint {
    display: none !important;
  }
}
