/* Command Palette - Cmd+K modal */

.command-palette {
  /* Reset dialog defaults */
  padding: 0;
  border: none;
  background: transparent;
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;

  /* Backdrop */
  &::backdrop {
    background: oklch(0% 0 0 / 50%);
    backdrop-filter: blur(4px);
  }

  /* Opening animation */
  &[open] {
    animation: command-palette-fade-in 150ms ease-out;
  }
  &[open]::backdrop {
    animation: command-palette-backdrop-in 150ms ease-out;
  }

  /* Closing animation */
  &[closing] {
    animation: command-palette-fade-out 100ms ease-in forwards;
  }
  &[closing]::backdrop {
    animation: command-palette-backdrop-out 100ms ease-in forwards;
  }
}

.command-palette__panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  outline: 1px solid oklch(0% 0 0 / 5%);
  outline-offset: -1px;
}

/* Input - remove all focus styling */
.command-palette__input {
  border: none;
  outline: none;
  box-shadow: none;

  &:focus {
    border: none;
    outline: none;
    box-shadow: none;
    --tw-ring-shadow: none;
  }
}

/* Item base and selection state */
.command-palette__item {
  outline: none;

  &:focus {
    outline: none;
  }

  &[hidden] {
    display: none;
  }

  /* Selected state - uses primary button colors for strong accent */
  &[aria-selected="true"] {
    background: var(--color-button-primary-bg);
    color: var(--color-button-primary-text);

    /* Icon becomes white/on-accent */
    svg {
      color: var(--color-button-primary-text);
    }

    /* "Jump to..." hint shows */
    .command-palette__hint {
      display: inline;
    }

    /* Keyboard shortcut adapts */
    .command-palette__shortcut {
      color: color-mix(in oklch, var(--color-button-primary-text), transparent 30%);
    }
  }
}

/* "Jump to..." hint hidden by default, shown on selection */
.command-palette__hint {
  display: none;
}

/* Animations */
@keyframes command-palette-fade-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes command-palette-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes command-palette-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes command-palette-backdrop-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
