/* ===== CUSTOM DROPDOWN ===== */
.cp-dropdown {
  position: relative;
  display: inline-block;
  min-width: 200px;
}

.cp-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-active);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  white-space: nowrap;
}
.cp-dropdown-btn:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.cp-dropdown.open .cp-dropdown-btn { border-color: rgba(255,255,255,0.22); }

.cp-dropdown-icon {
  display: flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex-shrink: 0; color: var(--text-secondary);
}
.cp-dropdown-icon img { width: 15px; height: 15px; object-fit: contain; border-radius: 3px; }
.cp-dropdown-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.cp-dropdown-arrow { flex-shrink: 0; color: var(--text-muted); transition: transform var(--transition); }
.cp-dropdown.open .cp-dropdown-arrow { transform: rotate(180deg); }

/* Menu rendered as a PORTAL (appended to body, position:fixed) */
.cp-dropdown-portal {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.8);
  z-index: 99999;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  max-height: 280px;
  overflow-y: auto;
  min-width: 200px;
}
.cp-dropdown-portal.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.cp-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.cp-dropdown-item:last-child { border-bottom: none; }
.cp-dropdown-item:hover { background: var(--bg-hover); }
.cp-dropdown-item.active { background: var(--bg-active); }

.cp-dropdown-item-icon {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; flex-shrink: 0; color: var(--text-secondary);
}
.cp-dropdown-item-icon img { width: 16px; height: 16px; object-fit: contain; border-radius: 3px; }

.cp-dropdown-item-body { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cp-dropdown-item-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cp-dropdown-item-desc  { font-size: 11px; color: var(--text-muted); }

.cp-dropdown-item-check {
  width: 16px; height: 16px; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); opacity: 0; flex-shrink: 0; transition: opacity var(--transition);
}
.cp-dropdown-item.active .cp-dropdown-item-check { opacity: 1; }
