/* ==========================================================================
   Универсальный селектор товаров (ProductSelectorComponent)
   Поддерживает общие классы .product-* и специфичные .rnp-product-*
   ========================================================================== */

.product-selector,
.rnp-product-selector {
  position: relative;
  display: inline-block;
  min-width: 180px;
  max-width: 260px;
  width: 220px;
  flex: 0 1 220px;
}

.product-selector-form,
.rnp-product-selector-form {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 0;
}

.product-input-wrapper,
.rnp-product-input-wrapper {
  display: flex !important;
  align-items: center !important;
  height: 42px !important;
  background-color: #ffffff !important;
  border: 1px solid #d8dce9 !important;
  border-radius: 8px !important;
  padding: 0 10px 0 12px !important;
  box-sizing: border-box !important;
  transition: border-color 0.2s, box-shadow 0.2s;
  cursor: text;
}

.product-input-wrapper:hover,
.rnp-product-input-wrapper:hover {
  border-color: #b0b7cb !important;
}

.product-selector.is-open .product-input-wrapper,
.product-selector.is-open .rnp-product-input-wrapper,
.rnp-product-selector.is-open .product-input-wrapper,
.rnp-product-selector.is-open .rnp-product-input-wrapper,
.product-input-wrapper:focus-within,
.rnp-product-input-wrapper:focus-within {
  border-color: #6c5ce7 !important;
  box-shadow: 0 0 0 2px rgba(108, 92, 231, 0.15) !important;
}

.product-search-icon,
.rnp-product-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8c97ad;
  margin-right: 8px;
  flex-shrink: 0;
}

.product-search-icon svg,
.rnp-product-search-icon svg {
  width: 16px;
  height: 16px;
  stroke: #8c97ad;
}

.product-search-input,
.rnp-product-search-input {
  border: none !important;
  outline: none !important;
  background: transparent !important;
  width: 100% !important;
  height: 100% !important;
  font-size: 13px !important;
  color: #1e293b !important;
  padding: 0 !important;
  margin: 0 !important;
  box-shadow: none !important;
}

.product-search-input::placeholder,
.rnp-product-search-input::placeholder {
  color: #94a3b8 !important;
}

.product-input-actions,
.rnp-product-input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  flex-shrink: 0;
}

.selected-badge,
.rnp-selected-badge {
  background-color: #6c5ce7;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 12px;
  padding: 1px 7px;
  line-height: 16px;
  min-width: 18px;
  text-align: center;
}

.clear-btn,
.rnp-clear-btn {
  background: none !important;
  border: none !important;
  padding: 0 2px !important;
  color: #94a3b8 !important;
  font-size: 14px !important;
  line-height: 1 !important;
  cursor: pointer !important;
  height: auto !important;
  width: auto !important;
  transition: color 0.15s;
}

.clear-btn:hover,
.rnp-clear-btn:hover {
  color: #1e293b !important;
}

.product-dropdown-menu,
.rnp-product-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 400px;
  max-width: 90vw;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  padding: 14px 14px 10px 14px;
  z-index: 1100;
}

.product-dropdown-menu.active,
.rnp-product-dropdown-menu.active {
  display: block !important;
}

.product-dropdown-header,
.rnp-product-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.product-dropdown-info,
.rnp-product-dropdown-info {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-deselect-link,
.rnp-product-deselect-link {
  background: none !important;
  border: none !important;
  padding: 0 !important;
  color: #6c5ce7 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  height: auto !important;
  width: auto !important;
}

.product-deselect-link:hover,
.rnp-product-deselect-link:hover {
  text-decoration: underline !important;
}

.product-dropdown-tools,
.rnp-product-dropdown-tools {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.product-archive-option,
.rnp-product-archive-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  margin: 0;
  user-select: none;
}

.product-archive-option input[type="checkbox"],
.rnp-product-archive-option input[type="checkbox"] {
  width: 15px !important;
  height: 15px !important;
  margin: 0 !important;
  cursor: pointer !important;
  accent-color: #6c5ce7;
}

.product-dropdown-list,
.rnp-product-dropdown-list {
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 4px;
}

.product-item,
.rnp-product-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
  margin: 0;
}

.product-item:hover,
.rnp-product-item:hover {
  background-color: #f5f3ff !important;
}

.product-item.is-selected,
.rnp-product-item.is-selected {
  background-color: #fbfaff;
}

.product-checkbox,
.rnp-product-checkbox {
  width: 16px !important;
  height: 16px !important;
  margin: 2px 0 0 0 !important;
  cursor: pointer !important;
  flex-shrink: 0;
  accent-color: #6c5ce7;
}

.product-item-info,
.rnp-product-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
  flex-grow: 1;
}

.product-item-title,
.rnp-product-item-title {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.35;
  word-break: break-word;
}

.product-item-subtitle,
.rnp-product-item-subtitle {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}

/* Утилита скрытия элементов управления селектора (бейдж, очистка, снятие выбора) */
.product-selector .is-hidden,
.rnp-product-selector .is-hidden,
.is-hidden {
  display: none !important;
}
