/**
 * counterparty-picker.css — styles for counterparty-select field
 *
 * Used by window.CounterpartySelect (see counterparty-picker.js).
 * Uses team CSS vars: --bg-2 / --border / --text / --primary / --danger.
 *
 * Task: radar-os--479 block 74.
 */

.cp-container {
  position: relative;
  width: 100%;
}

.cp-field {
  position: relative;
  display: flex;
  align-items: center;
}

.cp-input {
  width: 100%;
  padding-right: 28px;
}

.cp-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text, #b8bcc4);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
}

.cp-clear:hover {
  background: var(--bg-2, #1a1e28);
  color: var(--text, #e6e6e6);
}

/* Block 747 round 2 task 479 — «selected input» state + meta caption below */
.cp-container.cp-selected .cp-input {
  border-color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.06);
}

.cp-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-muted, #8a8f99);
  padding-left: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cp-meta[hidden] {
  display: none;
}

/* Dropdown container */
.cp-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg-2, #1a1e28);
  border: 1px solid var(--border, #2a2e38);
  border-radius: 8px;
  max-height: 380px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.cp-dropdown[hidden] {
  display: none;
}

/* Search result row */
.cp-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border, #2a2e38);
  transition: background 0.1s;
}

.cp-item:last-child {
  border-bottom: none;
}

.cp-item:hover {
  background: var(--bg-3, #232833);
}

.cp-item-name {
  font-size: 14px;
  color: var(--text, #e6e6e6);
  font-weight: 500;
}

.cp-item-meta {
  font-size: 12px;
  color: var(--text-muted, #8a8f99);
  margin-top: 2px;
}

/* «➕ Создать» row */
.cp-item-create {
  padding: 12px 14px;
  cursor: pointer;
  background: var(--bg-3, #232833);
  border-top: 1px dashed var(--border, #2a2e38);
  color: var(--primary, #4ea4d6);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.1s;
}

.cp-item-create:hover {
  background: var(--primary, #4ea4d6);
  color: #fff;
}

.cp-item-create b {
  font-weight: 600;
}

/* Mini-form (rendered inside dropdown) */
.cp-miniform {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-mf-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #e6e6e6);
  margin-bottom: 4px;
}

.cp-mf-label {
  font-size: 12px;
  color: var(--text-muted, #8a8f99);
  margin-top: 2px;
}

.cp-mf-name,
.cp-mf-inn .if-input,
.cp-mf-type {
  width: 100%;
}

.cp-mf-inn {
  position: relative;
}

.cp-mf-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.cp-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s, opacity 0.15s;
}

.cp-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cp-btn-primary {
  background: var(--primary, #4ea4d6);
  color: #fff;
  flex: 1;
}

.cp-btn-primary:hover:not(:disabled) {
  background: var(--primary-hover, #6EC1FF);
}

.cp-btn-secondary {
  background: transparent;
  border-color: var(--border, #2a2e38);
  color: var(--text, #e6e6e6);
}

.cp-btn-secondary:hover {
  background: var(--bg-3, #232833);
}

.cp-mf-error {
  color: var(--danger, #dc4a4a);
  font-size: 13px;
  padding: 8px 10px;
  background: rgba(220, 74, 74, 0.1);
  border-radius: 6px;
  margin-top: 4px;
}

.cp-mf-error[hidden] {
  display: none;
}
