/**
 * Command Palette Styles
 *
 * Uses CSS Custom Properties from the Design System.
 */

/* Import design system variables */
@import url('../../../styles/design-system.css');

/* Modal customization */
.prorank-command-palette__modal {
  max-width: 600px;
  width: 90vw;
  max-height: 500px;
  margin-top: 10vh;
}

.prorank-command-palette__modal .components-modal__content {
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.prorank-command-palette__overlay {
  background: rgb(0 0 0 / 60%);
}

/* Main container */
.prorank-command-palette {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--pr-background-primary, #fff);
  border-radius: var(--pr-border-radius-medium, 8px);
  overflow: hidden;
}

/* Search section */
.prorank-command-palette__search {
  padding: var(--pr-spacing-medium, 16px);
  border-bottom: 1px solid var(--pr-border-light, #e0e0e0);
  background: var(--pr-background-light, #f9f9f9);
}

.prorank-command-palette__input {
  margin: 0;
}

.prorank-command-palette__input .components-text-control__input {
  font-size: var(--pr-font-size-large, 16px);
  padding: var(--pr-spacing-small, 8px) var(--pr-spacing-medium, 16px);
  border: 1px solid var(--pr-border-medium, #ccc);
  border-radius: var(--pr-border-radius-small, 4px);
  background: var(--pr-background-primary, #fff);
}

.prorank-command-palette__input .components-text-control__input:focus {
  outline: 2px solid var(--pr-color-primary, #2271b1);
  outline-offset: -2px;
  border-color: var(--pr-color-primary, #2271b1);
}

/* Results section */
.prorank-command-palette__results {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding: var(--pr-spacing-small, 8px);
  list-style: none;
}

.prorank-command-palette__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--pr-spacing-small, 8px) var(--pr-spacing-medium, 16px);
  margin-bottom: var(--pr-spacing-xsmall, 4px);
  border-radius: var(--pr-border-radius-small, 4px);
  cursor: pointer;
  transition: all var(--pr-motion-duration-fast, 200ms)
    var(--pr-motion-easing-standard, ease-in-out);
}

.prorank-command-palette__item:hover,
.prorank-command-palette__item.is-selected {
  background: var(--pr-background-hover, #f0f0f0);
}

.prorank-command-palette__item.is-selected {
  outline: 2px solid var(--pr-color-primary, #2271b1);
  outline-offset: -2px;
}

.prorank-command-palette__item.is-locked {
  opacity: 0.6;
}

.prorank-command-palette__item.is-locked:hover {
  background: var(--pr-background-hover, #f0f0f0);
}

/* Item content */
.prorank-command-palette__item-content {
  display: flex;
  flex-direction: column;
  gap: var(--pr-spacing-xsmall, 4px);
  flex: 1;
}

.prorank-command-palette__item-label {
  font-size: var(--pr-font-size-base, 14px);
  font-weight: var(--pr-font-weight-medium, 500);
  color: var(--pr-text-primary, #1e1e1e);
  line-height: 1.4;
}

.prorank-command-palette__item-description {
  font-size: var(--pr-font-size-small, 13px);
  color: var(--pr-text-secondary, #555);
  line-height: 1.4;
}

/* Lock icon */
.prorank-command-palette__item-lock {
  flex-shrink: 0;
  margin-left: var(--pr-spacing-small, 8px);
}

.prorank-command-palette__lock-icon {
  color: var(--pr-text-tertiary, #757575);
  padding: var(--pr-spacing-xsmall, 4px);
  min-width: auto;
}

.prorank-command-palette__lock-icon:hover {
  color: var(--pr-text-secondary, #555);
  background: transparent;
}

/* States */
.prorank-command-palette__loading,
.prorank-command-palette__error,
.prorank-command-palette__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--pr-spacing-xlarge, 32px);
  text-align: center;
  gap: var(--pr-spacing-medium, 16px);
}

.prorank-command-palette__loading p,
.prorank-command-palette__error p,
.prorank-command-palette__empty p {
  margin: 0;
  color: var(--pr-text-secondary, #555);
  font-size: var(--pr-font-size-base, 14px);
}

/* Footer */
.prorank-command-palette__footer {
  padding: var(--pr-spacing-small, 8px) var(--pr-spacing-medium, 16px);
  border-top: 1px solid var(--pr-border-light, #e0e0e0);
  background: var(--pr-background-light, #f9f9f9);
}

.prorank-command-palette__hint {
  display: block;
  font-size: var(--pr-font-size-xsmall, 11px);
  color: var(--pr-text-tertiary, #757575);
  text-align: center;
}

/* Accessibility improvements */
.prorank-command-palette__item:focus {
  outline: 2px solid var(--pr-color-primary, #2271b1);
  outline-offset: -2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .prorank-command-palette__item {
    border: 1px solid transparent;
  }

  .prorank-command-palette__item.is-selected {
    border-color: var(--pr-color-primary, #2271b1);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .prorank-command-palette__item {
    transition: none;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .prorank-command-palette {
    background: var(--pr-background-dark, #1e1e1e);
  }

  .prorank-command-palette__search,
  .prorank-command-palette__footer {
    background: var(--pr-background-dark-secondary, #2c2c2c);
    border-color: var(--pr-border-dark, #404040);
  }

  .prorank-command-palette__input .components-text-control__input {
    background: var(--pr-background-dark, #1e1e1e);
    border-color: var(--pr-border-dark, #404040);
    color: var(--pr-text-dark-primary, #e0e0e0);
  }

  .prorank-command-palette__item:hover,
  .prorank-command-palette__item.is-selected {
    background: var(--pr-background-dark-hover, #333);
  }

  .prorank-command-palette__item-label {
    color: var(--pr-text-dark-primary, #e0e0e0);
  }

  .prorank-command-palette__item-description {
    color: var(--pr-text-dark-secondary, #a0a0a0);
  }
}

/* WordPress Admin Dark Mode - Ensure readability */
.wp-admin.admin-color-modern .prorank-command-palette,
.wp-admin.admin-color-blue .prorank-command-palette {
  background: #fff;
}

.wp-admin.admin-color-modern .prorank-command-palette__search,
.wp-admin.admin-color-modern .prorank-command-palette__footer,
.wp-admin.admin-color-blue .prorank-command-palette__search,
.wp-admin.admin-color-blue .prorank-command-palette__footer {
  background: #f9f9f9;
  border-color: #e0e0e0;
}

.wp-admin.admin-color-modern .prorank-command-palette__input .components-text-control__input,
.wp-admin.admin-color-blue .prorank-command-palette__input .components-text-control__input {
  background: #fff;
  color: #1e1e1e;
}
