/*
 * Styles for cmdk command palette.
 * cmdk is headless — all visual styling is provided here.
 * Uses [cmdk-*] attribute selectors and data-color-mode for theming.
 */

/* ─── Overlay ─── */
[data-cmdk-overlay] {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  animation: cmdk-overlay-in 120ms ease-out;
}

/* ─── Dialog content (Radix Content wrapper) ─── */
[data-cmdk-dialog] {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 560px;
  z-index: 10001;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  background: var(--color-background, #ffffff);
  color: var(--color-foreground, #1f2328);
  border: 1px solid var(--color-border-muted, #d1d9e0);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  outline: none;
  animation: cmdk-dialog-in 120ms ease-out;
}

@keyframes cmdk-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cmdk-dialog-in {
  from { opacity: 0; transform: translateX(-50%) scale(0.97); }
  to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* ─── Input ─── */
[cmdk-input] {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  border: none;
  border-bottom: 1px solid var(--color-border-muted, #d1d9e0);
  outline: none;
  background: transparent;
  color: var(--color-foreground, #1f2328);
  font-family: inherit;
}

[cmdk-input]::placeholder {
  color: var(--color-foreground-muted, #656d76);
}

/* ─── List ─── */
[cmdk-list] {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
}

/* ─── Group ─── */
[cmdk-group-heading] {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-foreground-muted, #656d76);
  padding: 8px 8px 4px;
  user-select: none;
}

/* ─── Item ─── */
[cmdk-item] {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  /* font-weight: 500; */
  cursor: pointer;
  user-select: none;
  color: var(--color-foreground, #1f2328);
  transition: background 0.1s;
}

[cmdk-item][data-selected="true"] {
  background: var(--color-background-neutral-muted, rgba(175, 184, 193, 0.2));
}

[cmdk-item]:active {
  background: var(--color-background-neutral-muted, rgba(175, 184, 193, 0.3));
}

/* ─── Item tag (background badge) ─── */
[data-cmdk-item-tag] {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--color-background-neutral-muted, rgba(175, 184, 193, 0.2));
  color: var(--color-foreground-muted, #656d76);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Separator ─── */
[cmdk-separator] {
  height: 1px;
  margin: 4px 14px;
  background: var(--color-border-muted, #d1d9e0);
}

/* ─── Empty state ─── */
[cmdk-empty] {
  padding: 2rem;
  text-align: center;
  color: var(--color-foreground-muted, #656d76);
  font-size: 14px;
}

/* ─── Dark mode ─── */
html[data-color-mode="dark"] [data-cmdk-dialog],
body[data-color-mode="dark"] [data-cmdk-dialog] {
  background: #2d333b;
  color: #e6edf3;
  border-color: #444c56;
}

html[data-color-mode="dark"] [cmdk-input],
body[data-color-mode="dark"] [cmdk-input] {
  color: #e6edf3;
  border-bottom-color: #444c56;
}

html[data-color-mode="dark"] [cmdk-input]::placeholder,
body[data-color-mode="dark"] [cmdk-input]::placeholder {
  color: #636e7b;
}

html[data-color-mode="dark"] [cmdk-group-heading],
body[data-color-mode="dark"] [cmdk-group-heading] {
  color: #768390;
}

html[data-color-mode="dark"] [cmdk-item],
body[data-color-mode="dark"] [cmdk-item] {
  color: #e6edf3;
}

html[data-color-mode="dark"] [cmdk-item][data-selected="true"],
body[data-color-mode="dark"] [cmdk-item][data-selected="true"] {
  background: rgba(99, 110, 123, 0.4);
}

html[data-color-mode="dark"] [cmdk-separator],
body[data-color-mode="dark"] [cmdk-separator] {
  background: #444c56;
}

html[data-color-mode="dark"] [cmdk-empty],
body[data-color-mode="dark"] [cmdk-empty] {
  color: #768390;
}

html[data-color-mode="dark"] [data-cmdk-overlay],
body[data-color-mode="dark"] [data-cmdk-overlay] {
  background: rgba(0, 0, 0, 0.7);
}

/* ─── Mobile responsiveness ─── */
@media (max-width: 640px) {
  [data-cmdk-dialog] {
    max-width: 100%;
    border-radius: 0;
    top: 0;
    width: 100%;
  }

  [cmdk-list] {
    max-height: 70vh;
  }
}
