/* Command palette (⌘K) */

#cmdk {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  background: var(--bg-overlay, rgba(11, 15, 25, 0.85));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#cmdk[data-open="true"] {
  display: flex;
}

#cmdk .cmdk-panel {
  width: min(640px, calc(100vw - 32px));
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface, #1e293b);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
  border-radius: 12px;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

#cmdk .cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
}

#cmdk .cmdk-input-row .cmdk-icon {
  color: var(--text-muted, #9ca3af);
  font-size: 18px;
  line-height: 1;
}

#cmdk input.cmdk-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text-primary, #f9fafb);
  font-size: 16px;
  line-height: 1.4;
  padding: 0;
}

#cmdk input.cmdk-input::placeholder {
  color: var(--text-muted, #9ca3af);
}

#cmdk kbd.cmdk-hint {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
  font-family: inherit;
}

#cmdk .cmdk-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

#cmdk .cmdk-group-label {
  padding: 8px 18px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #9ca3af);
}

#cmdk .cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  cursor: pointer;
  color: var(--text-primary, #f9fafb);
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font: inherit;
}

#cmdk .cmdk-item[aria-selected="true"],
#cmdk .cmdk-item:hover {
  background: rgba(79, 138, 255, 0.14);
}

#cmdk .cmdk-item .cmdk-item-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

#cmdk .cmdk-item .cmdk-item-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

#cmdk .cmdk-item .cmdk-item-title {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#cmdk .cmdk-item .cmdk-item-subtitle {
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#cmdk .cmdk-empty,
#cmdk .cmdk-error {
  padding: 24px 18px;
  text-align: center;
  color: var(--text-muted, #9ca3af);
  font-size: 13px;
}

#cmdk .cmdk-footer {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding: 8px 18px;
  border-top: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
}

#cmdk .cmdk-footer kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-default, rgba(255, 255, 255, 0.12));
  border-radius: 3px;
  padding: 1px 5px;
  font-family: inherit;
  font-size: 10px;
  margin-right: 4px;
}

@media (max-width: 600px) {
  #cmdk {
    padding-top: 0;
    align-items: stretch;
  }
  #cmdk .cmdk-panel {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border: 0;
  }
}

/* Light-mode overrides (Lighthouse tests in light) */
html[data-theme="light"] #cmdk {
  background: rgba(20, 24, 40, 0.55);
}
html[data-theme="light"] #cmdk .cmdk-panel {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] #cmdk .cmdk-input-row {
  border-bottom-color: rgba(15, 23, 42, 0.12);
}
html[data-theme="light"] #cmdk input.cmdk-input {
  color: #0f172a;
}
html[data-theme="light"] #cmdk input.cmdk-input::placeholder,
html[data-theme="light"] #cmdk .cmdk-group-label,
html[data-theme="light"] #cmdk .cmdk-item .cmdk-item-subtitle,
html[data-theme="light"] #cmdk .cmdk-empty,
html[data-theme="light"] #cmdk .cmdk-footer {
  color: #475569;
}
html[data-theme="light"] #cmdk .cmdk-item {
  color: #0f172a;
}
html[data-theme="light"] #cmdk .cmdk-item[aria-selected="true"],
html[data-theme="light"] #cmdk .cmdk-item:hover {
  background: rgba(79, 138, 255, 0.12);
}
html[data-theme="light"] #cmdk kbd.cmdk-hint,
html[data-theme="light"] #cmdk .cmdk-footer kbd {
  background: rgba(15, 23, 42, 0.05);
  border-color: rgba(15, 23, 42, 0.12);
  color: #475569;
}
html[data-theme="light"] #cmdk .cmdk-footer {
  border-top-color: rgba(15, 23, 42, 0.12);
}
