/* ============================================================
   Command Palette — floating command bar (Cmd+K / Ctrl+K)
   ============================================================ */

/* ── Container ─────────────────────────────────────────────── */
.cmd-palette {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 640px;
  width: calc(100% - 48px);
  z-index: 45;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  flex-direction: column;
  overflow: hidden;
}

.cmd-palette.open {
  display: flex;
  flex-direction: column;
}

/* ── Conversation messages ─────────────────────────────────── */
.cmd-palette-messages {
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  display: none;
}

.cmd-palette-messages:not(:empty) {
  display: block;
}

.cmd-msg {
  padding: 6px 0;
  font-size: 13px;
  line-height: 1.5;
}

.cmd-msg-user {
  color: #374151;
  text-align: right;
}

.cmd-msg-assistant {
  color: #0d9488;
}

.cmd-msg-error {
  color: #dc2626;
}

/* ── Input row ─────────────────────────────────────────────── */
.cmd-palette-input-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 8px;
}

.cmd-palette-context {
  font-size: 11px;
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
  border-radius: 9999px;
  padding: 2px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cmd-palette-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 14px;
  background: transparent;
  font-family: inherit;
  min-width: 0;
}

.cmd-palette-input::placeholder {
  color: #9ca3af;
}

.cmd-palette-send {
  width: 32px;
  height: 32px;
  background: #14b8a6;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}

.cmd-palette-send:hover {
  background: #0d9488;
}

.cmd-palette-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cmd-palette-send svg {
  width: 16px;
  height: 16px;
}

/* ── Loading indicator ─────────────────────────────────────── */
.cmd-palette-loading {
  display: none;
  padding: 8px 16px;
  font-size: 12px;
  color: #6b7280;
  align-items: center;
  gap: 8px;
}

.cmd-palette.loading .cmd-palette-loading {
  display: flex;
}

.cmd-palette-dots {
  display: flex;
  gap: 4px;
}

.cmd-palette-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9ca3af;
  animation: cmd-dot-pulse 1.2s ease-in-out infinite;
}

.cmd-palette-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.cmd-palette-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes cmd-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* ── Keyboard hint ─────────────────────────────────────────── */
.cmd-palette-hint {
  position: fixed;
  bottom: 24px;
  right: 24px;
  font-size: 11px;
  color: #9ca3af;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 4px 10px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  opacity: 0.7;
  transition: opacity 0.2s;
  cursor: pointer;
  z-index: 44;
}

.cmd-palette-hint:hover {
  opacity: 1;
}

.cmd-palette.open ~ .cmd-palette-hint {
  display: none;
}
