/**
 * Dynamic Variables Component Styles
 *
 * @package ProRank\SEO\Admin\Components
 * @since   1.0.0
 */

.prorank-dynamic-variables {
  display: inline-block;
  vertical-align: middle;
}

.prorank-dynamic-variables__trigger {
  margin-left: var(--pr-spacing-2);
}

.prorank-dynamic-variables__popover {
  min-width: var(--pr-size-80);
  max-width: var(--pr-size-100);
  max-height: var(--pr-size-125);
  overflow-y: auto;
}

.prorank-dynamic-variables__header {
  padding: var(--pr-spacing-4) var(--pr-spacing-4) var(--pr-spacing-3);
  border-bottom: var(--pr-border-width) solid var(--wp-admin-theme-color-darker-10, var(--pr-color-border));
}

.prorank-dynamic-variables__header h3 {
  margin: 0 0 var(--pr-spacing-1);
  font-size: var(--pr-font-size-sm);
  font-weight: var(--pr-font-weight-semibold);
  color: var(--wp-admin-theme-color-darker-20, var(--pr-color-text-primary));
}

.prorank-dynamic-variables__header .description {
  margin: 0;
  font-size: var(--pr-font-size-xs);
  color: var(--pr-color-text-tertiary);
}

.prorank-dynamic-variables__list {
  padding: var(--pr-spacing-2) 0;
}

.prorank-dynamic-variables__item {
  padding: var(--pr-spacing-2) var(--pr-spacing-4) !important;
  cursor: pointer;
  transition: background-color var(--pr-transition-fast) ease;
}

.prorank-dynamic-variables__item:hover {
  background-color: var(--pr-color-background-hover);
}

.prorank-dynamic-variables__item:focus {
  background-color: var(--wp-admin-theme-color-darker-10, var(--pr-color-primary));
  color: var(--pr-color-white);
  outline: none;
  box-shadow: none;
}

.prorank-dynamic-variables__item-content {
  display: flex;
  flex-direction: column;
  gap: var(--pr-spacing-0-5);
}

.prorank-dynamic-variables__code {
  font-family: Consolas, Monaco, monospace;
  font-size: var(--pr-font-size-xs);
  font-weight: var(--pr-font-weight-semibold);
  color: var(--pr-color-error);
  background-color: var(--pr-color-background-hover);
  padding: var(--pr-spacing-0-5) var(--pr-spacing-1);
  border-radius: var(--pr-radius-small);
  align-self: flex-start;
}

.prorank-dynamic-variables__item:focus .prorank-dynamic-variables__code {
  background-color: var(--pr-color-white-20);
  color: var(--pr-color-white);
}

.prorank-dynamic-variables__label {
  font-size: var(--pr-font-size-sm);
  font-weight: var(--pr-font-weight-medium);
  color: var(--pr-color-text-primary);
}

.prorank-dynamic-variables__item:focus .prorank-dynamic-variables__label {
  color: var(--pr-color-white);
}

.prorank-dynamic-variables__description {
  font-size: var(--pr-font-size-xs);
  color: var(--pr-color-text-tertiary);
  line-height: var(--pr-line-height-tight);
}

.prorank-dynamic-variables__item:focus .prorank-dynamic-variables__description {
  color: var(--pr-color-white-80);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .prorank-dynamic-variables__header {
    border-bottom-color: var(--pr-color-border-dark);
  }
  
  .prorank-dynamic-variables__header h3 {
    color: var(--pr-color-text-primary-dark);
  }
  
  .prorank-dynamic-variables__header .description {
    color: var(--pr-color-text-secondary-dark);
  }
  
  .prorank-dynamic-variables__item:hover {
    background-color: var(--pr-color-white-5);
  }
  
  .prorank-dynamic-variables__code {
    background-color: var(--pr-color-white-10);
    color: var(--pr-color-error);
  }
  
  .prorank-dynamic-variables__label {
    color: var(--pr-color-text-primary-dark);
  }
  
  .prorank-dynamic-variables__description {
    color: var(--pr-color-text-secondary-dark);
  }
}

/* Dynamic Text Control styles */
.prorank-dynamic-text-control__label,
.prorank-dynamic-textarea-control__label {
  display: inline-flex;
  align-items: center;
  gap: var(--pr-spacing-1);
}

.prorank-dynamic-text-control .components-base-control__label,
.prorank-dynamic-textarea-control .components-base-control__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Ensure the variable button doesn't affect label layout */
.prorank-dynamic-text-control .prorank-dynamic-variables,
.prorank-dynamic-textarea-control .prorank-dynamic-variables {
  margin-left: auto;
}