/* ── Command Palette ──────────────────────────────────────────────────────── */

#cmd-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  backdrop-filter: blur(2px);
}
#cmd-backdrop.open { display: flex; }

#cmd-palette {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.12);
  overflow: hidden;
  animation: cmdSlideIn 0.15s ease;
}
@keyframes cmdSlideIn {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);      opacity: 1; }
}

#cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e9ecef;
}
#cmd-input-wrap .cmd-icon { color: #6c757d; font-size: 1rem; flex-shrink: 0; }
#cmd-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  background: transparent;
  color: #212529;
}
#cmd-input::placeholder { color: #adb5bd; }
#cmd-hint {
  font-size: 0.7rem;
  color: #adb5bd;
  white-space: nowrap;
}

#cmd-results {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.4rem 0;
}

.cmd-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #adb5bd;
  padding: 0.5rem 1rem 0.2rem;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  color: #212529;
  transition: background 0.1s;
}
.cmd-item:hover, .cmd-item.active {
  background: #f0f4ff;
  color: #0d6efd;
}
.cmd-item .cmd-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f3f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  color: #495057;
}
.cmd-item.active .cmd-item-icon { background: #dbeafe; color: #0d6efd; }
.cmd-item .cmd-item-label { font-size: 0.9rem; flex: 1; }
.cmd-item .cmd-item-tag {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: #e9ecef;
  color: #6c757d;
}
.cmd-item .cmd-item-shortcut {
  font-size: 0.7rem;
  color: #adb5bd;
  font-family: monospace;
}

#cmd-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
}
.cmd-key {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: #6c757d;
}
.cmd-key kbd {
  background: #e9ecef;
  border: 1px solid #ced4da;
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  font-size: 0.65rem;
  font-family: monospace;
  color: #495057;
  box-shadow: 0 1px 0 #ced4da;
}

/* Dark mode */
body.dark-mode #cmd-palette { background: #1a1a2e; }
body.dark-mode #cmd-input-wrap { border-bottom-color: #0f3460; }
body.dark-mode #cmd-input { color: #e0e0e0; }
body.dark-mode #cmd-input::placeholder { color: #555; }
body.dark-mode .cmd-item { color: #e0e0e0; }
body.dark-mode .cmd-item:hover, body.dark-mode .cmd-item.active { background: #0f3460; color: #60a5fa; }
body.dark-mode .cmd-item .cmd-item-icon { background: #0f3460; color: #aaa; }
body.dark-mode .cmd-item.active .cmd-item-icon { background: #1e3a5f; color: #60a5fa; }
body.dark-mode .cmd-item .cmd-item-tag { background: #0f3460; color: #aaa; }
body.dark-mode #cmd-footer { background: #16213e; border-top-color: #0f3460; }
body.dark-mode .cmd-key kbd { background: #0f3460; border-color: #1a4a80; color: #ccc; }

/* Mobile */
@media (max-width: 640px) {
  #cmd-backdrop { padding-top: 0; align-items: flex-end; }
  #cmd-palette { border-radius: 16px 16px 0 0; max-width: 100%; }
}
